vendredi 26 août 2016

jUnit resets variable or keeps static variable

Currently I'm creating some Selenium Tests with Groovy. I have a separate test class for each section and the steps are the test methods. In the tests are running in a sequence to check the steps correctly. For the tests I'm using jUnit 4.11.

In my tests (e.g. login) I have a global variable email. This variable gets filled after the test creates an account extra for this test (the whole test class). I do this process in each test class to have a new account that works fine.

My problem is now that if I don't set email to static, jUnit rests the email variable after each test in the class. But if I set it to static and run another test (e.g. forgot password) it's still using the same email than before.

My actual question is, is it possible to not reset a global variable (not static) in a jUnit test?

Aucun commentaire:

Enregistrer un commentaire