0 Replies Latest reply on Jun 12, 2011 5:26 PM by Michal Huniewicz

    Run once per test case

    Michal Huniewicz Newbie

      Hi there, I googled a bit but couldn't find a proper solution. I need a method to run once per test case. The method needs to have @Inject'ed fields already set up, so I can't use static @BeforeClass.

       

      At the moment I'm doing this:

       

       

       @RunWith(Arquillian.class)
      public class ObjectTrackDataHandlerImpMacOsIT {
      
          @Inject
          private StubSongDao songDao;
      
           private static boolean handlerHasNotRunYet = true;
      
          @Deployment
          public static JavaArchive createTestArchive()
                  throws IllegalArgumentException, IOException {
              return ShrinkWrap [...]
           }
      
          @Before
          public void setUp() throws Exception {
              if (handlerHasNotRunYet) {
                // Expensive operation that needs songDao.
              }
           }
      
           // tests
      }
      

       

      But that's kinda dull. Any ideas?