mercredi 25 février 2015

Selenium Java Junit - Assert if the result is greater than 1000



I am using Java Junit to verify the search result if greater than 1000


but Selenium can only storeText which is (String)


Than I try to convert (String) to (Int)


So that I can compare the search result(String) to 1000.


However, it doesn't work.


Also, I am not sure if I use assetThat in the right way.


Anyone knows the answer please help!


Thank you!


In Java code:



String result = selenium.getText("css=span.rcnt");
System.out.println("Search result is: " + result);

int foo = Integer.parseInt(result);

assertThat("Pass", foo, greaterThan(1000));



Aucun commentaire:

Enregistrer un commentaire