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?
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.
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
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.
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.
Maybe this works, but only for Simulator.
In Product
> Scheme
> Edit Scheme...
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 :(
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With