This sample demonstrates how to use TestNG data providers in Citrus tests. You can also read about this in reference guide.
The todo-list sample application provides a REST API for managing todo entries. Citrus is able to call the API methods as a client in order to add new todo entries. In this sample we make use of the TestNG data provider feature in terms of adding multiple todo entries within on single test.
The data provider is defined in the test case.
The provider gives us two parameters todoName and todoDescription. The parameters can be bound to test variables in the Citrus test with some annotation magic.
As you can see we are able to use the name and description values provided by the data provider. When executed the test performs multiple times with respective values:
CITRUS TEST RESULTS TodoListIT.testPost([todo1, Description: todo1]) ............... SUCCESS TodoListIT.testPost([todo2, Description: todo2]) ............... SUCCESS TodoListIT.testPost([todo3, Description: todo3]) ............... SUCCESS
You can run the sample on your localhost in order to see Citrus in action. Read the instructions how to run the sample.