3 Replies Latest reply on Jun 3, 2009 12:33 AM by bgroeneveld

    Seam Integration Testing with TestNG Groups

    dhinojosa

      What is the status on using our own TestNG groups with SeamTest testing? 


      Jira Ticket 1371 refers to this issue and it is closed but I really need to know the correct way to set it up.


      On the ticket, Pete Muir said



      User reports this works with new test structure.

      I don't particularly know what that means.  Was the following code the correct way to set it up?


      @Test(groups="base")
      public class SomeBaseTest
      extends SeamTest
      {
          @BeforeTest
          public void begin() {
            super.begin();
          }
      
          @AfterTest
          public void end() {
            super.end();
          }
      
          @BeforeClass
          public void init() throws Exception {
             super.init();
          }
      
          @AfterClass
          public void cleanup() throws Exception
          {
            super.cleanup();
          }
      } 
      

        • 1. Re: Seam Integration Testing with TestNG Groups
          pmuir

          You need to use the test structure from 2.1 series (that isn't it).

          • 2. Re: Seam Integration Testing with TestNG Groups
            bgroeneveld

            User (me) now reports that to use TestNG groups in Seam 2.1 you need to override SeamTest with:



            public class SomeBaseTest extends SeamTest
            {
                @Override
                @BeforeClass(alwaysRun=true)
                public void setupClass() throws Exception
                {
                   super.setupClass();
                }
                
                @Override
                @AfterClass(alwaysRun=true)
                public void cleanupClass() throws Exception
                {
                   super.cleanupClass();
                }
                
                @Override
                @BeforeSuite(alwaysRun=true) 
                @BeforeGroups
                public void startSeam() throws Exception
                {
                   super.startSeam();
                }
                
                @Override
                @AfterSuite(alwaysRun=true) 
                @AfterGroups(alwaysRun=true) 
                protected void stopSeam() throws Exception
                {
                   super.stopSeam();
                }
                
                @BeforeMethod(alwaysRun=true)
                @Override
                public void begin()
                {
                   super.begin();
                }
            
                @AfterMethod(alwaysRun=true)
                @Override
                public void end()
                {
                   super.end();
                }
                
            


            • 3. Re: Seam Integration Testing with TestNG Groups
              bgroeneveld

              Woops, there's something lost above.  The startSeam @Override should be:




                  @BeforeSuite(alwaysRun=true) 
                  @BeforeGroups(alwaysRun=true) 
                  public void startSeam() throws Exception
                  {
                     super.startSeam();
                  }