# Generating assertions using AI

Writing assertions from scratch can be a cumbersome task. Most of the time, you need assertions to check the general structure of the API response to get started.

This is where the "Generate using AI" feature for assertions can help you out. Using this, KushoAI looks at your API response and creates a basic set of assertions to check that all future API responses match this structure. Note that this will work only when the API response is valid, so this is something that needs to be verified by you.

Here's how you can use this feature to quickly get started with assertions.

  1. Run a test - you can use the run all option or just run a single test.

  2. Go to the "Assertions" tab under test details.

  3. Click on the "Generate using AI" button. It might take a couple of seconds for the assertions to get generated.

  1. Add/edit/remove any additional assertions as per your requirement.

  2. Click on "Save and Run". This will save the assertions and rerun the test with assertions.

  1. You should see a pass/fail status under the "Assertions" column. Along with that, you'll see the status for individual assertions under the "Assertion Results" tab in test details.

Please note that these assertions are generated based on your API response. If the response is wrong, the assertions generated will also be bad. Make sure to use this feature only on correct responses. An incorrect response for a test point to a bug in your code. You'll need to fix that before you can generate assertions using this feature.