Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to use a query result in the verification step #7

Open
EullerLisowski opened this issue Aug 27, 2019 · 1 comment
Open

Unable to use a query result in the verification step #7

EullerLisowski opened this issue Aug 27, 2019 · 1 comment

Comments

@EullerLisowski
Copy link
Contributor

EullerLisowski commented Aug 27, 2019

Hello!
I'm trying to compare if the value of a property from the response body is equals to a value obtained from the database.

My scenario is very similar to this one below I tried in very different ways to use the verify but it
either it can't be evaluated or is evaluate to null.

Scenario: Compares database and response body
        * uri: http://www.myservice.com/get_something
        * dir: features/queries
        * query: find_something.sql
        # It's finding a single line like [ { id=123, name="SomeName"} ]
        * var: query_result<-'$[0]'
        * send: GET
        # response body {"id": 123, "name": "SomeName"}
        * status: 200
        # some verify usages that I tried 
        * verify: '$.id'=code: ${query_result.id}
        * verify: '$.id'=code: ${query_result.get('id')}
        * verify: '$.id'=${query_result.id}

Did pandaria implemented this kind of step already?

https://app.leanboard.io/board/2888ba13-a6b1-43bd-999f-195766a0cef5

@JakimLi
Copy link
Owner

JakimLi commented Aug 28, 2019

Hi,

Unfortunately no, we haven't implemented those kinds of steps yet at this stage, currently, it only supports primitive variable, we haven't met this scenario, but it definitely a valid use case, I will work on to implement this, I will probably go with:

* verify: '$.id'=${query_result.id}
* verify: '$.id'=code: ${query_result.id}

Before the next release, a workaround might be:

* var: id<-'$[0].id'
* verify: '$.id'=${id}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants