QA SoftVision Team/Mobile/Writing tests: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 98: Line 98:


*Similarly you can open the context menu for History and Top Sites items
*Similarly you can open the context menu for History and Top Sites items
== Open a new tab and check the tab count ==
expectedTabCount = <nr_of_expected_tabs>;
tabCountText = tabCount.getText();
tabCountInt = Integer.parseInt(tabCountText);
mAsserter.is(tabCountInt, expectedTabCount, "Number of tabs increased");
= Logging info in the Android Logs to help debug =
* The Assert class can be found in the source folder in the subfolder /obj-android/build/mobile/robocop
* Please see the java code for the Assert methods for more info about how they work
== Test an object is not the same as a second object ==
* Method signature:
public void isnot(Object a, Object b, String name)
* Example for checking that there is a title set for the current page:
Element awesomebar = mDriver.findElement(getActivity(), "awesome_bar_title");
mAsserter.isnot(awesomebar, null, "Got the awesomebar"); // Checks that the awesomebar title is not null and posts in the logs
== Test an object is the same as a second object ==
* Method signature:
public void is(Object a, Object b, String name)
* Example for checking the default bookmarks:
ListView list = getAllPagesList(url);
mSolo.waitForText(url);
mAsserter.is(list.getChildCount(), 5, "all pages list has 5 children (the default bookmarks)"); // Checks that there are 5 entries in the list and posts in the logs
== Write text in logs ==
* Method signature:
public void dumpLog(String message) // writes text in the logs
== Log info about test progression ==
* Method signature:
public void ok(boolean condition, String name, String diag)
* Example
ListView list = getAllPagesList(url);
mSolo.waitForText(url);
mAsserter.ok(list != null, "checking that all pages list exists", list.toString()); // tests if the list is null and if it isn't it prints the list after printing the message of what the test does
Confirmed users
905

edits