I am doing automation testing at my work and i'm stuck in a scenario.
My first test consist of creating a new user account which creates a username and a password. P.S. My password is always the same
My second test is basically login as a user with the username and password that I created in the first test.
Also, as the account is created, the database gets updated, and i'm able to connect to the database and execute the query (select user_name from accounts where password = 'pass123' order by created_dttm desc;)
So, since i'm able to execute and get the value from the db, how can I fetch that value and insert it into my username field in order to login as a customer.
Because i'm stuck in this situation, I always have to edit my 2nd test case with a different username that is created in my first tc. I would like my test script to take the username from the db and insert it into the username field automatically.
I'm kinda new to Java and automation, therefore, any kind of help will be highly appreciated. Thanks a ton!