0

i am using Selenium2 + TestNG + Maven2 + alot of other stuff. What I would like to do is to build the testng.xml (xml suite) on-the-fly upon test execution, because I would read those tests out of HP ALM QC via OpenTestArchitecture (OTA). Is there anyway to tell maven and surefire to NOT start TestNG immediately, instead to call a main method somewhere, where I could build my test suite via

XmlSuite xs = new XmlSuite();
XmlTest xt = new XmlTest(xs);
...
TestNG tng = new TestNG();
tng.setXmlSuites(suites);
tng.run();

the purpose is also to capture all types of exceptions to be able to write back the results from TestNG into HP ALM QC via OTA. Recently I had a exception from String.format and it killed my whole script because it happened in my TestNG @AfterMethod

Thanks :)

MushyPeas
  • 2,469
  • 2
  • 31
  • 48

1 Answers1

1

I think the best way would be to make things in the pre-integration-test life-cycle-phase and prepare there the testng.xml afterwards you can run the integration tests. The complete thing can be done via

mvn verify

You can start with a simple proof of concept.

khmarbaise
  • 92,914
  • 28
  • 189
  • 235
  • uff, i googled a bit and could not figure it out, you have any hint, i checked the Maven book, but if you have no clue (like i do), its seems tricky :/ – MushyPeas Aug 16 '12 at 13:08