I am writing test classes in the test module of an Android project, in particular I am writing some functional tests. Now I am in a situation in which I see that a lot of code I am writing should be reusable, now I explain better the situation. Let's think about a test class for a sign up procedure. Now I have a class SignUpTest which has some test methods and some helper methods, called
reach<name-of-the-page>Page()
Which complete the sign up till the page in the name of the method. This method are not test because they fill the pages of the sign up procedure with correct data not performing any kind of test.
My tests so look like:
test<name-of-the-page>Page() {
reach<name-of-the-page>Page()
Some tests
}
Now I am in the situation that the test of the sign up (depending on the environment in which I want to test testing or staging) should differ in some of these methods, in particular in some reach methods. Which is the best organization of the classes, avoiding redundancy of code, in your opinion? I absolutely don't want to create two classes with almost the same code except for a couple of methods. I read that inheritance is not a best practices in test cases organization.
Aucun commentaire:
Enregistrer un commentaire