Uploaded image for project: 'DeltaSpike'
  1. DeltaSpike
  2. DELTASPIKE-63

Integration test profiles for OWB and Weld don't honor category annotations

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 0.1-incubating
    • Tests
    • None
    • Apache Maven 3.0.3 (r1075438; 2011-02-28 18:31:09+0100)

    Description

      It seems like the integration test profiles for OWB and Weld ignore the @Category annotations used to restrict tests to a certain runtime environment like "WebProfile" or "FullProfile". This problem occurs when running the tests in both "core-impl" and "integration-test".

      To reproduce this just add this failing method to some test class and execute the tests in the default profile OWB:

      @Test
      @Category(WebProfileCategory.class)
      public void testCategory()

      { fail("Should not get executed!"); }

      Attachments

        1. DELTASPIKE-63.patch
          19 kB
          Christian Kaltepoth

        Activity

          I just want to let you know that I'm working on fixing this issue.

          It took me quite some time to find out what's going wrong but now it seems to work fine. The nice thing is that it will even work without the need to add @Category(SeCategory.class) to all existing tests.

          I'll prepare a patch and submit it later today.

          chkal Christian Kaltepoth added a comment - I just want to let you know that I'm working on fixing this issue. It took me quite some time to find out what's going wrong but now it seems to work fine. The nice thing is that it will even work without the need to add @Category(SeCategory.class) to all existing tests. I'll prepare a patch and submit it later today.

          Hey all,

          I spent quite some time on this one but now I think I got it right. I'll give a short summary of what was wrong and what I did to fix it.

          • Surefire was ignoring the JUnit categories for some reason. I updated the Surefire plugin to version 2.11 and manually added the JUnit provider in the correct version as a dependency to the plugin. Now both <groups> and <excludedGroups> work fine.
          • The OWB and Weld profiles didn't configure any JUnit categories for their test execution. Therefore both ran all the tests regardless of their category. Now both exclude WebProfileCategory and FullProfileCategory which works fine. I also updated the profiles for AS7 and Glassfish to execute all the tests as both containers support all the test categories.
          • Another thing that went wrong was that the "integration-test" module didn't execute the core tests at all. But somehow this was fixed together with the update to Surefire 2.11. The only thing I had to change was to include "arquillian.xml" on the classpath for the core test execution as this file is required for the AS7 and Glassfish profiles.
          • The test ExcludeTest didn't work correctly on AS7 which was caused by an invalid packaging of the test archive.

          The nice thing about my changes is that now all tests without any @Category annotation are executed in all the profiles. Therefore we don't need to add SeCategory to all the tests. Actually we could even remove SeCategory as it isn't required anymore.

          The only drawback of my changes is that every module that has "parent-code" or "parent-it" as it's parent needs to have the category marker interfaces in the test classpath, even "core-api". For now I copied the 3 interfaces to the "core-api" module. But we could thing about moving them to a separate dependency later.

          I'm attaching the patch to this ticket. I would apply it but I didn't receive my Apache account up to now. If somebody runs into these problems, feel free to apply it!

          chkal Christian Kaltepoth added a comment - Hey all, I spent quite some time on this one but now I think I got it right. I'll give a short summary of what was wrong and what I did to fix it. Surefire was ignoring the JUnit categories for some reason. I updated the Surefire plugin to version 2.11 and manually added the JUnit provider in the correct version as a dependency to the plugin. Now both <groups> and <excludedGroups> work fine. The OWB and Weld profiles didn't configure any JUnit categories for their test execution. Therefore both ran all the tests regardless of their category. Now both exclude WebProfileCategory and FullProfileCategory which works fine. I also updated the profiles for AS7 and Glassfish to execute all the tests as both containers support all the test categories. Another thing that went wrong was that the "integration-test" module didn't execute the core tests at all. But somehow this was fixed together with the update to Surefire 2.11. The only thing I had to change was to include "arquillian.xml" on the classpath for the core test execution as this file is required for the AS7 and Glassfish profiles. The test ExcludeTest didn't work correctly on AS7 which was caused by an invalid packaging of the test archive. The nice thing about my changes is that now all tests without any @Category annotation are executed in all the profiles. Therefore we don't need to add SeCategory to all the tests. Actually we could even remove SeCategory as it isn't required anymore. The only drawback of my changes is that every module that has "parent-code" or "parent-it" as it's parent needs to have the category marker interfaces in the test classpath, even "core-api". For now I copied the 3 interfaces to the "core-api" module. But we could thing about moving them to a separate dependency later. I'm attaching the patch to this ticket. I would apply it but I didn't receive my Apache account up to now. If somebody runs into these problems, feel free to apply it!

          Patch for the integration test issues

          chkal Christian Kaltepoth added a comment - Patch for the integration test issues

          People

            chkal Christian Kaltepoth
            chkal Christian Kaltepoth
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: