Skip to main content
5 votes
Accepted

How to Use Http Request/JSON extractor(using Jmeter Variable) in Jmeter with Response assertion(using Jmeter Variable)

For example you have the following response: And you need to extract John from it. Add JSON Extractor Post Processor Configure it as follows: Reference Name: anything meaningful, i.e. name JSON ...
Dmitri T's user avatar
  • 13.6k
5 votes
Accepted

Suggest me the best way to automate REST web services with JSON using Java

If you would love to test REST API then I would recommend you to use Rest Assured which is a Java Library. It’s better to create Page Object Model and use Testing Framework like TestNG to write tests....
Ashwiinn Karaangutkar's user avatar
4 votes

What is the simplest way to rewrite Postman requests to C#

ReSharper is an Visual Studio IDE Plugin for C# by JetBrains. This won't help you much unless you want to write everything from scratch. Postman has the ability to generate code snippets for various ...
beatngu13's user avatar
  • 2,142
4 votes

How to send API request json body in cucumber

Hi you can use multiline argument (docstring) for this: https://cucumber.io/docs/gherkin/reference/#doc-strings https://github.com/intuit/karate/blob/master/README.md#multi-line-expressions Your ...
PDHide's user avatar
  • 11.1k
3 votes

How to extract multiple named values from a JSON object with jMeter

You can do this using JSON Extractor Add JSON Extractor as a child of the request which returns the above JSON Configure it as follows: That's it, now you have all serviceItemId values extracted ...
Dmitri T's user avatar
  • 13.6k
3 votes
Accepted

Should I write unit tests when the json schema is validated by a 3rd party library

Unit tests, by the book, are meant to exercise the code you write, isolating it from dependencies (SO calls, external libraries and even language built-in libraries if important for your code) through ...
João Farias's user avatar
3 votes
Accepted

Using Jmeter How to Match values in Json response with JDBC response?

Not knowing the details of JDBC and JSON response it is hard to provide exact configuration, from the high level perspective it should be something like: Add JSON Extractor and store "interesting" ...
Dmitri T's user avatar
  • 13.6k
3 votes
Accepted

How to count max character text for JSON api test

Json won't support multiline string, so you have to stringify free text before sending, (meaning convert space, tab etc to equivalent escape characters like \n, \t etc) You can use the below site to ...
PDHide's user avatar
  • 11.1k
3 votes

Handling cases where a JSON Key exists or not

