I am using Selenium with TestNG to test a website. I created tests using the Selenium IDE and exported them to TestNG, each of which was a method in the class. For example,
For login tests, there is a Login class that has the methods testLogin (), testLogin2 (), etc. For registration tests, there is a Registration class that has the methods testSignup (), testSignup2 (), etc.
I use Ant to run tests that work fine, except that each class will open a browser and then run its methods, for example, if I have five classes, then five browsers will open at the same time, and then run the tests.
I want to get Ant / Selenium / TestNG to just open one browser and then run all the tests (in the same browser) in all the classes that I specified in testng.xml. Using the above example, I want to open one browser, then run testLogin (), testLogin2 (), testSignup (), testSignup2 (). If this cannot be achieved, I want to open a browser, run all the tests in the class, and then close the browser, and then open another browser, and then start the set of test methods in the next class.
Any help appreciated. Thanks in advance.
steven lau
source
share