linz / gazetteer

New Zealand Gazetteer of official place names
http://www.linz.govt.nz/regulatory/place-names/find-name/new-zealand-gazetteer-official-geographic-names/new-zealand-gazetteer-search-place-names#zoom=0&lat=-41.14127&lon=172.5&layers=BTTT
Other
2 stars 2 forks source link

Scope test coverage and strategy #61

Closed billgeo closed 4 years ago

billgeo commented 4 years ago

Task

The gazetteer has no automated testing. For the health of the product and to allow us to make changes we need automated testing.

To do this we need to know how much testing is needed, high level view of how we will test and also consider any migration that will be necessary when migration the plugin from QGIS 2 -> 3

Definition of Done :

Out of Scope

Discussion required

Add an Assignee, Epics, Estimate and any relevant Labels.

billgeo commented 4 years ago

We were thinking end to end testing of QGIS UI, using containerization, but maybe this is overkill? Looking at other LINZ QGIS plugins it seems that no one else is doing this.

This stack exchange post seems to cover how to do testing in QGIS container. Unfortunately the Boundless blog post on this is a broken link since they were bought out by Planet software. https://gis.stackexchange.com/questions/71206/writing-automated-tests-for-qgis-plugins

Would appreciate any help, discussion or links to best practice etc @dwsilk @imincik @palmerj

dwsilk commented 4 years ago

See (perhaps poorly named) unittest step here: https://github.com/linz/nz-buildings/blob/master/.github/workflows/build.yml

This uses docker-compose, with a PostgreSQL/PostGIS container and a QGIS container, and the test_runner that was originally developed by Boundless in your link above.

Official QGIS docker containers contain test helper scripts that were originally created and maintained by Boundless.

billgeo commented 4 years ago

Thanks @dwsilk . We will do something similar.

billgeo commented 4 years ago

Decisions:

palmerj commented 4 years ago

@billgeo I would suggest the following:

  1. Unit testing for the database components and the QGIS UI. This step will need mock input data or interfaces.
  2. Integration testing with both the database and the QGIS UI. This can contain your end-to-end test cases in it.

Note if timeframes are a problem you can drop 1/, but my feeling is that will help with the development of the component with CI. e.g setup of docker containers and running tests for those containers.

I think we should use pytest (rather than unittest) and pgTap for the database and python testing frameworks.

billgeo commented 4 years ago

Thanks @palmerj seems to be the consensus to some DB testing. @strk also suggested testing the schema (at least) in a PR elsewhere (that I now can't find).

palmerj commented 4 years ago

Cool. @strk comment is here https://github.com/linz/gazetteer/issues/62#issuecomment-597682363

dwsilk commented 4 years ago

I think we should use pytest (rather than unittest)

I think this would require a number of changes to the way testing is handled by the official QGIS docker containers, but I'd like to use pytest too, so if it can be done..

palmerj commented 4 years ago

I think this would require a number of changes to the way testing is handled by the official QGIS docker containers, but I'd like to use pytest too, so if it can be done..

Hmm.. What's the level of changes needed?

billgeo commented 4 years ago

Done. We have:

  1. test plans from NZGB
  2. An environment and automation for tests
  3. Tested automation with some basic QGIS UI tests