![]() Here’s the three test plans I’m going to create: Let’s look at some examples of how we might use test plans. You can add multiple test plans to the scheme, each with a different selection of tests and configurations. If you look at the scheme now you’ll see it lists the test plan where the tests used to be: I like to save the test plans in a top-level project directory named TestPlans: Save the test plan file to the project directory (and check it into version control). Either way you get to choose from three options:Ĭhoosing the first option creates a new test plan populated with the tests and configuration from the scheme. button below the tests:Īlternatively, from the Xcode menu: Product > Scheme > Convert Scheme to use Test Plans. From the scheme editor, select the Test phase and use the Convert to use Test Plans. If you have an existing scheme you can convert it to use test plans. You create a new test plan from the Xcode menu Product > Test Plan > New Test Plan. If you’re already doing some of the above by creating different schemes you may find you can consolidate into a single scheme with one or more test plans. Test plans make it much easier to set that up. I also want a full set of unit, UI and performance tests running against several configurations. Running selected tests with a specific configuration: For example, you don’t want performance tests to run in parallel.ĭifferent test scopes: I like to have a quick set of tests I run by default when I hit command-U. This is also a good way to generate screenshots for localizers. You set the application language and region as part of the configuration. Testing multiple localizations: Create a configuration for each language you support. You can easily add another configuration to run with malloc diagnostics. Running the test plan then runs our tests twice, once for each of the sanitizers. Using a test plan we can create two configurations, one with the address sanitizer enabled and a second with the thread sanitizer. Running tests with different sanitizers/diagnostics: You can’t test with both the address and thread sanitizers enabled at the same time. A test plan runs the selected tests multiple times, once for each of the configurations. These are the settings you would normally find in the scheme editor: launch arguments, localization settings, screenshot settings, text execution (alphabetic or random), runtime sanitizers, thread checker and malloc guards.Ĭonfigurations: One or more configurations which override the default options. For each test plan, you select the tests the plan will run and whether the tests can run in parallel.ĭefault options: A set of default (shared) settings that can be overriden by specific configurations. You don’t have to run all tests in the test target. Test targets: One or more test targets (unit or UI). xctestplan extension that you add to your Xcode project and reference from a scheme. What is a Test Plan?Īn Xcode test plan provides a way to run a selections of tests with various test configurations. ![]() Here’s my notes on how to get started with test plans. You can use schemes to create the different configurations but that quickly becomes unmanageable.Īpple added test plans to Xcode 11 to make it easier to rerun tests with varying test configurations. Running your tests with different environments, localizations and sanitizers is a good way to catch more bugs.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |