Running multiple TestNG test cases from one test case

I have the following situation: I am creating a class with one test method, within this test method I create another class that contains several test methods.

The report only shows my initial test method, it passes the IFF that it passes, and all the tests in passing another class.

I would like the report to include my first test, as well as the results of all other tests in passing another class or failing.

Do you know how to do this?

+1


source to share


4 answers


it's impossible. testNG wraps your test classes and uses them, so creating a "new" test class in your test doesn't create all the extra testNG stuff for it, so when test methods are run inside it, it looks like they were run inside the original test methods from which it was created class.



short short story: you can't do this unless you've done something with testNG under the hood. It would be easier to just proxy test methods inside your test class

+1


source


go to testng option setting and select package option and select xml file containing all methods.



+1


source


There is a similar problem with the test structure using testNG , which provides some answers that you might be interested in.

0


source


@ Factory implementation is possible. Take a look at this answer: What is the difference between DataProvider and Factory in TestNG?

0


source







All Articles