Reputation: 6249
When I want to build tests using the Codename One testing package to manipulate the Codename One UI programmatically and perform various assertions, I need to be sure that the starting condition of the app is always the same.
For example, is it possible to automatically clear the Storage in the init() if the app is running in test mode? In other words, can I run a specific code like Storage.getInstance().clear() only when the app is running tests (on the Simulator or in an actual device)?
Thank you
Upvotes: 1
Views: 36
Reputation: 52760
You can clear that in the beginning on the test instead of within the app. A test class has a prepare()
method which you can use to do the cleanup. Then the tests can derive from a common base class that implements such cleanup.
Upvotes: 1