Forum Discussion

jassi's avatar
jassi
New Contributor
7 years ago

ReadyApi not reading any data from excel

Hi everyone, I am new to ReadyAPi. Currently I am using ReadyAPI 2.4.0. I am testing some web services (end points) by importing swagger. I have set up a data source with excel file to read security token as well as other properties that I need for get/post test cases. I have created GET and POST test cases under same test suite. ReadyApi is reading all the excel values perfectly fine for POST test case but it is reading nothing for GET. I tried to set up some assetions by reading data from excel, and in the assetiosn the values from excel are empty. I encountered same issue earlier for POST. That time I upgraded to latest version and after that issue was resolved by iteself. But now when I try to create new test case(GET), same problem is coming back. I can read the data from txt file, but the issue appear when reading  from excel. I have no empty cells or duplicate headers/values. I  have already tried deleting the test case/excel data and redoing everything but seems nothing is working.

 

For adding excel data, I am follwing simple steps of adding the data source and then saying yes for the loop. After that I set my data source to excel and import allt he properties int he sheet. I can see all the values correctly in the Data source section (bottom ) when i click on the run (green play) button. So upto that step data surce is showing me everything is fine but still when i run the test case, it doesnt read any value.  I have attached 2 screen shots to show values appearing in the data souce and the error during assertion. Can anyone provide any suggestions please? 

Thank you!

 

Edit: I resolved the issue. The problem was , I had to select the "skip empty rows" option. 

 

 

  • Lucian's avatar
    Lucian
    Community Hero

    That's always cool that you solved it but I don't really get what was the connection between the datasource and the http method type.

    • jassi's avatar
      jassi
      New Contributor

      What do you mean by connetion, can you please elaborate? The data source (excel) had data that was used for Post request. i.e. user details and security token. 

  • aaronpliu's avatar
    aaronpliu
    Frequent Contributor

    not sure how you read data from excel. ReadyAPI lib contains multiple jar packages to process data source (from excel), ie: jxl, poi,...

    so you should read data according to your design and parse them refer to structure of test suite / test case.

    generally, we would like to import data before test suite / test case execution, most of time should import data to Header / Payload / Parameter (properties). as you known, the data structure looks like map (key-value pair), so you can defined a data source like below:

    (Example)

    TestStepName    Header                           Payload      Parameters

    Login                   cookie,mediaType         content        pageNumber, pageSize

    Logout                 cookie,mediaType         sessionId    

    Note: you can think about how to read data. as for load data into test step / test case / test suite. ReadyAPI provide corresponding methods to process it.

     

    these data can save into a map, and then parse them when you need.

    (example)

    loop your test suite / test case / test step, and then lookup corresponding test step refer to current test step name.

    for header, you can directly add a map

    for payload, you can directly assign to request content

    for parameters, you can load data refer to existing parameters. if existing, then add. or you can add all parameters you input in excel.

     

    So should be flexible to load data from excel via groovy script. Checking your requirement and provide more details for community to figure out the best practice. Good luck