Why does surefire configuration for openmrs-core-api exclude all tests? / test failure

0 views
Skip to first unread message

Denise Draper

unread,
Feb 27, 2015, 12:42:16 AM2/27/15
to d...@openmrs.org
Hi ---

I have a situation I am trying to debug: running mvn test on openmrs-core on my dev machine passes, but there is a failure when Jenkins runs.   
The test that fails is OpenmrsTestsTest, and it fails with this error:

java.lang.AssertionError: org.openmrs.test should be a directory
	at org.junit.Assert.fail(Assert.java:88)
	at org.junit.Assert.assertTrue(Assert.java:41)
	at org.openmrs.OpenmrsTestsTest.getClasses(OpenmrsTestsTest.java:160)
        ...

If anybody has an idea why that might be happening, please let me know.

But meanwhile, I am using this as a reason to learn the Maven/Spring/OpenMRS testing infrastructure, and I ran across this in the openmrs-core-api pom.xml file:

         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
               <excludes>
                  <exclude>**/test/*</exclude>
                  <!-- Exclude mail test, slows build, breaks portability with requirements on port 25 -->
                  <exclude>**/notification/MessageServiceTest.java</exclude>
               </excludes>
            </configuration>
         </plugin>

I'm particularly interested in the highlighted line --- to me it looks as if this is saying "don't actually run any tests".  This line has been in the pom file since 2012, so I assume it is supposed to be that way.  Could somebody explain to me why it is there, and how the tests actually get run?

thanks,
denise

Rafal Korytkowski

unread,
Feb 27, 2015, 9:02:07 AM2/27/15
to Developers List
I think the intention in <exclude>**/test/*</exclude> was to exclude classes under the org.openmrs.test package. However as it is now it excludes tests, which are in any test package. It doesn't exclude all tests. Still it is wrong, but we never noticed any issues with that.

I believe it should be <exclude>org/openmrs/test/*</exclude>. 

Regarding the failing test. I'm not sure why that fails for you. Please debug and inspect variables to see what resource you get back.



-Rafał

--
OpenMRS Developers: http://om.rs/dev
Post: d...@openmrs.org | Unsubscribe: dev+uns...@openmrs.org
Manage your OpenMRS subscriptions: http://om.rs/id
 
Visit OpenMRS Talk at http://om.rs/talk for chat and discussions!

Denise Draper

unread,
Feb 28, 2015, 1:34:04 AM2/28/15
to d...@openmrs.org
Ah, that makes more sense.  Is there a reason the tests in this specific directory are excluded?
 
thanks,
 
--
Denise Draper
 
Reply all
Reply to author
Forward
0 new messages