Forum Discussion

khansen's avatar
khansen
New Contributor
3 years ago

How to execute a ReadyAPI Data Source Loop Test-Step from Cmdline?

Hello!

I'm building a powershell wrapper which takes a few arguments in (URI, test-suite, test-case, xml project path, etc.) to then pass it to the SmartBear ReadyAPI testrunner.bat which calls the XML project I have defined a couple Test-Suites, in which are Test-Cases with a Data Source, Data Loop, and the Test-Step itself.

The idea is for the Data Source to connect to my SQL db and fetch data to be sent over along with the expected result which I've passed to the Xpath of each corresponding request to see if the data matches it's expected result.

The tests run beautifully in ReadyAPI's desktop app, however, I need to invoke them from the cmdline (using powershell cmdlet). I have experience doing this with SoapUI and it seemed almost as if all I'd have to do is switch our the Soap testrunner.bat path with the ReadyAPI testrunner.bat path.

I'm able to execute the Test-Step through the testrunner.bat (using psh wrapper) but only a single test is processed as opposed to going through the 800+ returned records from the SQL query in the Data Source.

I've looked through all the cmdline arguments and there are no posts anywhere relating to executing a Data Source Loop test-step from the cmdline using ReadyApi testrunner.bat to successfully iterate through the entire batch of queried records as opposed to a single test-step. Wondering how I can call this data source loop from the cmdline and have it execute as it does in the desktop app.

Thank you!

EDIT: I've run the testrunner.bat on the same project but different test-case which has a larger SQL query for the Data-Source and this cmdline execution is taking much longer, implying that the Data-Source is in fact querying for the records - it's just not looping over each one in the Test-Step for whatever reason.

  • The powershell script invokes the testrunner.bat from the ReadyAPI bin from an Azure pipeline. This is to scale API tests within a pipeline with the ability to diagnose any errors in our specific tests.

     

    I also figured out the issue - I had cloned a Test-Suite which contained a Data Source / Data Loop / Test Step which I modified and hadn't changed the Data-Source / Data-Loop names. After changing the names and reselecting the targeted Test-Step and saving the project, I was able to successfully run it as expected.

  • nmrao's avatar
    nmrao
    Champion Level 3
    What is the added advantage of having power shell script over the testrunner script?
    • khansen's avatar
      khansen
      New Contributor

      The powershell script invokes the testrunner.bat from the ReadyAPI bin from an Azure pipeline. This is to scale API tests within a pipeline with the ability to diagnose any errors in our specific tests.

       

      I also figured out the issue - I had cloned a Test-Suite which contained a Data Source / Data Loop / Test Step which I modified and hadn't changed the Data-Source / Data-Loop names. After changing the names and reselecting the targeted Test-Step and saving the project, I was able to successfully run it as expected.

  • nmrao's avatar
    nmrao
    Champion Level 3

    Glad to know you figuredout the issue and resolved.

     

    Thank you for adding the information regarding the powershell too.

     

    Just curious to understand. Can't Azure pipeline invoke testrunner.bat? Does it need power shell or bash script?

    • khansen's avatar
      khansen
      New Contributor

      Perhaps using SmartBears Azure marketplace extension, however, we try to use as little extensions/add-ons to our services as possible. The wrapper also allows us to have a little more granular control of the tests from what it seems like.