Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests #1

Open
cmoore4 opened this issue Jun 7, 2013 · 4 comments
Open

Tests #1

cmoore4 opened this issue Jun 7, 2013 · 4 comments
Assignees

Comments

@cmoore4
Copy link
Owner

cmoore4 commented Jun 7, 2013

This needs tests.

@ghost ghost assigned cmoore4 Aug 15, 2013
@cmoore4
Copy link
Owner Author

cmoore4 commented Aug 15, 2013

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'));
?>

@bayleedev
Copy link

Its nice, but the syntax isn't very nice to look at or read.

Potentially use something like spectrum ?

@acabala
Copy link

acabala commented Aug 16, 2013

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.

@cmoore4
Copy link
Owner Author

cmoore4 commented Aug 16, 2013

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants