4 Replies Latest reply on May 9, 2011 8:06 AM by marx3

    Sonar and Arquillian

    marx3 Apprentice

      I'm trying to use Arquillian tests under Sonar and unfortunatelly there is an error:


      java.lang.NoClassDefFoundError: net/sourceforge/cobertura/coveragedata/HasBeenInstrumented


      I probably have found cause of error, it's Cobertura and Arquillian problem:



      This error causes tests fails and then fails Sonar build.


      Is there any workaround to this problem?

        • 1. Sonar and Arquillian
          Aslak Knutsen Master

          You will need Cobertura on the Container's ClassPath. But you will probably not get the results back to the client, so it will be all marked as not hit.

          • 2. Sonar and Arquillian
            marx3 Apprentice

            it partly helped. Now i have a problem that Cobertura instrumentation causes ClassNotFoundException because it's more demanding than tests (test run only some methods of class, and if this remaining methods uses classes missing in war, test runs ok, but Coberture instrumentation fails). I can fix my tests to add those missing classes, but all those manual war building is very annoying. Wouldn't it be better to use some software which automatically detect which classes are needed in war? There is for example Oops http://code.google.com/p/joops/ - give it a test class and it will detect all dependent classes. I can imagine that ShrinkWrap can have a method like: .addDependencies(Test.class)

            • 3. Sonar and Arquillian
              Aslak Knutsen Master

              We have some threads on class scanning, but I can't find them atm.


              Anyway, a quick look at joops basically expose the main issues we're having:




              See comments for possible workarounds..


              If you want to have a stab at resolving some of the comments, or have other ideas, feel free to heck.

              • 4. Sonar and Arquillian
                marx3 Apprentice

                Yes, interface implementations are problem, but adding them manually is much simpler then adding all the stuff manually. I have Joops working and it's much easier to make war with it, especially with much more demanding Cobertura.


                Anyway, roadmap of Arquillian is slightly innacurate...