• Post Reply Bookmark Topic Watch Topic
  • New Topic

Writing a JUnit Result XML on Runtime with Ant?  RSS feed

 
Bernard Sanvoisin
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Moosers,

I want to achieve the following:

While running an application on JBoss7, during RunTime I want to not only run JUnit Tests (which I can), but their results shall be exported into an XML file (JUnit.xsd Standard) like Ant does it on Build.
I google a little but I am stuck.

That is the code to simply run the test and display results in the console of Jboss7. Which works perfectly fine.


Now I am trying to use the ANT Api to generate the typical JUnit Result XML, to be able to give it to other tools like Jenkins.



Problems : To be able to cast to JUnitTest, I had to make my HelloWorldSecurityTest extend JUnitTest, which I am not sure was the right thing to do?
And now I got some exceptions like :


I suppose it tries to write the xml ? , and it is missing the libs/jars for the xml model?


[I could write my own "XMLWriter" and based on the Result.java export the data, but that seems to much overhead since Ant is able to that as well?]


Does anyone have a Fix or another approach?

Thanks and Greetings,
Mox.
 
Bernard Sanvoisin
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok I got a Result.XML as Expected with the following Code:



and I had to Add this to my TestClass



because thís Exception :

and "MethodName not found"

But now I got the Problem that only one test per testclass would be possible ...
therefore I need to build a testsuite ..
Anyone any Ideas ??
Greetings,
Mox.

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!