[pitivi] docs: Update testing section and link to debugging



commit c921fb8d515bbab9700484414afb2b34746e6208
Author: Alexandru Băluț <alexandru balut gmail com>
Date:   Tue Apr 12 11:14:57 2022 +0200

    docs: Update testing section and link to debugging

 docs/Testing.md | 73 ++++++++++++++++++++++++++++-----------------------------
 1 file changed, 36 insertions(+), 37 deletions(-)
---
diff --git a/docs/Testing.md b/docs/Testing.md
index 6eca70c7a..ad04cebcf 100644
--- a/docs/Testing.md
+++ b/docs/Testing.md
@@ -1,72 +1,71 @@
 # Testing
 
 We have three sets of tests:
- - the normal unit tests (ninja test)
- - integration tests using GstValidate.
+ - the normal unit tests
+ - integration tests
  - [manual tests](QA_Scenarios.md)
 
-Since version [0.91](releases/0.91.md), our backend test suite is much
-smaller and simpler; since most of the core functionality is now handled
-by [GES](GES.md), you need to run GES's test suite instead if
-you want to test more thoroughly.
+Since version [0.91](releases/0.91.md) the test suite is set up similarly to
+the GStreamer tests, using GstValidate. The GES backend also has its own test
+suite, preventing things falling apart.
 
 ## Unit tests
 
-You can run the tests with the `ptvtests` alias created when you enter
-the [development environment](HACKING.md):
-
-```
-$ alias ptvtests
-ptvtests='ptvenv gst-validate-launcher /.../pitivi-dev/pitivi/tests/ptv_testsuite.py'
-```
-
-NOTE: If you are on [macOS or Windows](crossplatform.md), replace
-`ptvtests` with `gst-validate-launcher tests/ptv_testsuite.py`.
-
 Run the entire unit tests suite:
 
 ```
 $ ptvtests
 ```
 
-Run only the tests in a particular file:
+Run only a set of tests by specifying `-t`. For example:
 
 ```
 $ ptvtests -t test_project
+$ ptvtests -t test_project.TestProjectManager
+$ ptvtests -t test_project.TestProjectManager.test_loading_missing_project_file
+$ ptvtests -t TestProjectManager
+$ ptvtests -t test_loading_missing_project_file
+$ ptvtests -t Only_the_tests_affecting_the_clips_widgets_please
 ```
 
-Run only one particular unit test:
+To list the available tests, run:
 
 ```
-$ ptvtests -t tests.test_project.TestProjectManager.test_loading_missing_project_file
+$ ptvtests -L
 ```
 
-Normally it should work to use just the name of the test method:
+NOTE: `ptvtests` is an alias created when you enter the [development
+environment](HACKING.md). If you are on [macOS or Windows](crossplatform.md),
+replace `ptvtests` with `gst-validate-launcher tests/ptv_testsuite.py`.
 
 ```
-$ ptvtests -t test_loading_missing_project_file
+$ alias ptvtests
+ptvtests='ptvenv gst-validate-launcher /.../pitivi-dev/pitivi/tests/ptv_testsuite.py'
 ```
 
-To lists all the available tests, run:
+### Writing unit tests
 
-```
-$ ptvtests -L
-```
+Start by reading the utility methods in `tests/common.py`.
 
-### Writing unit tests
+The tests for the logic in a specific file have a corresponding tests file. For
+example the tests for `pitivi/clip_properties/color.py` can be found in
+`tests/test_clipproperties_color.py`. Note the undo/redo tests in
+`tests/test_undo_*` cover the same area as others such as the timeline.
+
+When writing a new test, look for similar ones to copy the initial part doing
+the setup. Most probably you find a good example and learn something in the
+process. We have a large number of tests covering most of the codebase.
 
-As mock library we use [Mock](http://www.voidspace.org.uk/python/mock/),
-as it's now integrated into
-[Python3](http://docs.python.org/dev/library/unittest.mock) which we use
-as of [0.94](releases/0.94.md).
+We use the `unittest.mock` standard [Python
+module](https://docs.python.org/3/library/unittest.mock.html) extensively in the
+unit tests, especially for the UI.
 
-We use the `unittest.mock` module extensively for writing unit tests for
-the UI.
+Unit tests can be [debugged](Debugging.md#debugging-unit-tests) by setting the
+`PITIVI_VSCODE_DEBUG` environment variable.
 
-If you're curious about our unit tests, the best way to get to know them
-is to write a few Pitivi unit tests and have us review them. Check out
-[how to set up your dev env](HACKING.md) and come in our [chat
-room](https://www.pitivi.org/contact/)!
+If you're curious about our unit tests, the best way to get to know them is to
+write a few and have us review them. Check out [how to set up your dev
+env](HACKING.md) and come in our [chat room](https://www.pitivi.org/contact/)!
 
 ## Integration tests
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]