t.jspringbot-http.1.5.5.source-code.libdoc.intro Maven / Gradle / Ivy
A test library for web services and rest ful api. This library is integrated with {{jspringbot-doc:xml}} and {{jspringbot-doc:json}} for handling xml and json contents.
Please see the example {{HTTP Library}} project.
{{jspringbot-github:sample-http|Sample Project}}
= Configuration =
Configure the following to use jspringbot-http.
1. Add this artifact in maven dependency
|
|
| org.jspringbot
| jspringbot-http
|
|
2. Import spring-http in {{jspringbot-global.xml}}
To add support for {{jspringbot-doc:http}}, add this in {{jspringbot-global.xml}}.
|
To add support for {{jspringbot-doc:xml}}, add this in {{jspringbot-global.xml}}.
|
To add support for {{jspringbot-doc:json}}, add this in {{jspringbot-global.xml}}.
|
To add support for both {{jspringbot-doc:xml}} and {{jspringbot:-doc:json}}. add this in {{jspringbot-global.xml}}.
|
4. A {{jspringbot.properties}} file should exist in src/test/resources. See the possible properties below.
| *Key* | *Default Value* | *Description* |
| {{http.allow.untrusted}} | {{true}} | Defines whether to allow untrusted sites or not. |
| {{http.max.connection.per.route}} | {{5}} | Defines the number of maximum connections per domain or site. |
| {{http.max.connection.total}} | {{10}} | Defines the total number of maximum connections. |
| {{http.socket.linger}} | {{-1}} | Defines the {{SO_LINGER}} with the specified linger time in seconds. |
| {{http.socket.buffer-size}} | {{8192}} | Defines the size of the internal socket buffer used while receiving / transmitting HTTP messages. |
| {{http.tcp.nodelay}} | {{true}} | Defines whether Nagle's algorithm is to be used. |
| {{http.allow.circular.redirect}} | {{true}} | Defines whether circular redirects (redirects to the same location) should be allowed. |
| {{http.handle.redirects}} | {{true}} | Defines whether redirects should be handled automatically |
| {{http.start.suite.new.session}} | {{false}} | This determines if new session will be created on every start of test suite. |
| {{http.start.test.new.session}} | {{false}} | This determines if new session will be created on every start of test case. |
| {{http.connection.timeout}} | 5000 | Determines the timeout until a connection is etablished. |
| {{http.socket.timeout}} | 10000 | Defines the default socket timeout (SO_TIMEOUT) in milliseconds which is the timeout for waiting for data. |
= Sample Usage =
| `New HTTP Session` |
| `Create HTTP Get Request` | |
| `Set HTTP Basic Authentication` | | |
| `Add HTTP Request Header` | Accept | application/xml |
| `Add HTTP Request Parameter` | | |
| `Invoke HTTP Request` |
| `HTTP Response Status Code Should Be Equal To` | 200 |
| `HTTP Response Should Be XML` |
= HTTP Headers =
Please see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html for list of HTTP Header Field Definitions.
5. Add {{JSpringBotGlobal}} library in the in the test suite settings.
| *** Settings *** |
| Library | JSpringBotGlobal |