Sample project to get started with implementing and running karate tests, in a structured fashion.
Results are published in junit, html and cucumber-reporting format
./gradlew test
Example
TARGET_ENVIRONMENT=prod TYPE=workflow ./gradlew test
-
Build an uber jar:
./gradlew shadowJar
-
The above command will create a jar in the upload folder with the name like:
upload/getting-started-with-karate-0.0.1.jar
-
Gradle command:
-
You can run the test using a gradle command:
Example
TARGET_ENVIRONMENT=prod TYPE=workflow ./gradlew test
-
-
Uber jar:
-
You can run the tests using the same format as the
./gradlew test
command:Example
PARALLEL=3 TARGET_ENVIRONMENT=prod TAG=demo TYPE=api java -jar getting-started-with-karate-0.0.1.jar
-
-
Shell Script:
-
You can also run the tests using a script file using this command:
Example
PARALLEL=3 TARGET_ENVIRONMENT=prod TAG=demo TYPE=api ./runAPIWorkflowTests.sh
-
TARGET_ENVIRONMENT=...
-> Run tests for specific environment. Data will be picked up accordingly from test_data.jsonTYPE=[api | workflow]
-> What type of test you want to run?TAG=...
-> What subset of tests you want to run? Ex:TAG=confengine
will run all tests having the tag confengine-
To run test with multiple tags specified, you can use a command like:
TAG=@demo,~@sanity TARGET_ENVIRONMENT=prod TYPE=workflow ./gradlew test
-
To run tests having tags as @tags OR @sample:
TYPE=api TARGET_ENVIRONMENT=prod TAG=@tags,@sample ./gradlew test
-
To run tests having tags as @tags OR @sample AND exclude tags @demo2
TYPE=api TARGET_ENVIRONMENT=prod TAG=@tags,@sample:~@demo2 ./gradlew test
-
To run tests having tags as @tags OR @sample AND exclude tests having either of the following tags: @demo2, @e2e
TYPE=api TARGET_ENVIRONMENT=prod TAG=@tags,@sample:~@demo2:~@e2e ./gradlew test
-
PARALLEL=...
-> What is the parallel count for the test execution. Default isPARALLEL=5
-
Read the Guidelines for writing tests in this framework
- Install JDK 11 or higher
- Install IntelliJ Idea Community Edition
- Install the following plugins
- .ignore
- Cucumber for Java
- Gherkin
- SonarLint
- Gradle
- Maven
- Groovy
- Markdown
- Properties
- Shell Script
- YAML
- JUnit
- TestNG
- Git
- GitHub
- Terminal
Contact @BagmarAnand for help / information / feedback on this repo