adding behat

This commit is contained in:
Fernando Ontiveros
2013-12-16 16:08:39 -04:00
parent d215b02177
commit 39316740dd
6 changed files with 992 additions and 0 deletions

6
behat.yml Normal file
View File

@@ -0,0 +1,6 @@
# behat.yml
default:
context:
parameters:
base_url: http://192.168.11.181/api/1.0/workflow/
access_token: 041ac5efcd40a071cc75b71009fa430c8685c50d

View File

@@ -61,5 +61,9 @@
"colosa/pmui": "dev-master",
"colosa/michelangelofe": "dev-master",
"underscore/underscore": "1.5.2"
},
"require-dev":{
"guzzle/guzzle":"~3.1.1",
"behat/behat":"2.4.*@stable"
}
}

View File

@@ -0,0 +1,41 @@
@ProcessMakerMichelangelo @RestAPI
Feature: Testing Oauth
Scenario: GET projects list
Given that I have a valid access_token
And I request "projects"
Then the response status code should be 200
And the response charset is "UTF-8"
And the content type is "application/json"
And the type is "array"
And the "prj_uid" property in row 0 equals "8061532405176da5242da84006421863"
And the "prj_name" property in row 0 equals "Sample Project"
And the "prj_description" property in row 0 equals "description"
And the "diagrams" property in row 0 equals "diagrams"
Scenario: GET project SLA Process Entire process...
Given that I have a valid access_token
And I request "project/725511159507f70b01942b3002493938"
Then the response status code should be 200
And the response charset is "UTF-8"
And the content type is "application/json"
And the type is "object"
And the response has a "diagrams" property
And the "diagrams" property type is "array"
#And the "lanesets" property in row 0 of property "diagrams" equals "xx"
And the "lanesets" property in row 0 of property "diagrams" is "array"
And the "lanes" property in row 0 of property "diagrams" is "array"
And the "activities" property in row 0 of property "diagrams" is "array"
And the "events" property in row 0 of property "diagrams" is "array"
And the "gateways" property in row 0 of property "diagrams" is "array"
And the "flows" property in row 0 of property "diagrams" is "array"
And the "artifacts" property in row 0 of property "diagrams" is "array"
# Scenario: Creating new Project with API
# Given that I want to make a new "Process"
# And "prj_name" is "my test process"
# And "prj_description" is "test for gizzle"
# And the request is sent as JSON
# When I request "project"
# Then the response status code should be 201
# And the response should be JSON
# And the response has a "prj_id" property

View File

@@ -0,0 +1,66 @@
<?php
use Behat\Behat\Context\ClosuredContextInterface,
Behat\Behat\Context\TranslatedContextInterface,
Behat\Behat\Context\BehatContext,
Behat\Behat\Exception\PendingException;
use Behat\Gherkin\Node\PyStringNode,
Behat\Gherkin\Node\TableNode;
//
// Require 3rd-party libraries here:
//
// require_once 'PHPUnit/Autoload.php';
// require_once 'PHPUnit/Framework/Assert/Functions.php';
//
require_once 'config.php';
/**
* Features context.
*/
class FeatureContext extends BehatContext
{
/**
* Initializes context.
* Every scenario gets it's own context object.
*
* @param array $parameters context parameters (set them up through behat.yml)
*/
public function __construct(array $parameters)
{
// Initialize your context here
$this->useContext('RestContext', new RestContext($parameters));
}
/**
* @When /^I run "([^"]*)"$/
*/
public function iRun($command)
{
exec($command, $result);
$this->output = $result;
}
/**
* @Then /^I should see the file "([^"]*)"$/
*/
public function iShouldSeeTheFile($fileName)
{
if (!in_array($fileName, $this->output)) {
throw new Exception('File named ' . $fileName . ' not found!');
}
}
//
// Place your definition and hook methods here:
//
// /**
// * @Given /^I have done something with "([^"]*)"$/
// */
// public function iHaveDoneSomethingWith($argument)
// {
// doSomethingWith($argument);
// }
//
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,12 @@
<?php
global $config;
$config = array (
'code' => "5efe0d0fd38bffe5932cfdc2773e55b4b8bf273c",
'access_token' => "1c986015c086315e2200095afe2a20e53f71a659",
'expires_in' => 3600,
'token_type' => "bearer",
'scope' => "view_processes edit_processes",
'refresh_token' => "ade174976fe77f12ecde7c9e1d8307ac495f443e",
);