Giter Site home page Giter Site logo

Tests about phalcon-rest HOT 4 OPEN

cmoore4 avatar cmoore4 commented on July 28, 2024
Tests

from phalcon-rest.

Comments (4)

cmoore4 avatar cmoore4 commented on July 28, 2024

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.

bayleedev avatar bayleedev commented on July 28, 2024

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

Potentially use something like spectrum ?

from phalcon-rest.

acabala avatar acabala commented on July 28, 2024

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.

cmoore4 avatar cmoore4 commented on July 28, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

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

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.