public class PactRunner<I extends Interaction>
JUnit Runner runs pacts against provider
To set up name of tested provider use interface Provider annotation
To point on pact's source use interface PactBroker, interface PactFolder or interface PactSource annotations
To point provider for testing use combination of interface Target interface and interface TestTarget annotation
There is out-of-the-box implementation of interface Target:
class HttpTarget that will play interaction from pacts as http request and check http responses
Runner supports:
org.junit.BeforeClass, org.junit.AfterClass and org.junit.ClassRule annotations, that will be run once - before/after whole contract test suite
org.junit.Before, org.junit.After and org.junit.Rule annotations, that will be run before/after each test of interaction WARNING: please note, that only org.junit.rules.TestRule is possible to use with this runner, i.e. org.junit.rules.MethodRule IS NOT supported
interface State - before each interaction that require state change,
all methods annotated by interface State with appropriate state listed will be invoked
| Modifier and Type | Class and Description |
|---|---|
static class |
PactRunner.Companion |
| Modifier and Type | Field and Description |
|---|---|
static PactRunner.Companion |
Companion |
| Constructor and Description |
|---|
PactRunner(java.lang.Class<?> clazz)
JUnit Runner runs pacts against provider
To set up name of tested provider use
interface Provider annotation
To point on pact's source use interface PactBroker, interface PactFolder or interface PactSource annotations |
| Modifier and Type | Method and Description |
|---|---|
org.junit.runner.Description |
describeChild(InteractionRunner child) |
java.util.List<au.com.dius.pact.model.Pact> |
filterPacts(java.util.List<? extends au.com.dius.pact.model.Pact<I>> pacts) |
java.util.List<au.com.dius.pact.provider.junit.InteractionRunner> |
getChildren() |
PactLoader |
getPactSource(org.junit.runners.model.TestClass clazz) |
InteractionRunner |
newInteractionRunner(org.junit.runners.model.TestClass testClass,
au.com.dius.pact.model.Pact<I> pact,
au.com.dius.pact.model.PactSource pactSource) |
void |
runChild(InteractionRunner interaction,
org.junit.runner.notification.RunNotifier notifier) |
void |
setupInteractionRunners(org.junit.runners.model.TestClass testClass,
java.util.List<? extends au.com.dius.pact.model.Pact<I>> pacts,
PactLoader pactLoader) |
public static PactRunner.Companion Companion
public PactRunner(java.lang.Class<?> clazz)
JUnit Runner runs pacts against provider
To set up name of tested provider use interface Provider annotation
To point on pact's source use interface PactBroker, interface PactFolder or interface PactSource annotations
To point provider for testing use combination of interface Target interface and interface TestTarget annotation
There is out-of-the-box implementation of interface Target:
class HttpTarget that will play interaction from pacts as http request and check http responses
Runner supports:
org.junit.BeforeClass, org.junit.AfterClass and org.junit.ClassRule annotations, that will be run once - before/after whole contract test suite
org.junit.Before, org.junit.After and org.junit.Rule annotations, that will be run before/after each test of interaction WARNING: please note, that only org.junit.rules.TestRule is possible to use with this runner, i.e. org.junit.rules.MethodRule IS NOT supported
interface State - before each interaction that require state change,
all methods annotated by interface State with appropriate state listed will be invoked
public void setupInteractionRunners(org.junit.runners.model.TestClass testClass,
java.util.List<? extends au.com.dius.pact.model.Pact<I>> pacts,
PactLoader pactLoader)
public InteractionRunner newInteractionRunner(org.junit.runners.model.TestClass testClass, au.com.dius.pact.model.Pact<I> pact, au.com.dius.pact.model.PactSource pactSource)
public java.util.List<au.com.dius.pact.model.Pact> filterPacts(java.util.List<? extends au.com.dius.pact.model.Pact<I>> pacts)
public java.util.List<au.com.dius.pact.provider.junit.InteractionRunner> getChildren()
public org.junit.runner.Description describeChild(InteractionRunner child)
public void runChild(InteractionRunner interaction, org.junit.runner.notification.RunNotifier notifier)
public PactLoader getPactSource(org.junit.runners.model.TestClass clazz)