Skip to content
This repository was archived by the owner on Jan 19, 2025. It is now read-only.

Commit bd73805

Browse files
committed
New post 🚀
1 parent 459b892 commit bd73805

9 files changed

+7
-6
lines changed

_drafts/2021-03-08-ios-test-multiple-configuration-test-plan.md renamed to _posts/2021-03-08-ios-test-multiple-configuration-test-plan.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ authors: [fabrizio_duroni]
1616

1717
---
1818

19-
If you look at my [Github profile](https://github.com/chicio "fabrizio duroni github profile"), you can see that one of my most starred open source project is [RangeUISlider](https://github.com/chicio/RangeUISlider "rangeslider ios"): iOS range selection slider compatible with UIKit and SwiftUI. I developed it using autolayout and it is highly customizable (thanks to IBDesignabled and IBInspectable or programmatic property access.
20-
In the last month I did a big refactoring on its code base so that I can add features quickly and improved the code quality. I also received some new feature request on github. In particular one user [was asking for Right To Left Languages (RTL) support](XXX). There was one problem with these activities: there were basically no Unit or UI tests. This means that each one of these activities was scaring and I had to manually test all the RAngeUISlider features. So I decided to add the tests needed but two problems arise:
19+
If you look at my [Github profile](https://github.com/chicio "fabrizio duroni github profile"), you can see that one of my most starred open source project is [RangeUISlider](https://github.com/chicio/RangeUISlider "rangeslider ios"): an iOS range selection slider compatible with UIKit and SwiftUI. I developed it using autolayout and it is highly customizable (thanks to IBDesignabled and IBInspectable or programmatic property access.
20+
In the last month I did a big refactoring on its code base so that I can add features quickly and improved the code quality. I also received some new feature request on github. In particular one user [was asking for Right To Left Languages (RTL) support](https://en.wikipedia.org/wiki/Right-to-left "right to left language"). There was one problem with these activities: there were basically no Unit or UI tests. This means that each one of these activities was scaring and I had to manually test all the RAngeUISlider features. So I decided to add the tests needed but two problems arise:
2121

2222
- the tests suite was slow. Just with the first few UI tests the execution of the entire tests suite was a pain in the ass :weary:. Given the fact that I wanted a quick feedback after each small steps of refactoring, this was not an ideal setup.
2323
- one as I told you, one of the latest feature I added was the support for RTL languages. To test this feature I just wanted to run the UI test I already wrote but with a different device configuration: I wanted to run them on devices configured with a RTL languages.
@@ -41,19 +41,20 @@ After that you will see a new window where you can choose how to create your fir
4141

4242
When I converted the `RangeUISlider` tests to use test plan I had the following tests in place:
4343

44-
* a set of unit tests suite
44+
* a set of unit tests suites
4545
* 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).
4646
* 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.
4747

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.
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.
49+
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`. These tests 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.
4950

5051
{% include blog-lazy-image.html description="The UnitTestPlan" width="1500" height="889" src="/assets/images/posts/test-plan-unit.jpg" %}
5152

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+
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 want add new test suites to this test plan only if they can be classified as related to programmatic features.
5354

5455
{% include blog-lazy-image.html description="The ProgrammaticChangesTestPlan" width="1500" height="889" src="/assets/images/posts/test-plan-programmatic.jpg" %}
5556

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.
57+
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`. This test plan contains the tests related to all the core features 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 you define multiple configuration for the same test. This basically means that the tests included in a test plan with multiple configuration will be execute multiple times, one for each configuration defined. So, for the `BehaviourTestPlan.xctestplan` test plan I defined two configuration, one with a simulated left to right language and the other one with the right to left language. In the screenshots below you can find the entire configuration.
5758

5859
{% include blog-lazy-image.html description="The BehaviourTestPlan tests" width="1500" height="889" src="/assets/images/posts/test-plan-behaviour-tests.jpg" %}
5960

89.1 KB
Loading
64.4 KB
Loading
71.4 KB
Loading
60 KB
Loading
66 KB
Loading
53.5 KB
Loading
61.8 KB
Loading
6.73 KB
Loading

0 commit comments

Comments
 (0)