Checkout our demo site to practice selenium https://magento.softwaretestingboard.com/

0 like 0 dislike
480 views
by
retagged by
Hi,

We have a framework which is developed by one of our developers two years back, he used JUNIT for creating tests for different pages or screens.,

When I wanted to use this frameowork, I noticed that each test (method annotated as @Test ) is closing browser after completing its execution of its code.

For second @Test method, we need to open a fresh browser session. Is this how JUNIT works?

Note : There is code written for closing browser in any of the @Test or @After or @Afterclass methods.

When I tried to debug after the last line of @Test method, it is taking me in to JUNIT classes and finally closing the browser before going to start next @Test method.

And there is no paratmeterization concept in JUNIT test suites. So how can I make test suite which is parameterized and login once and execute multiple @Test methods without closing browser? Please help me.
by Master (1.2k points)
can you share some sample code? Also, share if you have any stack trace.

1 Answer

0 like 0 dislike
by
edited by
Yes. JUnit works exactly the way you have described.

It will close the browser once your execution is over. There will be code written in @After function that closes the browser.

If you want to debug @After function, put your debug point there.

Now to answer your second question about the implementation of parmeterization, the good idea is to work with your developer team, ask them to upgrade  JUnit to the latest version or migrate to TestNG.


This site is for software testing professionals, where you can ask all your questions and get answers from 1300+ masters of the profession. Click here to submit yours now!

...