TestProject Forum
Powered by leading experts in the test automation community

Checking jsonPath with Parameters + Data Driven not working for me

Hello!

I’m playing around with Test Project to decide whether we are going to use or not and I’m doing some Proof of Concept for my colleagues.

I’m testing with TestProject’s API to GET Agents. I’m using two parameters “alias” and “machineName” like this:
URL: https://api.testproject.io/v2/agents​
query: _start=0&_limit=10&_q=alias
Headers: accept=application/json,Authorization=myKey
jsonPath: $[0].machineName​
Response: machineName

In my CSV file I put:

  1. Luiz,lalala
  2. VM1,VM01APP01
  3. VM2,VM02APP02
    Note that Luiz,lalala is invalid and I’m expecting this line to fail.

Then I uploaded my csv file and ran the tests.

As you can see below, all tests passed.
I was expecting the first test to fail because lalala is not valid but, looking at the log below, it seems that TestProject validated the actual name of Luiz’s VM.
image

Did I something wrong?

Hello @luiz.waldrich and thanks for reaching out.

How does your CSV file look like?
It should be something like this:

image

Where the first row has the exact same names of the input parameters in your test.

Rows two to four, will be three separate test executions, where the first execution will use the values:
alias=Luiz and machineName=lalala.

The second execution will use the values in the next row etc.

See here for more details:
https://docs.testproject.io/schedule-and-run-tests/using-data-driven-jobs-in-testproject

Hi @david.goichman

Yes, the CSV looks like that. I have chosen “comma separated csv”:
image

There is no problem with the CSV because it iterates correctly 3 times and uses the 3 different alias informed in that CSV. I think the problem is on my validation.

I found out that I was using the wrong field to validate. I should use Json Response instead of just Response. My bad.
image