Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

"no step-definition method match found for" when attempting to put part of the response in a variable (using 'def')

I’m trying to put part of my PUT response body in a variable, cause I will be using this information later in the same test, but for some reason I cannot do that:
enter image description here

As you can see, I can print that part of the response (the ID), so I guess there’s nothing wrong with the syntax/address I’m using to reach it in the print. When attempting to put the same information in a variable, it is not possible.

It is probably something simple, and I’m new to KarateDSL, so I hope you guys can help me figure out this one. Really appreciated!

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Karate has a convention for variable names, and hyphens are not allowed. Underscores are. So you can do this:

* def equipment1 = response['foo'][0].bar

Or:

* def equipment_1 = response['foo'][0].bar
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading