Forum Discussion

adamali's avatar
adamali
Occasional Contributor
7 years ago

automated testing - drive all test parameters (including http verb) from excel sheet

Hello,   I'm trying to standup automated testing capability for APIs using ReadyAPI (soapUI, etc.). for the sake of speed, I need to be able to drive all request (REST request) parameters from exce...
  • adamali's avatar
    adamali
    7 years ago

    Thanks Richie,

     

    I gave it a go and came up with the above which working perfectly fine with a simple event groovy script. I even created a The whole project which also got tons of other automated features can be downloaded from here https://earth2.digital/GenericProject-readyapi-project.xml

     

    The project has simple 2 test cases:

    1. To authenticate and get a token

    2. Execute test cases by getting all parameters from a grid (can be modified to get from excel sheet). When I release v2 I will have it reading from an excel sheet.

     

     

    Here is the Event groovy script:

     

     

    // Check if the current test step is ScenarioDataSource
    if ( testStepResult.getTestStep().getName().equals("Start")) {
    if (context.expand( '${ScenarioDataSource#method}').equals("POST")) {
    testRunner.gotoStepByName( "POSTRequest")
    } else if (context.expand( '${ScenarioDataSource#method}').equals("GET")) {
    testRunner.gotoStepByName( "GETRequest")
    } else if (context.expand( '${ScenarioDataSource#method}').equals("PUT")) {
    testRunner.gotoStepByName( "PUTRequest")
    } else if (context.expand( '${ScenarioDataSource#method}').equals("DELETE")) {
    testRunner.gotoStepByName( "DELETERequest")
    }
    } else if ( testStepResult.getTestStep().getName().equals("POSTRequest") ||
    testStepResult.getTestStep().getName().equals("GETRequest") ||
    testStepResult.getTestStep().getName().equals("PUTRequest") ||
    testStepResult.getTestStep().getName().equals("DELETERequest") ) {
    // Run the first test step in the loop
    testRunner.gotoStepByName( "ScenarioDataSourceLoop")

    //log.info ( "ScenarioDataSourceLoop" )
    }

  • adamali's avatar
    adamali
    7 years ago

    Hi richie

     

    I have published the framework with lots of details on Github. Please have a look and let me if addresses your concern about complex cases.

     

    All you need to do is to fill in the excel sheet for your test scenario.

     

    Github Repo: https://github.com/earth2digital/automated-api-ddt-framework

    LinkedIn Article: https://www.linkedin.com/pulse/how-boost-performance-your-apis-part-i-adam-ali-/

    My blog Article: https://www.earth2.digital/blog/How-to-boost-the-performance-of-your-APIs-1-adam-ali.html

     

    Cheers,

    adam