RegistrationCore mdule tests fail even in a fresh copy

I’ve checked out the RegistrationCore module 1.7.1 ( RegistrationCore-1.7.1 ), But the module fails tests while building. It’s a fresh copy and i haven’t made any changes. But this only happens in my machine. When i try to build the same in another machine it works fine.

Here’s the error i’m getting…



 T E S T S
-------------------------------------------------------
Running org.openmrs.module.registrationcore.api.search.BasicExactPatientSearchAlgorithmTest
Tests run: 10, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 8.386 sec <<< FAILURE!
shouldMatchOnExactMatch(org.openmrs.module.registrationcore.api.search.BasicExactPatientSearchAlgorithmTest)  Time elapsed: 0.218 sec  <<< FAILURE!
java.lang.AssertionError: 
Expected: is <1>
     but: was <2>
        at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)
        at org.junit.Assert.assertThat(Assert.java:865)
        at org.junit.Assert.assertThat(Assert.java:832)
        at org.openmrs.module.registrationcore.api.search.BasicExactPatientSearchAlgorithmTest.shouldMatchOnExactMatch(BasicExactPatientSearchAlgorithmTest.java:52)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
        at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
        at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
        at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
        at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
        at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74)
        at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
        at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:82)
        at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72)
        at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:240)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
        at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
        at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
        at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
        at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:180)
        at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
        at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
        at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
        at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
        at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
        at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
        at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)

Running org.openmrs.module.registrationcore.api.search.ExistingPatientNameSearchTest
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.308 sec
Running org.openmrs.module.registrationcore.api.search.BasicSimilarPatientSearchAlgorithmTest
Tests run: 6, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.021 sec
Running org.openmrs.module.registrationcore.api.search.BasicPatientNameSearchTest
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.27 sec
Running org.openmrs.module.registrationcore.api.mpi.openempi.OpenEmpiPatientFetcherTest
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.558 sec
Running org.openmrs.module.registrationcore.api.mpi.openempi.OpenEmpiPatientExporterTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.046 sec
Running org.openmrs.module.registrationcore.api.mpi.openempi.OpenEmpiAuthenticatorTest
Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.061 sec
Running org.openmrs.module.registrationcore.api.mpi.openempi.OpenEmpiPatientFilterTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.045 sec
Running org.openmrs.module.registrationcore.api.mpi.openempi.PatientBuilderTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.022 sec
Running org.openmrs.module.registrationcore.api.mpi.openempi.RestQueryExecutorTest
Tests run: 7, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.297 sec
Running org.openmrs.module.registrationcore.api.mpi.openempi.FindPatientQueryBuilderTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.007 sec
Running org.openmrs.module.registrationcore.api.mpi.openempi.OpenEmpiPatientSearchAlgorithmTest
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.069 sec
Running org.openmrs.module.registrationcore.api.mpi.openempi.OpenEmpiConnectorTest
Tests run: 7, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.101 sec
Running org.openmrs.module.registrationcore.api.mpi.openempi.OpenEmpiPatientUpdaterTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.016 sec
Running org.openmrs.module.registrationcore.api.mpi.openempi.OpenEmpiPatientResultBuilderTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.005 sec
Running org.openmrs.module.registrationcore.api.mpi.openempi.PatientIdentifierMapperTest
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.007 sec
Running org.openmrs.module.registrationcore.api.impl.PatientEditListenerTest
Tests run: 2, Failures: 0, Errors: 0, Skipped: 2, Time elapsed: 0.002 sec
Running org.openmrs.module.registrationcore.api.impl.PatientCreationListenerTest
Tests run: 4, Failures: 0, Errors: 0, Skipped: 2, Time elapsed: 0.064 sec
Running org.openmrs.module.registrationcore.api.impl.IdentifierBuilderTest
Tests run: 7, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.178 sec
Running org.openmrs.module.registrationcore.api.RegistrationCoreServiceTest
ERROR - ActiveMQMessageConsumer.dispatch(1233) |2017-08-10 17:05:41,121| ID:nipun-ThinkPad-X1-Carbon-5th-33395-1502364935256-2:1:1:1 Exception while processing message: ID:nipun-ThinkPad-X1-Carbon-5th-33395-1502364935256-2:1:3:1:1
org.openmrs.api.context.ContextAuthenticationException: Invalid token null
        at org.openmrs.api.context.Daemon.runInDaemonThread(Daemon.java:245)
        at org.openmrs.module.registrationcore.api.impl.PatientActionListener.onMessage(PatientActionListener.java:40)
        at org.openmrs.event.EventEngine$3.onMessage(EventEngine.java:222)
        at org.apache.activemq.ActiveMQMessageConsumer.dispatch(ActiveMQMessageConsumer.java:1229)
        at org.apache.activemq.ActiveMQSessionExecutor.dispatch(ActiveMQSessionExecutor.java:134)
        at org.apache.activemq.ActiveMQSessionExecutor.iterate(ActiveMQSessionExecutor.java:205)
        at org.apache.activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.java:122)
        at org.apache.activemq.thread.PooledTaskRunner$1.run(PooledTaskRunner.java:43)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
