Police-Data-Accessibility-Project / data-sources-app

An API and UI for using and maintaining the Data Sources database
MIT License
4 stars 5 forks source link

Develop less-frequent "comprehensive tests" #412

Open maxachis opened 2 months ago

maxachis commented 2 months ago

Context

Requirements

Tests

Test categories include:

Docs

Open questions

josh-chamberlain commented 2 months ago

Nice! Is there a simple way we can delineate in the code which destination branch each test is run on? Seems like most tests would be dev and some would be dev, main.

Would this require new tests, or can we establish this concept with the existing suite and treat further test creation as its own thing?

maxachis commented 2 months ago

Nice! Is there a simple way we can delineate in the code which destination branch each test is run on? Seems like most tests would be dev and some would be dev, main.

Yes! We can either update our existing Github Action or create a separate GitHub action to these more comprehensive tests, which ensures they run on PRs into main.

Would this require new tests, or can we establish this concept with the existing suite and treat further test creation as its own thing?

We could establish this with the existing suite, although most of the tests we have so far do one of the following:

All of these I would argue are things we should be testing on every PR, and combined don't take more than 2 minutes.

The new tests I'm envisioning would do a lot more testing, but with the caveat that they'll be testing the same functionality across all the different endpoints, and hence would involve less logic -- it's just checking to see that all the endpoints have the same, consistent behavior.

An example for this is my test_endpoints.py file, which tests that only the HTTP methods we intend for each endpoint return a response, and that others return a "Method Not Allowed" error. It's looking for the same response each time -- it's just testing for consistency.