Skip to main content Skip to complementary content

Testing your deployed API

Once your API is deployed on Talend Management Console, you can use Talend Cloud API Tester to run tests on it.

About this task

This example uses the scenario created in Creating a test scenario, but you can also create a new scenario.

Procedure

  1. In Talend Cloud API Tester, open the Movie catalog API project.
  2. Select the relevant environment and make sure that the endpoint is correct.

    Example

    Environments dialog box.
  3. Click the Three-dot menu icon to the right of Scenario 1 and select Copy.
  4. Name the copy Scenario 2.
  5. Copy the Add a movie requests twice and rename the copies Add a second movie and Add a third movie.
  6. In each of the POST requests, enter a movie in the request body.

    Example

    <movie>
        <movieId>8</movieId>
        <title>Booksmart</title>
        <releaseYear>2019</releaseYear>
        <director>Olivia Wilde</director>
        <price>4.99</price>
    </movie>
    <movie>
        <movieId>9</movieId>
        <title>A Quiet Place</title>
        <releaseYear>2018</releaseYear>
        <director>John Krasinski</director>
        <price>4.99</price>
    </movie>
    <movie>
        <movieId>10</movieId>
        <title>Selma</title>
        <releaseYear>2014</releaseYear>
        <director>Ava DuVernay</director>
        <price>4.99</price>
    </movie>
  7. Open the Get a list of movies request and add the following assertions:
    Source Path selector Operator Expected value
    Status code Not applicable Equals 200
    XML body //movies/movie[last() - 2]/title Equals ${"Movie catalog API"."Scenario 2"."Add a movie"."request"."body".xPath("/movie/title")}
    XML body //movies/movie[last() - 1]/title Equals ${"Movie catalog API"."Scenario 2"."Add a second movie"."request"."body".xPath("/movie/title")}
    XML body //movies/movie[last()]/title Equals ${"Movie catalog API"."Scenario 2"."Add a third movie"."request"."body".xPath("/movie/title")}

    These assertions will check if the titles of the last three movies in the database match the titles of the three requests sent with this scenario.

  8. Click the play button to the left of your scenario in the left panel to run the scenario.

Results

The requests are sent in the order defined.
Screenshot of the scenario running.

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!