Currently, I am in the process of working on a project that involves creating users and conducting tests on those users. To generate user data such as first name and last name, I am utilizing the faker
tool. My goal is to create a user with these generated details, save them in a variable, and then access them during the testing phase.
I have experimented with various approaches, like calling the data from a function or another test, but I have been unsuccessful in passing the created data to subsequent tests.
Here is an excerpt of the code:
fixture "Create test data and pass them to the other tests"
.page('url')
.beforeEach(async (t) => {
await t
.typeText("#txtUserName", 'username')
.typeText("#txtPassword", 'password')
.click("#btnLogin");
});
test("Create test data for add family tests", async (t) => {
// Code snippet for creating test data
});
// More code segments...
test("Access created test data", async (t) => {
// Code snippet for accessing created test data
});
Unfortunately, I cannot provide more than these code segments at this time. Your understanding is appreciated!
Data driven tests are not suitable for this scenario due to the high volume of users being created. Any assistance or suggestions would be greatly appreciated. Thank you!