diff --git a/docs/README.md b/docs/README.md index 319874904..0e4941a14 100644 --- a/docs/README.md +++ b/docs/README.md @@ -159,3 +159,8 @@ For more information see [custom commands documentation](custom.md) - [flow: feature/release/hotfix publish](flow.md#flow-featurereleasehotfix-publish) - [flow: feature/release track](flow.md#flow-featurerelease-track) - [flow: feature pull](flow.md#flow-feature-pull) + + +## Package Testing + +Check the implementation details of the [tests](testing.md). diff --git a/docs/testing.md b/docs/testing.md new file mode 100644 index 000000000..eb9208501 --- /dev/null +++ b/docs/testing.md @@ -0,0 +1,32 @@ +# Package Testing + +We try to cover the most crucial functionality with unit tests using +[UnitTesting](https://github.com/randy3k/UnitTesting). To run the tests +locally, you should install UnitTesting via Package Control. + +## Run the test specs locally + +First you need to [clone](https://github.com/divmain/GitSavvy#less-simple) GitSavvy repo from source. +Open the directory `GitSavvy` and simply run the command `UnitTesting: Test Current Project` + +## Some details about DeferrableTestCase + +[DeferrableTestCase][1] is used to write the test cases. They are executed by +the [DeferringTextTestRunner][2] and the runner expects not only regular test +functions, but also generators. If the test function is a generator, it does +the following + +- if the yielded object is a callable, the runner will evaluate the + [callable][3] and check its returned value. If the result is `True`, the + runner continues the generator, if not, the runner will wait until the + condition is met. + +- If the yielded object is an integer, say `x`, then it will [continue][4] the + generator after `x` ms. + +- Otherwise, the `yield` statement will always wait for 10 ms. + +[1]: https://github.com/randy3k/UnitTesting/blob/dc810ee334bb031710b859478faaf50293880995/unittesting/core/st3/runner.py#L49 +[1]: https://github.com/randy3k/UnitTesting/blob/dc810ee334bb031710b859478faaf50293880995/unittesting/core/st3/runner.py#L7 +[2]: https://github.com/randy3k/UnitTesting/blob/dc810ee334bb031710b859478faaf50293880995/unittesting/core/st3/runner.py#L49 +[3]: https://github.com/randy3k/UnitTesting/blob/dc810ee334bb031710b859478faaf50293880995/unittesting/core/st3/runner.py#L57