# Creating a test scenario

Create a scenario to add a movie and check the update in the catalog.

## Procedure

1. In Talend Cloud API Tester, open your API project in the SCENARIOS tab.
2. Click Add a scenario at the bottom of the page.

   ![Add a scenario button in the interface.](https://help.qlik.com/talend/en-US/api-services-getting-started-guide-api-services-platform/Resources/images/scenario_1.png)
3. Give a name to your scenario Scenario 1, for example.
4. Click the ![Three-dot menu](https://help.qlik.com/talend/en-US/api-services-getting-started-guide-api-services-platform/Resources/images/tester_3dot_menu.png) button to the right of the Add a movie request and click Move.

   ![Interface to add requests to the scenario.](https://help.qlik.com/talend/en-US/api-services-getting-started-guide-api-services-platform/Resources/images/create_scenario_2.png)
5. In the Move Request window that opens, select Movie catalog API &gt; Scenario 1 and click Move to save the request in your scenario.
6. Repeat the previous steps to move the Get a list of movies request to your scenario.
7. Click Edit scenario, then click Edit request in the Add a movie section.
8. Enter a new movie in the BODY.
   ### Example
   ```
   <movie>
   	<movieId>7</movieId>
   	<title>First Man</title>
   	<releaseYear>2018</releaseYear>
   	<director>Damien Chazelle</director>
   	<price>5.99</price>
   </movie>
   ```
9. In the ASSERTIONS section, click Add assertion and create the following assertion:
   | Source | Operator | Expected value |
   | --- | --- | --- |
   | Status code | Equals | 200 |
10. From the left panel, open the Get a list of movies request in your scenario.
11. In the ASSERTIONS section, click Add assertion and configure the following assertions to check that the last entry in the database matches your previous POST request.
    | Source | Path selector | Operator | Expected value |
    | --- | --- | --- | --- |
    | Status code | Not applicable | Equals | 200 |
    | XML<br>Body | //movies/movie[last()]/title | Equals | ${"Movie catalog API"."Scenario 1"."Add a movie"."request"."body".xPath("/movie/title")} |

    To configure the expected value for the second assertion, you can click the magic wand icon next to the fourth field to create an expression and select Movie catalog API &gt; Scenario 1 &gt; Add a movie &gt; request &gt; body &gt; movie &gt; title.

    You can see the expression you created and a preview of its value.

    ![EXPRESSION BUILDER view.](https://help.qlik.com/talend/en-US/api-services-getting-started-guide-api-services-platform/Resources/images/create_scenario_3.png)
12. Click the play button to the left of your scenario in the left panel to run it.

## Results

Talend Cloud API Tester sends the two requests in the order defined in the scenario. For the Get a list of movies request, you should get the following result:

![Screenshot of the scenario running.](https://help.qlik.com/talend/en-US/api-services-getting-started-guide-api-services-platform/Resources/images/kls1574415974912_LowRes.png)

Once your tests are configured, you can automate them using the Talend Cloud API Tester Maven plugin. For more information, see [Automating your API tests](https://help.qlik.com/talend/r/en-US/Cloud/api-tester-user-guide/automating-api-tests).