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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.