With the rise of Ajax powered sites, it is becoming very important for the websites to load the data quickly, asynchronously and without any delay.
For AJAX applications, JSON is faster and easier than XML.
Difference between JSON and XML
JSON syntax is lighter than XML as JSON has serialized format of data having less redundancy. JSON does not contain start and end tags.
XML is not so lighter as JSON as having start and end tags and it takes more character than JSON to represent same data.
Does RPT support JSON inputs?
Yes. JSON inputs are supported since the version RPT 8.2.1.
How to pass JSON inputs into RPT?
JSON inputs can be passed into RPT using the below two methods -
I. Proxy recording
The procedure is the same as recording a http test.
The use case would be:
1. [RPT Recording Wizard] Start a 'New test from Recording'
2. [RPT Recording Wizard] Select the option 'http test'
3. [RPT Recording Wizard] Record an "unmanaged application"
4. [RPT Recording Wizard] Selection of an available port on the machine, and then start of the recording.
5. [SoapUI client ] Launch SOAP UI > File > Preferences > Proxy settings
6. [SoapUI client ] Populate the 'Host' flied with the value 127.0.0.1. The Port number should be the one that you selected during recording (as in Step 4)
7. [SoapUI client] Manual tests until the end of a given scenario.
8. [Rpt Recording Wizard] Stop the recording.
Once the recording is stopped, a SOA extension test should be created in RPT with all the JSON information.
II. Manual test suite creation
1. Launch RPT
2. File > New Web service Test > Empty Test
3. Once an Empty test is created, you can add 'Text requests'
4. The URL should have the JSON information.
5. Add a 'http header'
Name - 'Content-Type'
Value - 'application/json'
6. Lastly, paste the JSON Content to be sent in the test suite -
Some JSON Samples