I am currently working on creating an automated set of functional / acceptance tests for the project, but I do not have much experience writing these types of tests, so I wanted to get some input into their correct structuring. In particular, I work with the Arkillian Graphene extension.
For example, let's say I have 3 tests: A, B and C.
TestA . Tests are registered in the account in the application. So, if the test was successful, the browser should be on the accountβs home / information page.
TestB : tests that change the account password. To do this, you need to log in to your account, and then check the functionality of changing the password.
TestC : tests that modify the email account. This again requires you to log in to your account and then verify the functionality of the email change.
If TestA fails due to a problem with the login code, it is obvious that TestB and TestC should also fail because they require an account login.
Question . Should automatic functional / acceptance tests duplicate the process required to complete a test verification? In this case, TestB and TestC must log in to the account before doing anything else. If each test explicitly calls something like:
LoginPage.login(username, password);
assertTrue(onCorrectAccountPage);
AccountModification.changePassword(newPassword);
Or should I use some way to mock the account in the session that can be used in tests B and C so that they don't fail, even if TestA (the actual login test)?
, , , , , , , - (.. , unit test), -, .
. , .:)