[jboss-dev-forums] [Design of JBoss Portal] - JUnit improvements

julien@jboss.com do-not-reply at jboss.com
Thu Sep 28 12:59:16 EDT 2006


I have added some improvements in the JUnit stuff we have in order to be able to parameterize a testcase from the junit ant declaration.

It plays nicely with the test metadata improvements I added recently too. Here is an example of usage :


  |             <zest todir="${test.reports}" name="org.jboss.portal.test.core.model.instance.InstanceContainerTestCase"
  |                outfile="TEST-LocalInstanceContainerTestCase">
  |                <parameter name="PersistLocally" value="true"/>
  |             </zest>
  |             <zest todir="${test.reports}" name="org.jboss.portal.test.core.model.instance.InstanceContainerTestCase"
  |                outfile="TEST-RemoteInstanceContainerTestCase">
  |                <parameter name="PersistLocally" value="false"/>
  |             </zest>
  | 

Note that :

1/ the name of the nested element is Zest (because it needs a custom subclass of JUnitTest to integrate parameter).

2/ the outfile attribute is required in order to avoid collisions between the TEST-* files created by the formatters.

Once you are in a test case, you can retrieve the parameters by using :

Map params = TestParameter.readExternalParameters();

or by extending ConfigurableTestCase and using the getParameters().

I'll try to perform injection of parameters on the test case class using reflection later.


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3974964#3974964

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3974964



More information about the jboss-dev-forums mailing list