Selenium + Java · Lesson 36 of 44
Module 36: Test Data
Your task
Implement generateEmailWithPrefix:
Write it in the editor, then press Check answer (Ctrl + Enter).
public class UserCredentials {
private String email;
private String password;
public UserCredentials(String email, String password) {
this.email = email;
this.password = password;
}
public String getEmail() { return email; }
public String getPassword() { return password; }
}
// Random unique email generator:
public static String generateUniqueEmail() {
return "test_" + System.currentTimeMillis() + "@targetqa.com";
}Separating test logic from test data is essential for scalable automation. In this lesson, you will learn to manage static configurations via properties files, parse test data objects, and generate random dynamic data. Let's master test data!
Part of the Selenium + Java course (Selenium with Java). Practice this concept live in the Selenium Online Compiler or explore our free automation practice form.
Hardcoded accounts lead to test collisions when running tests in parallel across multiple threads.
Ready? Solve the task in the editor
Use Check answer to mark it complete. Hints are there if you need them.
___