From c25e375241fef66718b3de9d0c6c904913e4b3db Mon Sep 17 00:00:00 2001 From: Marcin Grzejszczak Date: Fri, 3 Mar 2017 17:17:22 +0100 Subject: [PATCH] Elaborated more on base class config in step by step part fixes #239 --- README.adoc | 14 ++++++++++++-- docs/src/main/asciidoc/verifier/introduction.adoc | 14 ++++++++++++-- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/README.adoc b/README.adoc index 9c714b28e1..3887d8255b 100644 --- a/README.adoc +++ b/README.adoc @@ -654,6 +654,9 @@ git clone https://your-git-server.com/server-side.git local-http-server-repo As consumers we need to define what exactly we want to achieve. We need to formulate our expectations. That's why we write the following contract. +IMPORTANT: We're placing the contract under `src/test/resources/contract/fraud` folder. The `fraud` folder +is important cause we'll reference that folder in the producer's test base class name. + [source,groovy,indent=0] ---- package contracts @@ -926,7 +929,7 @@ You have to add the dependencies needed by the autogenerated tests ---- -In the configuration of the Maven plugin we passed the `baseClassForTests` property +In the configuration of the Maven plugin we passed the `packageWithBaseClasses` property [source,xml,indent=0] ---- @@ -941,7 +944,14 @@ In the configuration of the Maven plugin we passed the `baseClassForTests` prope ---- -That's because all the generated tests will extend that class. Over there you can set up your Spring Context or whatever is necessary. In our case we're using http://rest-assured.io/[Rest Assured MVC] to start the server side `FraudDetectionController`. +IMPORTANT: We've decided to use the "convention based" naming by setting the `packageWithBaseClasses` property. +That means that 2 last packages will be combined into a name of the base test class. In our case the contracts +were placed under `src/test/resources/contract/fraud`. Since we don't have 2 packages starting from the `contracts` +folder we're picking only one which is `fraud`. We're adding the `Base` suffix and we're capitalizing `fraud`. +That gives us the `FraudBase` test class name. + +That's because all the generated tests will extend that class. Over there you can set up your Spring Context or +whatever is necessary. In our case we're using http://rest-assured.io/[Rest Assured MVC] to start the server side `FraudDetectionController`. [source,java,indent=0] ---- diff --git a/docs/src/main/asciidoc/verifier/introduction.adoc b/docs/src/main/asciidoc/verifier/introduction.adoc index 51ec9a0104..e93dc0e438 100644 --- a/docs/src/main/asciidoc/verifier/introduction.adoc +++ b/docs/src/main/asciidoc/verifier/introduction.adoc @@ -184,6 +184,9 @@ git clone https://your-git-server.com/server-side.git local-http-server-repo As consumers we need to define what exactly we want to achieve. We need to formulate our expectations. That's why we write the following contract. +IMPORTANT: We're placing the contract under `src/test/resources/contract/fraud` folder. The `fraud` folder +is important cause we'll reference that folder in the producer's test base class name. + [source,groovy,indent=0] ---- include::{introduction_url}/samples/standalone/dsl/http-server/src/test/resources/contracts/fraud/shouldMarkClientAsFraud.groovy[] @@ -346,14 +349,21 @@ You have to add the dependencies needed by the autogenerated tests include::{introduction_url}/samples/standalone/dsl/http-server/pom.xml[tags=verifier_test_dependencies,indent=0] ---- -In the configuration of the Maven plugin we passed the `baseClassForTests` property +In the configuration of the Maven plugin we passed the `packageWithBaseClasses` property [source,xml,indent=0] ---- include::{introduction_url}/samples/standalone/dsl/http-server/pom.xml[tags=contract_maven_plugin,indent=0] ---- -That's because all the generated tests will extend that class. Over there you can set up your Spring Context or whatever is necessary. In our case we're using http://rest-assured.io/[Rest Assured MVC] to start the server side `FraudDetectionController`. +IMPORTANT: We've decided to use the "convention based" naming by setting the `packageWithBaseClasses` property. +That means that 2 last packages will be combined into a name of the base test class. In our case the contracts +were placed under `src/test/resources/contract/fraud`. Since we don't have 2 packages starting from the `contracts` +folder we're picking only one which is `fraud`. We're adding the `Base` suffix and we're capitalizing `fraud`. +That gives us the `FraudBase` test class name. + +That's because all the generated tests will extend that class. Over there you can set up your Spring Context or +whatever is necessary. In our case we're using http://rest-assured.io/[Rest Assured MVC] to start the server side `FraudDetectionController`. [source,java,indent=0] ----