You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 19, 2025. It is now read-only.
Copy file name to clipboardExpand all lines: _drafts/2021-03-08-ios-test-multiple-configuration-test-plan.md
+12-5Lines changed: 12 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -45,18 +45,25 @@ When I converted the `RangeUISlider` tests to use test plan I had the following
45
45
* some UI test suites to test all the behavioural features (e.g. custom scale, step increment, SwiftUI integration etc.) You can find this test in the `MixedFeatureTest`, `InsideTableViewTests` and `SwiftUITests` test classes (see the repository link at the beginning of this post).
46
46
* some UI test suites to test the programmatic setup features (e.g. programmatic scale change, knob starting and current position). You can find this tests inside the `ProgrammaticDefaultKnobValueChangeTests`, `ProgrammaticKnobChangeTests` and `ProgrammaticScaleChangeTests` test classes.
47
47
48
-
As you can understand from the list above, these are three group of separated tests types that I want to execute indipendently based on the code piece I'm working on. So I decided to create 3 test plans. The first one is `UnitTestPlan.xctestplan`. In this test plan I added all the unit tests I had at the time in order to be able to execute them when I modify a piece of code that is related to all the collaborators that contains the logic related to the range selected or the step increment calculations. This test are executed with a single configuration. They can be executed in parallel so I checked also the option `Execute in parallel (if possible)`. I also wanted that new tests added to this suite should be added automatically to this test plan, so I checked the `Automatically include new tests` option.
48
+
As you can understand from the list above, these are three group of separated tests types that I want to execute indipendently based on the code piece I'm working on. So I decided to create 3 test plans. The first one is `UnitTestPlan.xctestplan`. In this test plan I added all the unit tests I had at the time in order to be able to execute them when I modify a piece of code that is related to all the collaborators that contains the logic related to the range selected or the step increment calculations. This basically means that test target launched by the test plan is `RangeUISliderTests`. This test are executed with a single configuration. They can be executed in parallel so I checked also the option `Execute in parallel (if possible)`. I also wanted that new tests added to this suite should be added automatically to this test plan, so I checked the `Automatically include new tests` option.
49
49
50
50
{% include blog-lazy-image.html description="The UnitTestPlan" width="1500" height="889" src="/assets/images/posts/test-plan-unit.jpg" %}
51
51
52
-
The second test plan I created is `ProgrammaticChangesTestPlan.xctestplan`. As you can imagine in this test plan I added all the test related to the RangeUISlider programmatic setup features. In particular at the moment of the creation of the test plan I had 3 test suite that should be contained in this test plan: `ProgrammaticDefaultKnobValueChangeTests`, `ProgrammaticKnobChangeTests` and `ProgrammaticScaleChangeTests`. For this plan I *unchecked* the `Automatically include new tests` option, because I would add new test suite to this test plan only if they can be classified as related to programmatic features.
52
+
The second test plan I created is `ProgrammaticChangesTestPlan.xctestplan`. As you can imagine in this test plan I added all the test related to the RangeUISlider programmatic setup features. In particular at the moment of the creation of the test plan I had 3 test suite that should be contained in this test plan: `ProgrammaticDefaultKnobValueChangeTests`, `ProgrammaticKnobChangeTests` and `ProgrammaticScaleChangeTests`. These are all UI test, so in this case the test target launched by the test plan is `RangeUISliderUITests`. For this plan I *unchecked* the `Automatically include new tests` option, because I would add new test suite to this test plan only if they can be classified as related to programmatic features.
53
53
54
54
{% include blog-lazy-image.html description="The ProgrammaticChangesTestPlan" width="1500" height="889" src="/assets/images/posts/test-plan-programmatic.jpg" %}
55
55
56
+
The third test plan I created is `BehaviourTestPlan.xctestplan`. In this test plan I added all the behavioural UI test suites I wrote for RangeUISlider: `MixedFeaturesTests`, `InsideTableViewTests` and `SwiftUITests`. These are again all UI tests so the test target launched by the test plan is `RangeUISliderUITests`. In this test plan contains the tests related to all the core feature of RangeUIslider: knobs movement, range selection, custom scale etc. This feature should be tested against multiple configuration because, as I said before, RangeUIslider supports the RTL text. Test plans let use define multiple configuration for the same test. This basically means that the test included in a test plan with multiple configuration will be execute multiple times, one for each configuration defined. So for this test plan I defined two configuration, one with a simulated left to right languageg and the other one with the right to left language. In the screenshots below you can find the entire configuration.
{% include blog-lazy-image.html description="The BehaviourTestPlan tests" width="1500" height="889" src="/assets/images/posts/test-plan-behaviour-tests.jpg" %}
59
+
60
+
{% include blog-lazy-image.html description="The BehaviourTestPlan configurations" width="1500" height="889" src="/assets/images/posts/test-plan-behaviour-configuration.jpg" %}
61
+
62
+
Last but not least I created a last test plan called `AllTestPlan.xctestplan` where I added all tests from all the test targets and I can use it to have a feedback when my change is spread across the logic, behaviour and UI.
63
+
64
+
So how can I set which test plan I want to run? In the `Test` section of the `Edit Scheme` screen you can choose the default test plan to be run with the `cmd + U` option. In this way you can change based on the piece of code you're working on.
65
+
66
+
{% include blog-lazy-image.html description="The default test plan is launched with the classic cmd + U shortcut" width="1500" height="889" src="/assets/images/posts/test-plan-set-default.jpg" %}
0 commit comments