Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run a fresh install of the application every time unit tests are run?

I've setup some XCTest unit tests for my application and would like every time I run tests for it to run in a brand new install of the application. Currently when I run subsequent tests it runs the tests in the same application that was run before which has a lot of state information already changed by the previous tests.

Is there a way to indicate that when you run unit tests that it should run the tests on a fresh version of your application?

like image 590
Shizam Avatar asked Oct 03 '14 19:10

Shizam


People also ask

How do I run a unit test after each build?

To run your unit tests after each local build, open the settings icon in the Test Explorer toolbar and select Run Tests After Build. As you run, write, and rerun your tests, Test Explorer displays the results in groups of Failed Tests, Passed Tests, Skipped Tests and Not Run Tests.

Does Visual Studio include the Microsoft unit testing frameworks?

Visual Studio includes the Microsoft unit testing frameworks for both managed and native code. However, Test Explorer can also run any unit test framework that has implemented a Test Explorer adapter. For more information about installing third-party unit test frameworks, see Install third-party unit test frameworks

How can I run tests from multiple test projects?

Test Explorer can run tests from multiple test projects in a solution and from test classes that are part of the production code projects. Test projects can use different unit test frameworks.

How do I run all the tests in a solution?

You can run all the tests in the solution, all the tests in a group, or a set of tests that you select. Do one of the following: To run all the tests in a solution, choose the Run All icon. To run all the tests in a default group, choose the Run icon and then choose the group on the menu.


1 Answers

Maybe this works, but only for Simulator.

In Product > Scheme > Edit Scheme...

enter image description here

xcrun simctl is command line utility to control the iOS Simulator. This uninstalls com.yourcompany.AppName application from booted simulator before running tests.

I don't know how to do like this for real device :(

like image 99
rintaro Avatar answered Oct 13 '22 02:10

rintaro