I have created three packages.

  • generic
  • webpage
  • script

In generic I have base test and other common methods.
In webpage I created class for each web page.
In Script I have my testcases.

I need to execute my all the script through testng.xml and run only once login and logout functionality of application.

When I used @BeforeSuite and @AfterSuite to open and close the browser; I'm getting null pointer execption.

How can I run all the test cases in a single login and logout attempt?

  • You should provide us the code. – Alexey R. Apr 3 '18 at 9:41
  • We will need the code and the exception to have any idea what is happening. A null pointer exception means that you are calling an object that does not exist in that code scope – Kate Paulk Apr 3 '18 at 11:34

To run all the test cases in a single login and logout,create a separate class which contains your @BeforeSuite(login testcase) and @AfterSuite(logout testcase).Then extend this class in your main class where all your test scripts are present.By this way you can run all your test cases in a single login and logout.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.