I am trying to run the tests in Parallel for my automated test cases, but i need to execute them with different user credentials.
So i want to make it as if each of the threads executed at any point of time should not have the application open as the same user. My application is such that the view for a user will be retained and if the same user is accessing the application as different threads doing different actions it will lead to failure of test cases.
Hence i need to know if there is way out by which I can run the test cases in parallel using the testng xml, but these parallely executing test cases should be using different login credentials stored somewhere in the framework.
How can i do this ?? Please help me with the necessary approach
Create document with values like username, password and test id and assign each test with its own credentials. In tests read from the doc credentials based on test id.
Of course you can assign users before each execution.
In automated testcases you can run the tests by different user logins by reading data that is username and password from a csv file.
Or you can integrate with Cucumber where in feature file itself you can provide different credentials.
You can try this approach.
I can share the code if you want.
When you instantiate a WebDriver
, it will be binded to a unique session in Web Browser, that's why when you want to do parallel tests with the same WebDriver
, first, it will connect with the first user then the session will remember your credentials and you won't be able to test with another user. I think that you have for every user instantiate a WebDriver
so that you can do parallel tests.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.