Currently I have my application in production and I need to create some tests (Junit). My question is if I need to stop the application or can I run the direct test.
Has anyone passed or knows anything about this?
Currently I have my application in production and I need to create some tests (Junit). My question is if I need to stop the application or can I run the direct test.
Has anyone passed or knows anything about this?
Your question does not even make sense. Running JUnit tests has nothing to do with running in production.
The JUnit tests mean that they are an extension of the build process. You compile your project and run the tests. If the tests catch something wrong, the build process is cut with an error status (although you can selectively choose to let it go even if some specific tests fail). Note that this process is done on the developer machine.
In a mature development process, when the tests pass, you get the JAR / WAR / EAR / etc produced and put into production. But nothing prevents you from doing the same with a JAR / WAR / EAR / etc that has not been tested with JUnit (not a good idea, but you can if you want).
Running JUnit tests in production is something that does not exist and does not make sense since JUnit runs the tests on the developer's machine, not production.
As for stopping an application in production because of testing in JUnit, this makes less sense as the two things are running on different machines. And even if it is on the same machine, this would be the same as wanting to stop the production application from running the compiler (ie, nonsense).
You should run Before tests to send the code to production.
Ideally, there is an approval environment for the tests, and if they pass, then only you send the codes to the production environment. It is important to keep in mind that the more atomic your classes and methods are, the more decoupled your code will be, and the lower the chance of a problem occurring during testing, since a modification does not usually result in a cascade of reactions.
There is no such thing as testing a code that is already in production. If there is no type approval environment, the tests can be performed on the machine used for the development before sending the code, keeping in mind that the testing environment may be different than the production environment. If you are not applying the continuous integration process, I highly suggest you read the topic for use in your work cycle.