while running the test case why browser is closing after execution of each test case(i.e it block in protractor) how to avoid it? because I have login page in my application , after login in first test case execution browser will close and while running second test case it’s failing because of session end. Do I need to send open URL and login credentials in each test case(I.e it block)??
So what you’re referring to is that you have e.g TestA which performs a login and a TestB which continues from there to perform whatever else steps are needed right?
Ranorex Webtestit tries to promote best practices. One of the most important ones, for long-term maintainability is isolated tests. That means that a test is able to perform every step from begin to end and is self-encapsulated. By following this practice you do gain a few important benefits:
- Tests are no longer dependent, which makes it easier to run them in parallel
- Since order is no longer important (every test for itself does the whole story) sharding is nicely supported (run on multiple processes, or cloud providers in parallel)
- A test becomes self-explanatory. You no longer need to walk through X tests to see what their intention is.
- Tests always execute in a real-world scenario. If the login works and e.g the checkout process works that still doesn’t mean that both together work, since imagine the login process redirects you to a wrong page.
- Every test run starts with a fresh browser session, that means no side-effects through local storage or session storage data, as well as cookies. You’re making sure that your website runs as intended for the user on every first hit.
- Last but not least you don’t have to care about properly making sure that the browser closes after a test run. There is nothing more disrupting then a broken build pipeline, because your build machine gave up after having piled up 100 open chrome browsers, consuming all of your RAM
The often conceived downside of having to repeat yourself in tests is mitigated by following the page object pattern. Another argument might be that tests take longer this way to execute. But in the long run this issue can be reduced through parallel executions. E.g Webtestit itself is tested the exactly same way. The total test-execution might take longer, but the number of in-between-glitches caught this way and thus never hitting the user, is definitely worth it