'What is the correct way to run mobile UI tests using Appium?

Using Selenium webdriver we can open needed webpage like a precondition before our tests. But how to realize the same way in mobile and does it make any sence? We can use an Android interface startActivity to run activity we need but I feel like this way'll bring some troubles in the future... Can anybody give me advise please what way is preferably in monile qa automation: 1) init any independet session to sepatare out tests or 2) try to save time like using such interfases as startActivity with one session or write more complicated precondition scenarious garanteed our tests'll run the correct way from any activite within a single suite.



Solution 1:[1]

Yes, mobile tests can also have pre-conditions and setup steps. It will depend on the framework that you are using and the scenario under test.

For example - In case of Python, you can use test execution engine like pytest which offers a whole range of features for building tests. One feature offered by pytest is fixtures, which will allow you to write common pieces of code or steps/pre-conditions in separate functions and directly call in your test function.

In case of Java, you can use test execution engine like TestNG and achieve similar behaviour.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 virulent-slash