ERROR - ActiveMQMessageConsumer.dispatch(1233) |2017-08-10 17:05:42,130| ID:nipun-ThinkPad-X1-Carbon-5th-33395-1502364935256-2:1:1:1 Exception while processing message: ID:nipun-ThinkPad-X1-Carbon-5th-33395-1502364935256-2:1:3:1:1
org.openmrs.api.context.ContextAuthenticationException: Invalid token null
        at org.openmrs.api.context.Daemon.runInDaemonThread(Daemon.java:245)
        at org.openmrs.module.registrationcore.api.impl.PatientActionListener.onMessage(PatientActionListener.java:40)
        at org.openmrs.event.EventEngine$3.onMessage(EventEngine.java:222)
        at org.apache.activemq.ActiveMQMessageConsumer.dispatch(ActiveMQMessageConsumer.java:1229)
        at org.apache.activemq.ActiveMQMessageConsumer.iterate(ActiveMQMessageConsumer.java:1362)
        at org.apache.activemq.ActiveMQSessionExecutor.iterate(ActiveMQSessionExecutor.java:194)
        at org.apache.activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.java:122)
        at org.apache.activemq.thread.PooledTaskRunner$1.run(PooledTaskRunner.java:43)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
Tests run: 6, Failures: 0, Errors: 0, Skipped: 1, Time elapsed: 1.429 sec
Running org.openmrs.module.registrationcore.RegistrationCoreUtilTest
Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.056 sec

Results :

Failed tests:   shouldMatchOnExactMatch(org.openmrs.module.registrationcore.api.search.BasicExactPatientSearchAlgorithmTest): (..)

Tests run: 76, Failures: 1, Errors: 0, Skipped: 5

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] Registration Core Module ........................... SUCCESS [  0.181 s]
[INFO] Registration Core Module API ....................... FAILURE [ 16.163 s]
[INFO] Registration Core Module OMOD ...................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 16.648 s
[INFO] Finished at: 2017-08-10T17:05:43+05:30
[INFO] Final Memory: 29M/304M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test (default-test) on project registrationcore-api: There are test failures.
[ERROR] 
[ERROR] Please refer to /media/repos/gsoc/regCoreTests/openmrs-module-registrationcore/api/target/surefire-reports for the individual test results.
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <goals> -rf :registrationcore-api

Do you get the same behavior when you use the master branch of the module?

Hi Daniel, Nipun, @mogoodrich and @jiahaochua

Bumping this because I am also receiving the same error. None of the tests fail but I am getting this error:

ERROR - ActiveMQMessageConsumer.dispatch(1233) |2018-07-03 22:26:44,618| ID:shaos-mbp.pih.org-64702-1530671187660-2:1:1:1 Exception while processing message: ID:shaos-mbp.pih.org-64702-1530671187660-2:1:5:1:1 org.openmrs.api.context.ContextAuthenticationException: Invalid token null at org.openmrs.api.context.Daemon.runInDaemonThread(Daemon.java:262) at org.openmrs.module.registrationcore.api.impl.PatientActionListener.onMessage(PatientActionListener.java:40) at org.openmrs.event.EventEngine$3.onMessage(EventEngine.java:222) at org.apache.activemq.ActiveMQMessageConsumer.dispatch(ActiveMQMessageConsumer.java:1229) at org.apache.activemq.ActiveMQSessionExecutor.dispatch(ActiveMQSessionExecutor.java:134) at org.apache.activemq.ActiveMQSessionExecutor.iterate(ActiveMQSessionExecutor.java:205) at org.apache.activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.java:122) at org.apache.activemq.thread.PooledTaskRunner$1.run(PooledTaskRunner.java:43) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748)

I pulled from master and did not change anything, the full console output is here: master registrationcore tests errors - Pastebin.com

I came across this because I’m working on integrating the MPI functionality back into the main branch and working on tests. I want to write tests that involve the BaseModuleContextSensitiveTest but still trying to figure out how to do that.

I think it might have something to do with not being able to set up the context properly? when I try to run org.openmrs.module.registrationcore.api.RegistrationCoreSensitiveTestBase I get the following error:

java.lang.Exception: No runnable methods

at org.junit.runners.BlockJUnit4ClassRunner.validateInstanceMethods(BlockJUnit4ClassRunner.java:169) at org.junit.runners.BlockJUnit4ClassRunner.collectInitializationErrors(BlockJUnit4ClassRunner.java:104) at org.junit.runners.ParentRunner.validate(ParentRunner.java:355) at org.junit.runners.ParentRunner.(ParentRunner.java:76) at org.junit.runners.BlockJUnit4ClassRunner.(BlockJUnit4ClassRunner.java:57) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.(SpringJUnit4ClassRunner.java:104) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:29) at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:21) at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59) at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26) at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59) at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:26) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:49) at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)

Process finished with exit code 255

which makes sense because the class actually is completely blank and doesn’t have any runnable methods?

Note that I am getting the same error on master registrationapp, full console output here: master registrationapp tests errors - Pastebin.com

Thanks for your advice

  • Shao Yuan

Just to make sure i understand. All tests are passing, but you just want a clean log without errors?

Yes, when I run mvn clean install all the tests pass, but, when I run it from IntelliJ, one fails which is that RegistrationCoreSensitiveTestBase has no runnable methods.

@shaoyuan

This all seems fine… you can ignore the errors in the logs, as long as the tests pass.

And you are correct, “RegistrationContextSensitiveTestBase” is not a test itself but a base for other tests. Maven is smart enough to realize it isn’t a test (because it doesn’t end in Test) and skips it, but IntelliJ doesn’t for some reason… if you can figure out how to make IntelliJ skip it, that would be the ideal behavior…

Take care, Mark

@shaoyuan does it help if you just put @Ignore on the base class?

1 Like

Thanks @mogoodrich and @dkayiwa, yeah okay, I won’t bother about it, and yes, if I put @Ignore on the base class it skips it.