Robotframework Interface Test (i)-get request JSON

Source: Internet
Author: User

The ideal process:

1. Create session

2. Initiate a request under this session

3. Verify that the results are returned

When you actually run, you will find that your project may take one more step, becoming

1. Access to Cookies

2. Create session

3. Initiate a request under this session

4. Verify that the results are returned

This note summarizes, for the method is get, the return value of the interface test JSON

First, throw an example to explain, Q1 shown

Line 1th: Get cookies

Line 2nd: Create a Request header information (you can add the desired value according to your own situation, similar to the JMeter header file, not necessarily required)

Line 3rd: Create session. Note: The API here refers to alias , which is the one specified for the currently created HTTP session. The session is recognized at the GET request.

Line 4th: Initiate the request. Return Object ${addr}

Line 5th: Determine if the request response is 200:200 to continue execution of the use case, no failure to terminate

Line 7th: Turn into JSON string format

Line 8th: Get the Count value in JSON

Line 9th: Get the data value in JSON

Line 12th: Determine if the count value is consistent with the expected value: 7. The consensus passed.

Ii. Summary of the problems I have encountered

1. Return value indicates no seesion

WORKAROUND: General Add login operation, get cookie information there is no problem. (Do not know if there are other ways to add later)

2. Return value is encoded format, want to become Chinese

FIX: Change parameter ${data} to @{data}. (Do not know if there are other ways to add later)

Robotframework Interface Test (i)-get request JSON

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.