in autopilot tests, UnityTestCase setup is too big and complicated
Bug #1447206 reported by
Leo Arias
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
unity8 (Ubuntu) |
Fix Released
|
Medium
|
Unassigned | ||
Vivid |
New
|
Undecided
|
Unassigned |
Bug Description
The UnityTestCase setup in autopilot tests does a lot of things to prepare the environment and it has some conditionals to change the behaviour depending on the tests being run.
This makes the setup too complicated and hard to reuse in other tests. If we inherit from that test case, we inherit the setup, so this it's not a good base to start new tests.
An alternative is to write the setup as multiple fixtures, one per each environment detail we need. Fixtures allow to extend test cases by composition, so you choose the parts you want in each test, making the environment clearer.
Related branches
lp:~canonical-platform-qa/unity8/fix1447206-fixture_setup-1
- Albert Astals Cid (community): Approve
- PS Jenkins bot (community): Needs Fixing (continuous-integration)
-
Diff: 347 lines (+99/-139)5 files modifiedtests/autopilot/unity8/application_lifecycle/tests/test_application_lifecycle.py (+1/-1)
tests/autopilot/unity8/fixture_setup.py (+67/-1)
tests/autopilot/unity8/indicators/tests/__init__.py (+0/-2)
tests/autopilot/unity8/shell/__init__.py (+0/-24)
tests/autopilot/unity8/shell/tests/__init__.py (+31/-111)
Changed in unity8 (Ubuntu): | |
status: | New → Triaged |
importance: | Undecided → Medium |
To post a comment you must log in.
Currently the fake sensors setup is implemented as one big fixture.
This duplicates some of the code in the base test case setup. We should extract some parts of the fake sensors setup into a base fixture, and use it in the base class.