There is a nice resource on unit testing for QGIS. There is also a post on this, Writing automated tests for QGIS plugins, which requires the use of docker and relies on QGIS 2 plugin - QGIS Tester.
The progress on QGIS 3 is related to two plugins: 1) Tester and 2) QGIS Core Tests.
How this all ties up with the final screen of QGIS Plugin Builder once we activate the Unit Tests
checkbox? Where to start when we want to unit test the developed plugins?
test
in your newly created plugin directory ?test
directory, so you can look inside theMakefile
formake test
or just do Python unittest.test
directory are 1)__init__.py
, 2)qgis_interface.py
, 3)tenbytenraster.asc
, 4)tenbytenraster.asc.aux.xml
, 5)tenbytenraster.keywords
, 6)tenbytenraster.lic
, 7)tenbytenraster.prj
, 8)tenbytenraster.qml
, 9)test_init.py
, 10)test_qgis_environment.py
, 11)test_resources.py
, 12)test_save_attributes_dialog.py
, 13)test_translations.py
and 14)utilities.py
. These were created by default. When I look at thetests
folder of the QField Sync plugin, it looks much tidy with only 6 Python files and adata
folder.make test
, or just look in the Makefile under thetest
lines. See : g-sherman.github.io/Qgis-Plugin-Builder/#using-the-makefile . This will run typically Python unittest for all files begin withtest_
.