I’m utilizing Selenium and JUnit to automate assessments.
Shall we say there are two assessments and every has to authenticate with a distinct consumer and carry out an motion.
Can or not it’s finished any smarter than to name an authentication methodology in every check methodology? Ideally with annotations in order that the username for the check actually stands out whereas skimming via the code and the login methodology being in @Earlier than methodology or in TestBase class.
public class AppTest extends TestBase {
// this check have to be run with userA
@Check
public void testA() {
authenticateUser (userA);
int rely = retrieveNewEmailCount();
assertEquals(NEW_EMAIL_COUNT, rely);
}
// this check have to be run with userB
@Check
public void testB() {
authenticateUser (userB);
String notificationText = retrieveNoNewEmailNotification();
assertEquals(NO_EMAIL_NOTIFICATION, notificationText);
}
}
Don’t touch upon enterprise logic within the examples above as that is simply simplified instance. The true assessments are usually not about emails in any respect.
In actuality there are a whole bunch of assessments and nearly 100 customers.
Every consumer participates from one to a whole bunch assessments. Every check is run as soon as with one explicit consumer solely, ie no have to run the identical check few instances with completely different customers.