-
Use this template (complete documentation)
-
Git clone your new GitHub repository (complete documentation)
-
Execute scenarios :
-
./mvnw clean verify
-
./gradlew clean test
Or, if you are a Windows user:
-
mvnw.bat clean verify
-
gradlew.bat clean test
-
For the next section, we recommend that you open the project with a Java IDE such as IntelliJ.
A sample scenarios, in there you will find 4 scenarios :
-
One call a search engine and another one call a chutney website
-
They both show how to reference a target, decoupled from any environment (see next section)
If you look closely, there is no reference togoogle.fr
orgoogle.com
nor any other URLs.
Instead, there is a reference to an abstract target:search_engine
orchutney
.
This reference allows the same scenario to run on different environments without being couple to technical details such as URLs, authentication etc. -
The first scenario also shows how to do an assertion from a "business" point of view, using a separate step
-
The second scenario shows how to do an assertion from a "technical" point of view, using an inner step validation
-
-
One scenario call an non existing website
-
It is called in LauncherTest to show how to expect a step failure using the Launcher
-
-
The last scenario shows how to pass parameters
-
It is called in ChutneyJunitEngineTest
-
-
Open the Environments.kt file.
-
Look at the
en_search_engine
andfr_search_engine
values. The later is a copy, so they share the same name:"search_engine"
but have different URL.
Then, they are set in different environment, respectivelyenglish_web
andfrench_web
. -
With the same scenario, you can execute the http get action on target
search_engine
on two different environments
HttpGetAction(
target = "search_engine",
uri = "/",
validations = mapOf("request accepted" to "status == 200".spEL()),
outputs = mapOf("resultJson" to "body".spEL())
)
-
Open the ChutneyJunitEngineTest.kt file
-
Replace
english_web
byfrench_web
and run the test
The same scenario without a single modification was run on a different environment.
💡
|
Usually, an environment represents the different stages used to qualify a software, such as local, dev, staging or pre-production. |
-
Now, if we want our scenario to run on each environment, we can take advantage of
@ParameterizedTest
supplied by JUnit Jupiter -
Look at example in LauncherTest.kt
Until then, we worked with the embedded version of Chutney which does not need a server. This fits well within a CI or for a developer local setup.
However, building software is most often a teamwork !
Doing so, you will need to collaborate and share scenarios, track their executions and allow functional and business analyst to review and be involved in testing their product.
To allow that, Chutney provides a server version, composed of the execution engine and a UI.
-
Start Chutney locally by running
docker compose up&
(Docker compose documentation). -
Access the UI at the address: https://localhost
-
Login using the default credentials admin / admin
-
Create your first scenario in the UI by clicking on the pen icon in the upper right
-
Save it as is, by clicking on the save button
-
Run it by clicking on the run button and choosing the environment on which to run the scenario against
💡
|
The dockerized Chutney already knows the aforementioned environments, as the folder |
-
Open the SynchronizeToServer.kt file
-
Execute the
main
function to synchronize any change made locally to the running server
💡
|
To synchronize a scenario, the test code has to share an id with the server in order to know what scenario to update. The id is provided in the constructor of Scenario: |