Basic REST Assured Example
Below is a simple workflow for executing REST Assured tests in a Gradle project stored on GitHub. You can paste this directly into the
YAML of an existing or new test, just make sure to update the name
and namespace
for your environment as needed.
- The
spec.content
property defines the path to the Gradle project on GitHub. - The
spec.container
property defines default constraints for any container created in this workflow. - The
spec.steps
property defines a single step that runs thegradle --no-daemon
test command. - The
spec.steps[0].artifacts
property defines from where to upload junit and html reports.
Basic RestAssured Workflow
kind: TestWorkflow
apiVersion: testworkflows.testkube.io/v1
metadata:
name: rest-assured-sample
spec:
content:
git:
uri: https://github.com/kubeshop/testkube-examples
revision: main
paths:
- Gradle/RestAssured
container:
workingDir: /data/repo/Gradle/RestAssured
resources:
requests:
cpu: 512m
memory: 512Mi
steps:
- name: Run tests
run:
image: gradle:8.5.0-jdk11
command:
- gradle
- --no-daemon
- test
artifacts:
paths:
- app/build/reports/**/*
- app/build/test-results/**/*
After execution, you can see the output from the test executions under the executions panel tabs:
- Log Output
- JUnit Report
- Artifacts
- HTML Report
The log output from the REST Assured execution:
The uploaded report is available in the Artifacts tab:
The uploaded report is available in the Artifacts tab:
Clicking the HTML report opens it in your browser:
tip
Read more about running REST Assured Tests with Testkube at https://testkube.io/learn/api-testing-using-restassured-and-testkube