Forum Discussion

LennSar's avatar
LennSar
Contributor
3 years ago

Error when using command line to run data driven test

Hi there,

I'm trying to run a test case from the command line but seems to have problems replacing a path variable with values from a file. The get request I'm trying to send looks as follow:

 

http:\\192.168.2.1\path\to\{ID}\device

 

I added a source and loop block. The source block is configured to take the ID from a *.csv file which also holds the expected response. So the *.csv file looks as follows:

"ID";"response"
1; "device 1"

2; "device 2"

3; "device 3"

 

when running the test case in ReadyApi everything works fine. The request is executed with ID = 1, ID = 2 and ID = 3. When running the test case from the command line however, I get the following error:

16:10:09,625 ERROR [SoapUI] An error occurred [Unrecognized token '$': was expecting (JSON String, Number, Array, Object or token 'null', 'true' or 'false')
at [Source: (String)"${Id_List#id}"; line: 1, column: 2]], see error log for details
16:10:09,625 ERROR [errorlog] com.fasterxml.jackson.core.JsonParseException: Unrecognized token '$': was expecting (JSON String, Number, Array, Object or token 'null', 'true' or 'false')
at [Source: (String)"${Id_List#id}"; line: 1, column: 2]
com.fasterxml.jackson.core.JsonParseException: Unrecognized token '$': was expecting (JSON String, Number, Array, Object or token 'null', 'true' or 'false')
at [Source: (String)"${Id_List#id}"; line: 1, column: 2]

 

Id_List is the name of the source block and id the property name for the ID's in the *.csv file.

Afterwards the  request is send many many times but always with the {ID} field bein empty. Obviously there is some issue with parsing the ID from the file into the request. 

Please let me know whether I'm doing something wrong and how or if I can fix this. 

 

Thanks in advance!

 

Lennart

 

  • richie's avatar
    richie
    Community Hero
    Hey LennSar,

    Are you using groovy script or the DataSource/DataSourcing functionality?

    Im struggling to visualise everything properly (my fault, not yours), could you provide some screenshots of the api settings, datasource config, and your .csv file please? Also if you are using groovy, could you please add the groovy in the post please?

    I did notice you seem to have a semi colon as a separator in your csv and im assuming as it works fine in gui then that must be ok, but i wouldnt have expected a semi colon as a separator in a csv.

    If you can provide that stuff that will help people diagnose. As you say...it works via gui, but doesnt via command line, so im expecting problems in finding the file via command line is the cause, but need to see your config cos then i can try and replicate on my machine.

    What version of ReadyAPI are you using?

    Oh...one thing....regarding security concerns posting some of this stuff....the only thing you shouldnt be publishing is the login creds and hostname for the api. Youve already posted the host part of the api and thats just a local ip address so no security risk there. Im saying this so you dont start blanking out bits of a screenshot that could help. Some forum users when posting screenshots blank out too much. You only need to blank out login creds and the hostname from a security perspective and as your using a local ip address that doesnt help anyone with dodgy purposes.

    Ta

    Rich
    • LennSar's avatar
      LennSar
      Contributor

      Hi Richie,

       

      thanks for your reply. Yes, we are using semicolons as a separater. Kind of a german thing to do as we have commas to separated decimal and fractional places. It would be kind of a headscratcher if ReadyApi is not capable of handling that. Especially because it is set up to use semicolons in the data source settings as shown here: 

       

      And as you have noticed: In does work fine in the GUI!

      Here are the settings for the request

       

      There is no groovy script involved and the .csv file is basically written down in my initial question. If you open it with a text editor and enter the following content, you have the exact same file as I do:

       

      "ID";"response"
      1;"device 1"

      2;"device 2"

      3;"device 3"

       

      The response section of the .csv file is not currently used. I will add an according assertion to that later on.

       

      Regarding the security concerns: Security doesn't only mean that somebody might log in to the device but there might be things for market competetors to copy. And I don't want to get in trouble for stuff like that so I did a lot of blacking. If you need to see more detail or the real thing we should setup a zoom or teams meeting. 

       

      Hope those details are sufficient to replicate the issue. Let me know if you need any further detail.

       

      Thanks,

       

      Lennart