How the PHP API interface is tested

Source: Internet
Author: User
Title, how to test the PHP API interface, what are the options for you?

Reply content:

Title, how to test the PHP API interface, what are the options for you?

Postman

The API can be tested using PHPUnit: PHPUnit configuration and use under Windows

Chrome expands DHC
If you're using Phpstorm, there's a self-contained tool.

OSX has a very good choice, paw.

I usually use google chrome a plugin: postman to test the interface ...

Curl Command

Current Toolchain: Shell + curl + JQ + awk + sed + ... Overall or to the naked eye one by one to see the results, but the interface is not fixed also had to write a simple script to test it at random?
After settling down, I will consider using phpunit/codeception and the like to facilitate the processing of the test results.

access_token=$(curl -Ss -X POST "${baseUrl}/user/login" -H 'Content-Type:application/json' -d '{"email":"a@bcom","password":"c"}' \    | jq . | sed -n '/access_token/p' | awk '{ print $2 }' | tr -d '", ')

or Yii2-rest.

Hattip.
Paw
Paw a more complete and higher level of functionality

Chrome and Firefox also have plug-ins

If you are using PHP Storm (jetbrains home product):

menu->Tools->Test RESTful Web Service

Recommended JMeter

Tool level can be used JMeter, if the latter frame or architecture and development can be used robot framework+requestlibrary

Advanced REST Client

  • 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.