Vape
Vape

Reputation: 130

Could not find proper message validator for message type 'json', please define a capable message validator for this message type

I've encountered an unusual problem while conducting integration tests using Citrus. During multiple runs of the same test, I'm consistently encountering an error that looks something like this:

com.consol.citrus.exceptions.TestCaseFailedException: Could not find proper message validator for message type 'json', please define a capable message validator for this message type
    at com.consol.citrus.TestCase.executeAction(TestCase.java:227)
    at com.consol.citrus.TestCase.doExecute(TestCase.java:152)
    at com.consol.citrus.actions.AbstractTestAction.execute(AbstractTestAction.java:42)
    at com.consol.citrus.Citrus.run(Citrus.java:403)
    at com.consol.citrus.testng.AbstractTestNGCitrusTest.invokeTestMethod(AbstractTestNGCitrusTest.java:131)
    at com.consol.citrus.testng.AbstractTestNGCitrusTest.run(AbstractTestNGCitrusTest.java:108)
    at com.consol.citrus.testng.AbstractTestNGCitrusTest.run(AbstractTestNGCitrusTest.java:70)
    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.testng.internal.MethodInvocationHelper.invokeHookable(MethodInvocationHelper.java:212)
    at org.testng.internal.Invoker.invokeMethod(Invoker.java:707)
    at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
    at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
    at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
    at org.testng.TestRunner.privateRun(TestRunner.java:767)
    at org.testng.TestRunner.run(TestRunner.java:617)
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:348)
    at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:343)
    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:305)
    at org.testng.SuiteRunner.run(SuiteRunner.java:254)
    at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
    at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
    at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
    at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
    at org.testng.TestNG.run(TestNG.java:1057)
    at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:115)
    at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.executeMulti(TestNGDirectoryTestSuite.java:204)
    at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:107)
    at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:112)
    at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200)
    at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153)
    at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)

This issue seems to occur intermittently and I'm uncertain about the root cause. Has anyone else experienced a similar problem with Citrus integration tests? Any insights or suggestions on how to troubleshoot or mitigate this recurring error would be greatly appreciated.

Thanks in advance!

p.s: I'm using tests in XML format,JDK 1.8 and Citrus 2.8.0.

Upvotes: 0

Views: 90

Answers (1)

Christoph Deppisch
Christoph Deppisch

Reputation: 2216

Citrus message validation is modular depending on the message data format that is being used. For instance, to enable Json message validation you need to add citrus-validation-json module as a dependency into your project.

In your case Citrus has received a Json message and tried to validate it, but the Json validation module seems to be missing in your project.

Citrus tries to auto guess the message type based on the message payload when there is no explicit message type given in the receive action validation options.

In your case the receive action resolved the message type to a Json message. I suggest you review the message content that is received in such as case in order to understand why Citrus wants to use Json message validator.

Upvotes: 0

Related Questions