You just get Response object from your call and do: public class Test { public static void main(String[] args) { Response response = RestAssured .get("https://mocki....
Alexey R.'s user avatar
  • 11.6k
3 votes
Accepted

How to verify particular values in JSON response - Postman

You can create a Postman test: pm.test("Checking wardNames", () => { const responseJson = pm.response.json(); pm.expect(responseJson[0].wardName).to.eql(Unit1); pm.expect(...
João Farias's user avatar
2 votes

How to Automate web services using JMETER?

Use HTTP Request sampler to perform initial call to the web service endpoint. You may also need to have HTTP Header Manager to send the relevant Content-Type header Use JSON Extractor to extract the ...
Dmitri T's user avatar
  • 13.6k
2 votes

Suggest me the best way to automate REST web services with JSON using Java

Karate is a relatively new project that is specialized for testing JSON web-services and it runs on the JVM. Disclaimer: am dev. There are a set of demos and examples that will get you started very ...
Peter Thomas's user avatar
2 votes

How do I capture some portion of logs from a log file?

Nothing to do with selenium for log parsing. you need to use java/perl/python which ever language your are using for writing selenium test scripts. But i implemented this kind of funtionality to check ...
rajendra.penumalli's user avatar
2 votes

What are the best ways to Automate JSON POST Request using Restassured API

You need to apply the below areas to your framework: The body for the POST call should be coming from a model file. Use a java serialization/de-serialization library like jackson or Gson to achieve ...
Kshetra Mohan Prusty's user avatar
2 votes

JMeter - Filter in JSON Extractor by JMeter Variable

Okay, so $..[?(@.name=='${RNAME}')].id actually works and the debug sampler was showing a match with RID_matchNr=1 but I was getting an empty match because I hadn't set my Match No. under the JSON ...
rick-pri's user avatar
2 votes

JMeter - JSON parse error: Unexpected character

Your data is not a valid JSON, you can check it yourself using i.e. online JSON formatter and validator You syntax of combination of __eval() and __FileToString() functions is incorrect, you should ...
Dmitri T's user avatar
  • 13.6k
2 votes
Accepted

What is the best way to create complex json in java?

This is something you can do by marshalling POJO's to JSON. For example with a framework such as Jackson. As described in this tutorial you can use a Jackson ObjectMapper: import com.brunozambiazi....
jpjwolli's user avatar
  • 487
2 votes

JMeter - JSON parse error: Unexpected character

Your JSON is not valid: 1 { 2 "User ID": 204120, 3 "name": "New User", 4 "Description": [{ 5 "name": "john", 6 "id": 204110, 7 "type": "robotics" 8 }], 9 "Status": "Post ...
Niels van Reijmersdal's user avatar
2 votes

How to send API request json body in cucumber

I'm assuming you are using Java in your testing framework. You have two ways of achieving it. Option 1: Try using Karate framework. If you use Java and want to do easy API testing. Option 2: ...
Michal Dobrzycki's user avatar
2 votes

Postman PUT returns success, but parameters are null in response body

Welcome. You need to read the documentation in detail, it shows an example of a request body for PUT method: { "name":"test1", "salary":"1123", &...
pavelsaman's user avatar
  • 4,548
2 votes
Accepted

How to perform HTTP PUT Request by reading values from CSV in JMeter?

JMeter's built-in CSV Data Set Config is reading lines from the CSV file sequentially so each user will get the next line on each iteration. If you need to read a random line (however I don't think it'...
Dmitri T's user avatar
  • 13.6k
2 votes

Handling cases where a JSON Key exists or not

Example json: { "priceOne": 1034, "priceTwo": {"new":2}, "priceThree": 7282 } Checking the value of "new" Response response =...
PDHide's user avatar
  • 11.1k
1 vote
Accepted

Codeception: test data in annotation - codeception reports undefined variable

You do not pass in the $example as described in the documentation: public function getPartnerCcdIdWithGroupId(ApiTester $I, \Codeception\Example $example)
Niels van Reijmersdal's user avatar
1 vote
Accepted

How to read data from JSON file , Then Pass these values on web application form with the help of Xpath Locators and Then Write it in Excel file?

1 - Read data from JSON Google has a very good Java library to parse JSON in a structured way: GSON The types you would use the most are JSONObject and JSONElement. 2 - Use the data in a test I ...
João Farias's user avatar
1 vote
Accepted

From an Json Object, I am trying to extract the values by using the below code in JSR223 processor

I think you have the logic wrong JSON.dump creates a string while JSON.loads creates an object so you are creating a string from json object and then converting it back to json object and also you ...
PDHide's user avatar
  • 11.1k
1 vote

How to duplicate part of tags in XML in Jmeter

To start with, your expected addition to the template is incorrect and would error out as invalid JSON. Unless the system allows multiple itemLines objects, you really want to be adding a second ...
Kate Paulk's user avatar
  • 31.5k
1 vote
Accepted

I am trying to extract a part of Json response, where i am not able to find the correct regex

Both your JSON entities are invalid therefore I'm afraid no one will be able to help. To give you some direction you can use Json Path to filter out "interesting" parts of the source JSON and ...
Dmitri T's user avatar
  • 13.6k
1 vote
Accepted

Rest assured API to get a element from Json response

Use the following jsonpath query: serviceLines[0].customerProducts.findAll{product -> product.highLevelProduct == 'HSI'}.customerProductIdentifier Test: System.out.println(js.get("serviceLines[0]...
Alexey R.'s user avatar
  • 11.6k
1 vote

How to extract rcAuth Token from header and POST as parameter to call an API

The most convenient way would be using a specialised framework for API testing, you can consider RestAssured if you don't have any better alternatives. Extracting response header would be as simple ...
Dmitri T's user avatar
  • 13.6k
1 vote

JMeter - Post Data passes JSON data

To get token values:: u need to pass parameters like username, password, grant_type, client_id n client_secret...which will be shared by respective developer of the API...
Ravikiran's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible