- DarkLight
Extracted Value Assertion for API Tests
- DarkLight
In this Test Modeller feature video, you will learn how to form an assertion on extracted JSON values for API tests.
Additionally, check out our QuickStart API Automation guide!
To get started with this demo, we have a module with an API Request set-up. Open up your own module with an API Request, to do this, navigate to the Explorer in Test Modeller, Open a Module and then hit the Blue Action button.
![](http://cdn.document360.io/77f722a6-2d0a-49fa-8074-572515a6c4b8/Images/Documentation/image-1680272397946.png)
![](http://cdn.document360.io/77f722a6-2d0a-49fa-8074-572515a6c4b8/Images/Documentation/image-1680272403078.png)
This will open the Edit Function menu for your module, from here open the API Request tab and then navigate to Assertions.
![](http://cdn.document360.io/77f722a6-2d0a-49fa-8074-572515a6c4b8/Images/Documentation/image-1680272408677.png)
In the Assertions tab, you can add new Assertions by hitting the Add button. Here, you will be able to add two new types of Assertions, as shown in the demo you can add JSON Path and Custom Code assertions.
![](http://cdn.document360.io/77f722a6-2d0a-49fa-8074-572515a6c4b8/Images/Documentation/image-1680272414847.png)
![](http://cdn.document360.io/77f722a6-2d0a-49fa-8074-572515a6c4b8/Images/Documentation/image-1680272422047.png)
This will propagate in the module, and you can view the results by hitting the Generate button. This will show you the generated code, including the JSON path and Custom code assertions we just set up.
![](http://cdn.document360.io/77f722a6-2d0a-49fa-8074-572515a6c4b8/Images/Documentation/image-1680272427359.png)
![](http://cdn.document360.io/77f722a6-2d0a-49fa-8074-572515a6c4b8/Images/Documentation/image-1680272432025.png)