Uploaded image for project: 'Clover'
  1. Clover
  2. CLOV-1601

TestNG test methods not discovered when @Test annotation is at the class-level

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Won't Fix
    • open-source
    • Test Optimization
    • None
    • Clover 4.0.2
      Ant 1.8
      Java 1.8
      TestNG 6.8.7
    • Our product teams collect and evaluate feedback from a number of different sources. To learn more about how we use customer feedback in the planning process, check out our new feature policy.

    Description

      TestNG allows test methods to be specified by a @Test annotation at the class-level. TestNG will recognise all public methods of that class as test methods:

      @Test
      public class TestClass
      {
          public void testSomething() { /* ... */ }
          private void imNotATest() { /* ... */ }
      }
      

      This appears to be unsupported by Clover, which does not detect these methods as test methods during the instrumentation phase. This results in all such test methods being run during an optimized test run.

      Workaround: Remove the @Test annotation from the class and instead annotate each test method.

      Related Clover documentation: https://confluence.atlassian.com/display/CLOVER/Clover+test+detection

      Attachments

        Activity

          People

            Unassigned Unassigned
            0f30c17ea152 Mitchell Archibald
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: