Is it a good idea to write tests for an environment other than development?

Let's say I have a (fairly typical) set of environments: PROD, UAT, QA, DEV . Is it a good idea to run tests in all environments?

That’s what I’m thinking about. I have a proc in SQL that my code depends on, I will call it proc_getActiveCustomers . If this proc is not there, my application will quickly go south. Therefore, I am writing a test that checks for the availability of this proc in the database. Nothing new here.

But when I then deploy my application to a QA environment, would I also like to have a test that checks this environment for proc_getActiveCustomers ? I think this is a good idea, but I have never heard of testing in environments outside of development. It makes me wonder if there is a flaw that I don’t know about.

The direction I'm going to is to have a list of environments in the code, and then pass that environment to my unit test.

+4
source share
3 answers

This is called smoketest , and IMHO is a good idea in your case (too).

Smoketest is a quick (kit) test (s) to ensure that the product is installed correctly and basically works in working condition. Unlike integration tests, downloads, etc., which are much more thorough, consume resources and often change the state of the system in undesirable ways, therefore they are not suitable in a production environment.

+5
source

The test you are talking about does not seem to me a "unit." It checks the settings are correct. I would, of course, enable verification of the application initialization code and force it to create a stored procedure in the case, but I would not call it a “test” in the sense of TDD.

This is like running a checklist to make sure all of your components are installed correctly.

unit test should check if the component is working as intended, and not there ...

0
source

The drive must be in order for the application to get into a deployable situation. I would say that everything models the production environment. If your application has this dependency (real, bullied, subliminal or fake), it should always be checked. You can check continuous integration. This can help you determine if you need this test.

0
source

Source: https://habr.com/ru/post/1308472/


All Articles