[jbossseam-issues] [JBoss JIRA] Commented: (JBSEAM-1371) Unable to use TestNG groups with SeamTest

Norman Richards (JIRA) jira-events at lists.jboss.org
Wed May 30 16:54:08 EDT 2007


    [ http://jira.jboss.com/jira/browse/JBSEAM-1371?page=comments#action_12363615 ] 
            
Norman Richards commented on JBSEAM-1371:
-----------------------------------------

This is because the begin/init/etc... methods are not being invoked when running a test group.  The only solution I could find was to make sure the lifecycle methods are in a test group and to run that testgroup along with the desired test group.  For example:

@Test(groups="base") 
public class SomeBaseTest 
extends SeamTest 
{ 
  @Configuration(beforeTestMethod=true) 
  public void begin()  { 
    super.begin(); 
  } 

  @Configuration(afterTestMethod=true) 
  public void end() { 
    super.end(); 
  } 

  @Configuration(beforeTestClass=true) 
  public void init() throws Exception { 
     super.init(); 
  } 

  @Configuration(afterTestClass=true) 
  public void cleanup() throws Exception 
  { 
    super.cleanup(); 
  } 
} 



> Unable to use TestNG groups with SeamTest
> -----------------------------------------
>
>                 Key: JBSEAM-1371
>                 URL: http://jira.jboss.com/jira/browse/JBSEAM-1371
>             Project: JBoss Seam
>          Issue Type: Bug
>          Components: Test Harness
>    Affects Versions: 1.2.1.GA
>            Reporter: Samuel Mendenhall
>            Priority: Minor
>
> testng xml in build.xml
> ++++++++++++++++++++++++++++++
> <testng outputdir="${basedir}/test-report" groups="SomeGroups">
>                         <classfileset dir="classes" includes="**/*.class" />
>                         <classpath path="${test.dir}" />
>                         <classpath path="${embedded-ejb3.dir}" />
>                         <classpath refid="build.classpath" />
> </testng>
> ++++++++++++++++++++++++++++++
> EmptyTest.java
> ++++++++++++++++++++++++++++++
> public class EmptyTest extends SeamTest {
> 	@Test(groups = {"SomeGroups"})
> 	public void testNothing() throws Exception {
> 		new FacesRequest() {
> 			@Override
> 			protected void invokeApplication() throws Exception {
> 				assert true;
> 			}
> 		}.run();
> 	}
> 	@Test
> 	public void testNothingAgain() throws Exception {
> 		assert true;
> 	}
> }
> ++++++++++++++++++++++++++++++
> command:
> ++++++++++++++++++++++++++++++
> ant test
> ++++++++++++++++++++++++++++++
> Exception:
> ++++++++++++++++++++++++++++++
> [testng] java.lang.NullPointerException
> [testng] at org.jboss.seam.mock.SeamTest$Request.run(SeamTest.java:418)
> [testng] at com.mydomain.convotest.EmptyTest.testNothing(EmptyTest.java:10)
> ..
> ++++++++++++++++++++++++++++++ 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the seam-issues mailing list