基于mrp获得折扣价的逻辑

时间:2018-05-29 10:53:24

标签: c# selenium-webdriver

i want a code in c# for getting the discounted price. In the screenshot ,under product details we have RSP/MRP. So the requested price that needs to be entered should always be greater then or equal to 50% of RSP/MRP. i am using POM framework. so i need to create a page object for the shown page and apply the logic in the pageobject and call the method from my test class.

<table class="table table-condensed table-bordered" cellspacing="0" cellpadding="4" rules="all" border="1" id="MainContent_gviewProduct" style="color:#333333;border-collapse:collapse;">
    <caption align="Top">
        <table width="100%" class="gridtitle"><tbody><tr><td class="text_Title">Product Details</td></tr></tbody></table>
</caption><tbody><tr style="color:White;background-color:#008D7A;font-weight:bold;">
        <th scope="col">Product Name</th><th scope="col">Product Code</th><th scope="col">Product UOM</th><th scope="col">Pack Size</th><th scope="col">RSP/MRP</th><th scope="col">Batch/MRP</th><th scope="col" style="width:150px;">Requested Price</th><th scope="col" style="width:150px;">Sale Qty in Packs</th><th scope="col" style="width:150px;">Remark</th>
    </tr><tr style="color:#333333;background-color:#F7F6F3;">
        <td>
                        <span id="MainContent_gviewProduct_lblSelectedProdName_0">2T</span>
                    </td><td>
                        <span id="MainContent_gviewProduct_lblSelectedProdCode_0">1010068</span>
                    </td><td>
                        <span id="MainContent_gviewProduct_lblSelectedProdUOM_0">Ltr</span>
                    </td><td>
                        <span id="MainContent_gviewProduct_lblPackSize_0">210.00</span>
                    </td><td>
                        <span id="MainContent_gviewProduct_lblRSP_0">222.00</span>
                    </td><td>
                        <span id="MainContent_gviewProduct_lblBatchPrice_0">220.00</span>
                    </td><td>
                        <input name="ctl00$MainContent$gviewProduct$ctl02$txtRequestPrice" type="text" maxlength="10" id="MainContent_gviewProduct_txtRequestPrice_0" oncopy="return false" onpaste="return false" oncut="return false" onkeyup="return checkDec(this);" onkeypress="return funDecNum(event);" style="width:75px;">
                        <br>
                        <span id="MainContent_gviewProduct_rextxtRequestPrice_0" style="visibility:hidden;">Provide Valid Requested Price!</span>
                    </td><td>
                        <input name="ctl00$MainContent$gviewProduct$ctl02$txtRequestQty" type="text" maxlength="5" id="MainContent_gviewProduct_txtRequestQty_0" oncopy="return false" onpaste="return false" oncut="return false" onkeyup="return funOnlyNum(this);" onkeypress="return funOnlyNum(event);" style="width:75px;">
                        <br>
                        <span id="MainContent_gviewProduct_rextxtRequestQty_0" style="visibility:hidden;">Provide Valid Sale Qty!</span>
                    </td><td>
                        <input name="ctl00$MainContent$gviewProduct$ctl02$txtRemark" type="text" maxlength="50" id="MainContent_gviewProduct_txtRemark_0" oncopy="return false" onpaste="return false" oncut="return false" style="width:150px;">
                        <br>
                        <span id="MainContent_gviewProduct_rextxtRemark_0" style="visibility:hidden;">Provide proper Remarks</span>
                    </td>
    </tr>
</tbody></table>

我想用c#中的代码来获得折扣价。在屏幕截图中,根据产品详细信息,我们有RSP / MRP。因此,需要输入的要求价格应始终大于或等于RSP / MRP的50%。我正在使用POM框架。所以我需要为显示的页面创建一个页面对象,并在pageobject中应用逻辑并从我的测试类中调用该方法。

1 个答案:

答案 0 :(得分:0)

在创建自动化测试用例时,您不应该创建一种方法来计算应用程序应用的折扣,或者实际上应用程序处理的任何其他业务逻辑。

相反,您应该有单独的测试用例,其中包含价格和数量的边界值,您应该知道将要应用的折扣的预期值。

如果稍后在您的应用程序中给予折扣的逻辑中有一些更改,那么您的测试用例应该按预期失败,然后您将更新测试套件中的预期结果值。