tags:

views:

125

answers:

2

Hi,

I recently read (link text) about a way to statically add tests to test suite in JUnit 4? What about a dynamic way, i.e. how to add a test class if its name is known not earlier than at run-time, e.g. its name is read from XML file?

A: 

I don't know of a way to add to an existing suite, but you can create your own suite at runtime. The JUnitCore class lets you pass in a list of classes you want run. These can be read in from anywhere you like including XML.

Jeanne Boyarsky
A: 

I know how to do it. I can use JUnitExt library (http://junitext.sourceforge.net). It supports "declarative test configurations (as provided by TestNG)". See junitext.sourceforge.net/tutorial.html (How to parameterize tests using XML).

tallaght.ie