![]() Our next step is to test the JSON to XML Converter post processor. This means that the response is in the JSON format, the wanted path is present and the actual value coincides with the expected value. Does the response contain the path '$.Count'?.Monitors -> Add -> Assertions -> - JSON Path Assertion As we can see in the screenshot above there are 2 items.Īdd a JSON Path Assertion element to verify the content of the response. Let's verify the number of items returned. The next step is to verify the response data. The response data is in a more readable format. The request works fine, just as in the previous test, but with one difference. No need to change anything in this element. Monitors -> Add -> Post Processors -> - JSON Format Post Processor Adding JSON Plugin Elements to the JMeter ScriptĪdd a JSON Format Post Processo r element to change the format of the JSON response. Is there a way to address this and make it more readable? Sure. ![]() We can see that the response contains an array of items and some other data.Ĭool! We see data, but the format of the data isn't very convenient to read. We see that this request received JSON data in the response. Thread Group -> Add -> Listener -> View Results Tree These element and values are necessary for sending the JSON data correctly.Īdd a View Results Tree listener to see the results of the tests. Monitors -> Add -> Config Element -> HTTP Header ManagerĪdd a row with the following values: Content-Type: application/json This sampler will make a POST request to the DemoBlaze server and should get a list of the monitors in the response.Īdd an HTTP Header Manager to define the content type of the request. Thread Group -> Add -> Sampler -> HTTP Request Test plan -> Add -> Thread (Users) -> Thread GroupĪdd an HTTP Request that asks for items from the category "Monitors." Great! Choosing the category is a proper example of an AJAX request. Choose the "Monitors" category -> This action makes an AJAX request to the server which sends and receives data in the JSON format.I found a good example on the DemoBlaze webstore: We need to find such a request and replicate it with JMeter for demo purposes. AJAX requests are used to send and retrieve data from a server asynchronously. JSON formatted data is often used in AJAX (Asynchronous JavaScript And XML) requests. Once you have the JMeter plugins manager, install "JSON Plugins". ![]() If you need help installing JMeter plugins, please follow this link to learn more. ![]() The JSON plugin expands the default functionality of JMeter with one sampler, one assertion, and two post processors: the JSON to XML Convertersampler, the JSON Path Assertion, the JSON Format Post Processor and the JSON Path Extractor. This post is about the JSON plugin for Apache JMeter™, which adds on to the ability to work with JSON (JavaScript Object Notation) formatted data in JMeter. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |