question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

pact-jvm-provider-junit messaging tests fail when run via maven

See original GitHub issue

See this repo for an example: https://github.com/Fitzoh/pact-jvm-maven-test-issue

If you clone the project and run ProviderMessageTestthrough intellij, it will pass.

However, it run run the tests via maven (mvn test) it fails with the following message:


Verifying a pact between consumer and provider
  a test message
      Verification Failed - No annotated methods were found for interaction 'a test message'

Failures:

0) a test message
      No annotated methods were found for interaction 'a test message'

Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.946 sec <<< FAILURE!
consumer - a test message(com.example.ProviderMessageTest)  Time elapsed: 0.327 sec  <<< FAILURE!
java.lang.AssertionError: 
0 - No annotated methods were found for interaction 'a test message'
        at au.com.dius.pact.provider.junit.target.BaseTarget.getAssertionError(BaseTarget.java:84)
        at au.com.dius.pact.provider.junit.target.AmqpTarget.testInteraction(AmqpTarget.java:51)
        at au.com.dius.pact.provider.junit.InteractionRunner$2.evaluate(InteractionRunner.java:181)
        at au.com.dius.pact.provider.junit.InteractionRunner.run(InteractionRunner.java:141)
        at au.com.dius.pact.provider.junit.PactRunner.runChild(PactRunner.java:101)
        at au.com.dius.pact.provider.junit.PactRunner.runChild(PactRunner.java:51)

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:4
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

6reactions
Semirhagecommented, Jul 20, 2017

I was able to run the test with the failsafe maven plugin, by adding the following config to the plugin:

 <configuration>
      <useManifestOnlyJar>false</useManifestOnlyJar>                                 
</configuration>

The test failed when being run with the failsafe (or surefire) maven plugins, because the SystemClassLoader returned only the failsafe/surefire booter.jar, when the classpath urls were being retrieved from it (check code in AmqpTarget.java ).

With the configuration in place, the full classpath is being listed through the SystemClassLoader, and therefore the @PactVerifyProvider annotations are correctly identified.

For more plugin configuration details, check Failsafe Class Loading

0reactions
RaghuJcommented, May 8, 2017

@uglyog Thanks 😃 I was able to run it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

pact-jvm-provider-junit messaging tests fail when run via maven
If you clone the project and run ProviderMessageTest through intellij, it will pass. However, it run run the tests via maven ( mvn...
Read more >
Maven Surefire Plugin – Rerun failing tests
To use this feature through Maven surefire, set the rerunFailingTestsCount property to be a value larger than 0. Tests will be run until...
Read more >
Tests fail when executed from maven but not from Intellij
But when I run the tests from maven (either from Intellij or from the command line) they fail. This is my config:
Read more >
Why Your JUnit 5 Tests Are Not Running Under Maven
There is a very common issue preventing your JUnit 5 tests from running under Maven. In this post, I explain why and provide...
Read more >
4.12. Executing Unit Tests - TheNEXUS | A Community Project
Executing mvn test from the command line caused Maven to execute all ... for details like stack traces and error messages generated by...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found