Closed interpol2006 closed 6 years ago
if (cashback_option.getAttribute("value") == "#")
Nếu là so sánh String thì dùng equal thay vì == ( đây là toán tử so sánh của kiểu boolean)float included_tax_in_eur = 0
nên để là float included_tax_in_eur = 0.0f
7
public float get_included_tax()
{
float included_tax_in_eur = 0 ;
float gross = get_dc_purchase_price_in_eur();
if (included_tax_option.getAttribute("value") == "#")
{
included_tax_in_eur = Float.parseFloat(includedtaxField.getAttribute("value"));
}
else
{
included_tax_in_eur = gross*Float.parseFloat(includedtaxField.getAttribute("value"));
}
return included_tax_in_eur;
}
Thì nên là
public float get_included_tax(){
float included_tax_in_eur = 0.0f ;
float gross = get_dc_purchase_price_in_eur();
if ("#".equals( included_tax_option.getAttribute("value") )
return Float.parseFloat(includedtaxField.getAttribute("value"));
else
return gross*Float.parseFloat(includedtaxField.getAttribute("value"));
}
Affiliate_earnings = (Affiliate + freenight)/100*(gross_cost - included_tax - freenight_used)
Đối với các tổ hợp nhân và chia. Để cho rõ ràng thì nên đặt dâu ưu tiên
Hoặc
Affiliate_earnings = ((Affiliate + freenight)/100*)(gross_cost - included_tax - freenight_used)
Hoặc
Affiliate_earnings = (Affiliate + freenight)/(100*(gross_cost - included_tax - freenight_used))
Tránh sự hiểu nhầm trong tính toán ví dụ như 6÷ 2(1+2)
=1 hay 9 ???
Đôi hết các WebElement thành WebElementFacade. Nếu không sẽ không tận dụng được cái tính năng mới có trong PageObject cái được extends
Không phải tất cả các class ở phần Page đều cần giá trị
@DefaultUrl("http://xxx.yyy.review")
Không nên sử dụng
Assert.assertEquals
trong phần Page. Nó nên được sử dụng ở phần Def Steps vì nếu kết quả fail nó sẽ dừng toàn bộ các Steps phía sau. Nó chỉ nên đặt phía cuối của mỗi Scenario. Là bước cuối cùng để check kết quả outcomeThay vì dùng
getDriver().navigate().to("http://stage2.dreamcheaper.review/");
thì nên dùngopen();
-- còn tiếp --