Spring WebTestClient Generator
👉 ZenWave360 Helps You Create Software Easy to Understand
Generates test for SpringMVC or Spring WebFlux using WebTestClient based on OpenAPI specification.
jbang zw -p io.zenwave360.sdk.plugins.SpringWebTestClientPlugin \
specFile=src/main/resources/model/openapi.yml \
targetFolder=src/test/java \
testsPackage=io.zenwave360.example.adapters.web.tests \
openApiApiPackage=io.zenwave360.example.adapters.web \
openApiModelPackage=io.zenwave360.example.adapters.web.model \
openApiModelNameSuffix=DTO \
groupBy=service
jbang zw -p io.zenwave360.sdk.plugins.SpringWebTestClientPlugin \
specFile=src/main/resources/model/openapi.yml \
targetFolder=src/test/java \
testsPackage=io.zenwave360.example.adapters.web.tests \
openApiApiPackage=io.zenwave360.example.adapters.web \
openApiModelPackage=io.zenwave360.example.adapters.web.model \
openApiModelNameSuffix=DTO \
groupBy=businessFlow \
businessFlowTestName=CustomerCRUDTest \
operationIds=createCustomer,getCustomer,updateCustomer,deleteCustomer
Options
Option | Description | Type | Default | Values |
---|---|---|---|---|
specFile | API Specification File | URI | Â | Â |
targetFolder | Target folder to generate code to. If left empty, it will print to stdout. | File | Â | Â |
testsPackage | Package name for generated tests | String | .adapters.web.tests | Â |
groupBy | Generate test classes grouped by | GroupByType | service | service, operation, partial, businessFlow |
testSuffix | Class name suffix for generated test classes | String | IT | Â |
operationIds | OpenAPI operationIds to generate code for | List | [] | Â |
requestPayloadType | Whether to use a JSON string or instantiate a java DTO as request payload | RequestPayloadType | json | json, dto |
businessFlowTestName | Business Flow Test name | String | Â | Â |
transactional | Annotate tests as @Transactional | boolean | true | Â |
transactionalAnnotationClass | @Transactional annotation class name | String | org.springframework.transaction.annotation.Transactional | Â |
basePackage | Applications base package | String | Â | Â |
openApiApiPackage | The package to used by OpenAPI-Generator for generated api objects/classes | String | Â | Â |
openApiModelPackage | The package to used by OpenAPI-Generator for generated model objects/classes | String | Â | Â |
openApiModelNamePrefix | Sets the prefix for model enums and classes used by OpenAPI-Generator | String | Â | Â |
openApiModelNameSuffix | Sets the suffix for model enums and classes used by OpenAPI-Generator | String | Â | Â |
statusCodes | Status codes to generate code for | List | [200, 201, 202, 400] | Â |
Getting Help
jbang zw -p io.zenwave360.sdk.plugins.SpringWebTestClientPlugin --help