PHP Classes

PHP REST Client Framework Control: Testing and validating REST services

Recommend this page to a friend!
     
  Info   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 159 All time: 8,989 This week: 524Up
Version License PHP version Categories
rest-control 1.0.0MIT/X Consortium ...5HTTP, PHP 5, Web services, Testing
Description 

Author

This package can be used for testing and validating REST services.

It can configure and send HTTP requests using different methods like POST, GET, PUT, DELETE, HEAD, PATCH, PURGE, OPTIONS, TRACE and CONNECT. It supports:

- Emulate form submission
- Configure request headers
- Perform basic HTTP authentication
- oAuth protocol
- JSON response status and body validation
- Describe test details using annotations
- Measure the response time and retrieve test statistics
- Etc.

Picture of Kamil
  Performance   Level  
Innovation award
Innovation award
Nominee: 1x

 

Details

RestControl

About RestControl(Twitter)

RestControl is modern and powerful framework for testing REST services. RestControl provides set of tools for describing HTTP requests and responses in expressive and elegant way.

Latest Stable Version Latest Unstable Version License Build status Build Status

Examples

Here is a simple example of how to send a GET request and validate json response:

 /
  * @test(
  *     title="Example test",
  *     description="Example test description",
  *     tags="find user"
  * )
  */
 public function exampleFindUser()
 {
    return send()->get('https://jsonplaceholder.typicode.com/users/1')
                 ->expectedResponse()
                 ->httpStatusOk()
                 ->json()
                 ->jsonPath('$.address.street', endsWith('Light'));
 }

Features/Helpers

  • Easily sending HTTP Requests, variety of http methods like post, get, put, delete, head, patch, purge, options, trace, connect
  • forms
  • request headers
  • basic HTTP authentication
  • oAuth && oAuth2 authentication(in progress)
  • JSON response validation
  • JSON Path body validation
  • easily JSON body items and collection of items validation
  • sets of http response code helpers like httpStatusOk, httpBadGateway etc.
  • easily to use expression language - iteration over body items - values comparing (e.g. equalsTo, lessThan) - string validation (e.g. startsWith, endsWith) - custom validation via closure
  • annotations describing tests
  • measuring response time and tests statistics
  • XML validation(in progress)
  • easily system of tests environments
  • json, html reporting system(in progress)
  • cookies(in progress)
  • proxy, ssl support(in progress)
  • command for automatic generation of tests

Quick Start

The best way for quick start is to use RestControl standalone application. You can find it here https://github.com/rest-control/standalone-testing-application. If you want to save yourself the hassle of installing dependencies required for this project on your local machine, you can use Docker containers as an alternative. Note that you will need Docker and Docker Compose in version >= 2.1.

To build and start RestControl standalone application, run following commands:

user@user:~/projects/standalone-testing-application$ make build
user@user:~/projects/standalone-testing-application$ make start

Now, you can use Docker machine and run example tests.

user@user:~/projects/standalone-testing-application$ docker exec -it restcontrol_cli_1 bash
user@machineid:/app# php vendor/bin/rest-control run

Contributing

Thank you if you considering contributing to RestControl! The contribution guide will be available soon. Start watching this project to get regular updates.

Project roadmap

All planned releases you can find here: https://github.com/rest-control/rest-control/milestones.

Learning RestControl

RestControl documentation is under construction, please be patient. Current documentation files are available on https://rest-control.github.io/


  Files folder image Files (234)  
File Role Description
Files folder image.github (3 files)
Files folder imagebin (1 file)
Files folder imagesrc (1 file, 8 directories)
Files folder imagetests (2 files, 7 directories)
Accessible without login Plain text file .coveralls.yml Data Auxiliary data
Accessible without login Plain text file .php_cs.dist Example Example script
Accessible without login Plain text file .travis.yml Data Auxiliary data
Accessible without login Plain text file appveyor.yml Data Auxiliary data
Accessible without login Plain text file CHANGELOG.md Data Auxiliary data
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file CONTRIBUTING.md Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file phpunit.xml.dist Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation
Accessible without login Plain text file rest-control.yml-sample Data Auxiliary data

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:159
This week:0
All time:8,989
This week:524Up