Comments (4)
Codeception seems to be a really nice test suite for API, with the ApiGuy class:
<?php
$I = new ApiGuy($scenario);
$I->wantTo('create a new user by API');
$I->amHttpAuthenticated('davert','123456');
$I->haveHttpHeader('Content-Type','application/x-www-form-urlencoded');
$I->sendPOST('/users', array('name' => 'davert' ));
$I->seeResponseCodeIs(200);
$I->seeResponseIsJson();
$I->seeResponseContainsJson(array('result' => 'ok'));
?>
from phalcon-rest.
Its nice, but the syntax isn't very nice to look at or read.
Potentially use something like spectrum ?
from phalcon-rest.
I tried Codeception for testing some REST API in my application and it was nice. As it is based on PHP classes in intentions, it has nice working autocomplete in IDE.
For me spectrum smells a little JavaScript, at first glance it looks like Jasmine.
I've also found that Behat could be used for testing API, here is article: http://keithloy.me/blog/2012/05/02/testing-rest-api-with-behat/
but I didn't used it myself so far.
from phalcon-rest.
Yeah, I'm not a huge fan of the syntax, but it is exceptionally clear what is happening, and is purpose-specific to testing a Rest API; it supports all of the tests I want to do out of the box.
Spectrum is nice for unit testing and functional testing of modules, which is not what I want to implement at first. As this is a more of a seed/boilerplate project, not a library, unit testing will be left to the implementer.
I'll write up the first few tests over the weekend and see how nice it is to work with.
from phalcon-rest.
Related Issues (12)
- Why I can't connect to mysql? HOT 3
- return json in RESTControlloer
- HOW TO GET DATA FROM MYSQL INSTEAD EXAMPLECONTROLLER.PHP HOT 1
- How show image
- JSON Responses need refactor HOT 2
- Optional Envelope Parameter HOT 1
- Access-Control headers need to be standardized HOT 1
- Example Model HOT 3
- Errors need JSON reconfiguring HOT 1
- Composer Support
- Error in Example
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from phalcon-rest.