Converting Our Test Suite to Screen Objects

Now that our toolbox is getting handier, we can quickly update the old test that removes a search term. Let’s do some more experimentation and plan out the new test in the new test-suite file to replace the old one:

04-OrganizingTestCode/step12/automation/test_suite.js
 
test(​"Removing the 'coffee' search term"​, ​function​() {
 
var​ s = SearchTermScreen;
 
s.removeTerm(​"coffee"​);
 
s.assertNoTerm(​"coffee"​);
 
});

Pretty straightforward. We only have two high-level steps to perform. Neither the removeTerm nor the assertNoTerm method exists yet, so let’s start by building removeTerm on the SearchTermScreen object:

04-OrganizingTestCode/step12/automation/lib/screens/SearchTermScreen.js
 
// ... ...

Get Test iOS Apps with UI Automation now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.