hackoregon / civic-devops

Master collection point for issues, procedures, and code to manage the HackOregon Civic platform
MIT License
11 stars 4 forks source link

Define and implement an acceptable/sustainable testing framework for backend projects #211

Open bhgrant8 opened 6 years ago

bhgrant8 commented 6 years ago

Backend/API projects as well as databases have no consistently implemented testing strategies. Currently we cannot tell on a consistent basis:

  1. Whether code deployed on post apis is functioning as intended other then a basic 200 response on a root route
  2. Whether code deployed functions as intended, returns expected values
  3. If changes are made either to projects or changes are made to infrastructure, whether existing code continues to function (regression testing)

As we discuss future changes to infrastructure as well as provide a model to future projects/others in open source community, we should take the time to pay down this fairly deep technical debt.

A few current hurdles to providing a good framework (will flesh out what they mean, trying to notate for now):

  1. No testing/staging environment available in the CI/CD framework - we are running tests on production server. This is a bad pattern for a variety of reasons, what if apis make post/delete calls in future? reliance on what the data "is" when writing tests, vs testing code

  2. No guidelines to developers on what should be tested, how to write tests. Testing in the development containers this year was more of an after thought, started with how I implemented in the examplar. We may not need to swing to total test-driven-development but test-with-development should be more of our culture.

  3. Conflagration of tests into Django. It seems that we moved more from testing Django application code to testing whether the api was able to connect to the database.

A couple starting points: