This module karatetools-oss-karate-test is a karate module to test the karate tools.
-
This module has been generated using the ⚙️ Karate Tools - Archetype
-
Includes auto-generated tests and mocks for sample api (
karatetools-oss-openapi-test) -
uses the
karatetools-oss-starterto test the karate clients and the sample application (karatetools-oss-boot) and containers.
| Any changes made in the Karate Tools codebase must be reflected in the corresponding karate tests in this module. |
The structure of the module is as follows:
-
src/test/java: Java Code
e2e/karate/ ├── .gitignore ├── pom.xml └── src └── test ├── java │ └── com │ └── inditextech │ └── karate │ └── karatetools │ ├── jms │ │ └── JMSKarateObject.java (1) │ └── test │ └── KarateRunnerTest.java (2)1 JMS Object for testing purposes 2 Java Test Runner -
src/test/resources: Base and Config files
e2e/karate/ ├── .gitignore ├── pom.xml └── src └── test └── resources ├── config (1) │ ├── db │ │ ├── mariadb-config-local.yml │ │ ├── mongodb-config-local.yml │ │ └── postgresql-config-local.yml │ ├── jms │ │ └── activemq-config-local.yml │ └── kafka │ ├── avro │ │ └── karate.avsc │ └── kafka-config-local.yml ├── config-local.yml (2) ├── config.yml (2) ├── jwt (3) │ ├── default-jwt.yml │ └── invalid-jwt.yml ├── karate-config.js (4) ├── logback-test-debug.xml (5) ├── logback-test.xml (5) └── mocks (6) └── templates └── standalone └── .gitkeep1 Karate clients config files (db, jms, kafka) 2 Configuration Files (general and environment specific) 3 Karate Authentication JWT Files (default and test specific) 4 Karate-config files 5 logback configuration files 6 karate mocks folder -
src/test/resources/dev/inditex/karate: Tests related to Karate Tools features
e2e/karate/ ├── .gitignore ├── pom.xml └── src └── test └── resources ├── com │ └── inditextech │ └── karate │ ├── auth (1) │ │ ├── KarateAuthBackgroundScenario.feature │ │ ├── KarateAuthBasic.feature │ │ └── KarateAuthJWT.feature │ ├── base (2) │ │ └── KarateBase.feature │ ├── clients (3) │ │ ├── db (4) │ │ │ ├── JDBCClient-MariaDB.feature │ │ │ ├── JDBCClient-MariaDB.sql │ │ │ ├── JDBCClient-PostgreSQL.feature │ │ │ └── JDBCClient-PostgreSQL.sql │ │ ├── jms (5) │ │ │ └── JMSClient-ActiveMQ.feature │ │ ├── kafka (6) │ │ │ └── KafkaClients.feature │ │ └── mongodb (7) │ │ └── MongoDBClient.feature1 Authentication tests 2 Karate Base tests 3 Karate Clients tests 4 Karate Clients tests: db 5 Karate Clients tests: jms 6 Karate Clients tests: kafka 7 Karate Clients tests: mongodb -
src/test/resources/apis/dev/inditex/karate/karatetools-openapi-test/xxx-api-rest-stable: Root folder for the operation(s) feature files and validation schemas for the test api xxx-api-rest-stable
e2e/karate/ ├── .gitignore ├── pom.xml └── src └── test └── resources ├── apis │ └── com │ └── inditextech │ └── karate │ └── karatetools-openapi-test │ └── xxx-api-rest-stable (1) │ └── BasicApi (2) │ ├── createItems (3) │ │ ├── createItems.feature (4) │ │ └── schema (5) │ │ ├── createItems_201.schema.yml │ │ ├── createItems_400.schema.yml │ │ ├── createItems_401.schema.yml │ │ └── createItems_default.schema.yml │ ├── listItems (3) │ │ ├── listItems.feature (4) │ │ └── schema (5) │ │ ├── Items_200.schema.yml │ │ ├── listItems_200.schema.yml │ │ ├── listItems_400.schema.yml │ │ ├── listItems_401.schema.yml │ │ └── listItems_default.schema.yml │ └── showItemById (3) │ ├── schema (5) │ │ ├── showItemById_200.schema.yml │ │ ├── showItemById_401.schema.yml │ │ ├── showItemById_404.schema.yml │ │ └── showItemById_default.schema.yml │ └── showItemById.feature (4)1 root folder for the operations 2 api tag folder 3 operation folder 4 operation feature file 5 operation validation schemas -
src/test/resources/dev/inditex/karate/karatetools-openapi-test/xxx-api-rest-stable: REST Api tests
e2e/karate/ ├── .gitignore ├── pom.xml └── src └── test └── resources ├── com │ └── inditextech │ └── karate │ └── karatetools-openapi-test │ └── xxx-api-rest-stable (1) │ ├── functional (2) │ │ └── e2e (3) │ │ ├── e2e.feature (4) │ │ └── test-data (5) │ │ ├── createItems_201.yml │ │ ├── createItems_400.yml │ │ ├── createItems_401.yml │ │ ├── listItems_200.yml │ │ ├── listItems_400.yml │ │ ├── listItems_401.yml │ │ ├── showItemById_200.yml │ │ ├── showItemById_401.yml │ │ └── showItemById_404.yml │ └── smoke (6) │ └── BasicApi (7) │ ├── createItems (8) │ │ ├── createItems.feature (4) │ │ └── test-data (5) │ │ ├── createItems_201.yml │ │ ├── createItems_400.yml │ │ └── createItems_401.yml │ ├── listItems (8) │ │ ├── listItems.feature (4) │ │ └── test-data (5) │ │ ├── listItems_200.yml │ │ ├── listItems_400.yml │ │ └── listItems_401.yml │ └── showItemById (8) │ ├── showItemById.feature (4) │ └── test-data (5) │ ├── showItemById_200.yml │ ├── showItemById_401.yml │ └── showItemById_404.yml1 root folder for the rest api test 2 root folder for the functional rest api tests 3 specific functional test folder 4 feature file 5 test data files 6 root folder for the smoke rest api tests 7 api tag folder 8 smoke tests operation folder
The tests to be executed are:
-
Karate Tests:
-
Karate tests are used to test the karate tools in the context of a Karate project.
-
These tests are executed against the test application Rest Api and the
docker containersprovided by thekaratetools-oss-bootmodule.
-
| Karate tests are required as status checks in the CI/CD pipeline pull request approval process. The level of coverage for the karate tests must reach at least the defined threshold. |
| test | command | report | verification |
|---|---|---|---|
Build app |
|
NA |
no errors |
Start app |
|
NA |
no errors |
karate |
|
|
all tests pass |
| test | command | report | verification |
|---|---|---|---|
karate |
|
workflow execution reports |
automatically on workflow execution |
| step | commands | expected output |
|---|---|---|
Build app |
|
build without errors |
Download JaCoCo agent and client |
|
JaCoCo agent and client downloaded |
Start app with JaCoCo agent |
|
App started with JaCoCo agent |
Wait for app to start |
|
Status code 200 |
Check docker containers are up |
|
All docker containers are up in |
Execute Karate tests |
|
all tests pass |
Check karate report |
|
all tests pass |
Stop app |
|
App stopped |
Generate JaCoCo report |
|
JaCoCo report generated |
Check JaCoCo report |
|
code coverage generated by karate tests is at least 80% |