Jürg Billeter pushed to branch master at BuildStream / buildstream
Commits:
-
082b3811
by Angelos Evripiotis at 2018-11-15T19:48:12Z
-
b5b79056
by Jürg Billeter at 2018-11-15T20:24:58Z
1 changed file:
Changes:
... | ... | @@ -1547,6 +1547,24 @@ Tests that run a sandbox should be decorated with:: |
1547 | 1547 |
|
1548 | 1548 |
and use the integration cli helper.
|
1549 | 1549 |
|
1550 |
+You should first aim to write tests that exercise your changes from the cli.
|
|
1551 |
+This is so that the testing is end-to-end, and the changes are guaranteed to
|
|
1552 |
+work for the end-user. The cli is considered stable, and so tests written in
|
|
1553 |
+terms of it are unlikely to require updating as the internals of the software
|
|
1554 |
+change over time.
|
|
1555 |
+ |
|
1556 |
+It may be impractical to sufficiently examine some changes this way. For
|
|
1557 |
+example, the number of cases to test and the running time of each test may be
|
|
1558 |
+too high. It may also be difficult to contrive circumstances to cover every
|
|
1559 |
+line of the change. If this is the case, next you can consider also writing
|
|
1560 |
+unit tests that work more directly on the changes.
|
|
1561 |
+ |
|
1562 |
+It is important to write unit tests in such a way that they do not break due to
|
|
1563 |
+changes unrelated to what they are meant to test. For example, if the test
|
|
1564 |
+relies on a lot of BuildStream internals, a large refactoring will likely
|
|
1565 |
+require the test to be rewritten. Pure functions that only rely on the Python
|
|
1566 |
+Standard Library are excellent candidates for unit testing.
|
|
1567 |
+ |
|
1550 | 1568 |
|
1551 | 1569 |
Measuring performance
|
1552 | 1570 |
---------------------
|