0

I am using pact-jvm provider spring. I have two different pact(.json) files lets say (order.json and irs.json), i need to run them in sequentially (order followed by irs), but based on alphabetical order the test classes are picked, the irs run first and order runs second. Is there way to call execute the particular test class provider states or define the test class execution order?

krishnakumar
  • 173
  • 3
  • 15

1 Answers1

2

Pact is not a tool for end-to-end testing, in fact, one of Pact's stated objectives is to reduce or in some cases, completely remove the need for E2E testing.

Instead of doing end-to-end testing, we use contract tests to avoid the need to do that. Doing this has a lot of benefits, including the ability to test and release things separately, avoiding the need for managing test environments and data, and reducing coupling/ordering in tests themselves. Furthermore, it should be able to run on your laptop or on a CI build - you don't need to test against a running provider deployed to a real environment.

If you have to run a set of these tests in a particular sequence, you're doing it wrong

Here are some links to help you understand what I mean a bit better:

https://docs.pact.io/consumer/contract_tests_not_functional_tests https://docs.pact.io/faq/#do-i-still-need-end-to-end-tests https://docs.pact.io/getting_started/what_is_pact_good_for

I would also recommend completing one of our workshops, probably https://github.com/DiUS/pact-workshop-jvm.

It takes about 1 hour, but is well worth your time as all of the core concepts are clearly explained.

Matthew Fellows
  • 3,669
  • 1
  • 15
  • 18
  • Thanks for the comments. I am not trying here to test the complete business logic or perform functional testing. I am trying to do orchestration taking an simple API calls (one success case, one failure case) each of the service. In that i want to run this in order to show this logical flow of the system. – krishnakumar Jun 11 '20 at 06:19
  • No worries. That's still not what Pact is designed for - it's designed for capturing API communications at an individual interaction level - not sequences etc.. Why do you need to show the logical flow of the system? – Matthew Fellows Jun 12 '20 at 02:59