Forum Discussion

atariqharri's avatar
atariqharri
Occasional Contributor
2 years ago
Solved

Reusable Instructions

I want to define a set of instructions to create test data and I want to be able to parameterize these instructions so that I can create different data for different tests. How can I achieve this in Ready API

  • Got you.

     

    In order to achieve that there are multiple ways.

    1. Create a library using one of the below approaches and call that library in the Setup Script

    a. write a class and methods

    b. use script library

    NOTE: one needs to be familiar with scripting / coding skills.

    2. Create a separate test case and ensure this test is disabled (so that it is not called when the test cases are executed). And call this test case in the setup script.

    I have noticed many in the forum to use this approach as it is easy to implement though I don't prefer/suggest this as it depends on another test case.

4 Replies

  • nmrao's avatar
    nmrao
    Champion Level 3

    Got you.

     

    In order to achieve that there are multiple ways.

    1. Create a library using one of the below approaches and call that library in the Setup Script

    a. write a class and methods

    b. use script library

    NOTE: one needs to be familiar with scripting / coding skills.

    2. Create a separate test case and ensure this test is disabled (so that it is not called when the test cases are executed). And call this test case in the setup script.

    I have noticed many in the forum to use this approach as it is easy to implement though I don't prefer/suggest this as it depends on another test case.

    • atariqharri's avatar
      atariqharri
      Occasional Contributor

      I want to create test data inside of the system I'm going to test, by sending API requests to the system. for example, in a webstore, if I wanted to test the workflow for ordering a product, I would like to create a test product just before running the test. I am looking for a way to create this test product in the system before running the test. Moreover, since "creating a product" is a prerequisite for so many tests, I would like to define the instructions to "create a product" one time in a reusable manner, so that I can run it before each test.

  • ChrisAdams's avatar
    ChrisAdams
    Champion Level 3

    Hi,

    You might want to read up on the 'data gen' test step.  I beleive this allows you to create data.