@@ -16,11 +16,6 @@ Guzzle extension for Behat is an integration layer between Behat 3.0+ and Guzzle
1616 base step definitions and hooks for your contexts or subcontexts. Or it could
1717 be even used as context on its own.
1818
19- ## To do
20-
21- * Add documentation
22- * Add language support
23-
2419## Installation
2520
2621Add to your project with Composer (* dev* )
@@ -31,7 +26,24 @@ php composer.phar require --dev teaandcode/behat-guzzle-extension
3126
3227## Configuration
3328
34- ### Example Configuration
29+ The extension is designed to require very little configuration, the only two
30+ fields it requires is a ` base_url ` and a ` service_descriptions ` file location.
31+
32+ The ` base_url ` is the root url containing either a host name or IP address of
33+ the API you're writing tests for, just make sure it's a fully qualified URL
34+ (the trailing slash is not required) e.g. http://127.0.0.1
35+
36+ The ` service_descriptions ` file location is required as the extension is
37+ designed to make use of a Guzzle service descriptions file, this means that all
38+ the endpoints and associated fields you want to test should be listed as JSON in
39+ the file for the extension to work.
40+
41+ Follow the link provided here if you want to know more about how to use the
42+ [ Guzzle service descriptions] ( http://guzzle3.readthedocs.org/webservice-client/guzzle-service-descriptions.html )
43+ file or take a look at the example Guzzle service descriptions file excerpt
44+ below.
45+
46+ ### Example configuration in behat.yml
3547
3648``` yaml
3749default :
@@ -48,6 +60,51 @@ default:
4860 test.user.2 : A6B...8E6
4961` ` `
5062
63+ ### Example Guzzle service descriptions file
64+
65+ ` ` ` json
66+ {
67+ " name " : " Travis API" ,
68+ " operations " : {
69+ " GetReposBuilds " : {
70+ " httpMethod " : " GET" ,
71+ " uri " : " repos/{slug}/builds" ,
72+ " summary " : " Gets the last build for repo" ,
73+ " parameters " : {
74+ " slug " : {
75+ " location " : " uri" ,
76+ " description " : " Repo slug from GitHub" ,
77+ " required " : true
78+ },
79+ " number " : {
80+ " location " : " query"
81+ }
82+ }
83+ }
84+ }
85+ }
86+ ```
87+
88+ ## Further configuration
89+
90+ As you might have seen in the example configuration above, it is possible to
91+ pass a list of usernames or e-mail addresses that can be associated with an HTTP
92+ header Authorization Bearer token, which means that you're able to test secure
93+ parts of your API. Just specify the GuzzleContext as shown above in the
94+ behat.yml file and provide and array of users utilising the username/e-mail
95+ address ad the key with the bearer token as the value.
96+
97+ ## Predefined steps
98+
99+ TO DO: In the meantime checkout the repo.feature file in the features directory
100+ and the docblocks above each of the methods in the GuzzleContext.php file in the
101+ src/Behat/GuzzleExtension/Context directory.
102+
103+ ## To do
104+
105+ * Add documentation
106+ * Add language support
107+
51108## Copyright
52109
53110Copyright (c) 2015 Dave Nash (knasher). See LICENSE for details.
0 commit comments