Using the Web Test Utility

treescattleSoftware and s/w Development

Nov 2, 2013 (4 years and 7 days ago)

99 views

Using the Web Test Utility

Section 1:

Introduction

W
eb

T
est is a

Windows command
-
line

utility that the
Concur
developer team created to
make it easier to test
our
OAuth client libraries as well as our endpoints. It provides several
benefits including

proper encoding
of credentials, proper signing of OAuth requests, basic
scripting capabilities and c
olor
-
coded re
sponses.

This utility currently runs on Windows and requires .Net Framework 3.5 to run.

Section 2:

Using Web Test

Web Test is a Windows command
-
line utility. To use it, y
ou specify the name of the EXE file
and optional command
-
line parameters. For example, if you wanted to simply fetch a web
page, without doing any authentication, you could type:

webtest
http://www.google.com

If you wa
nted to execute a Web Test script file, you would specify the path to the script file
like this:

webtest {path to script file}

To display other usage options and examples, you call the EXE with no command
-
line
parameters:

webtest

Section 3:

Creating
a

Web Test Script

A Web T
est script is a plain text file that represents a fully formed HTTP request.

You can
create the script file in the text editor of your choice.



T
he first line

of the script is
the HTTP request
line
, which includes the HTTP method,
URL and HTTP versi
on.



On the subsequent lines you can specify zero or more HTTP headers, such as
Authorization or Content
-
Type.



After the request line and optional headers, you must include a blank line, which
denotes the end of the header.



After the blank line, you can inc
lude the request body for POST & PUT requests.

The following shows a sample script that will POST an XML request to an endpoint that uses
HTTP Basic authorization:

POST
https://www.yourserver.com/
person HTTP/1.1

Authorization: Basic john:foobar


<person>


<first
-
name>John</first
-
name>


<last
-
name>Doe</last
-
name>

</person>

Section 4:

Using

HTTP BASIC Authorization

In the Authorization header, specify Basic followed by the user name, a colon, and the
pas
sword

in plain text
:

Authorization: Basic john:foobar

W
eb

T
est will encode the credentials and send the header to the server as
:


Authorization:
Basic am9objpmb29iYXI=

Section 5:

Using 2
-
Legged OAuth

In the Authorization header, specify OAuth followed by the consumer

key and consumer
secret for your partner application:

Authorization: OAuth
GqrEOmqRPfqe6NVbLfUA 3DHoEG9GXXdaHZpVGnRr6x4aigbhwy

W
eb

T
est will convert this to a full OAuth signature, including nonce, timestamp, signature,
etc.

Section 6:

Using 3
-
Legged OAuth

In the Au
thorization header, specify OAuth followed by the consumer key
,

consumer secret
,
access token and access token secret
:

Authorization:
OAuth

GqrEOmqRPfqe6NVbLfUA 3DHoEG9GXXdaHZpVGnRr6x4aigbhwy

0vaNY/sg96w82SPstFoPuvASA= 1w4oBXHcdUcuRPuxRfip2xpGs=

NOTE:

The keys
and secrets MUST be included on a single line. They are on separate lines
above for clarity.

Web T
est will convert this to a full OAuth signature, including token, nonce, timestamp,
signature, etc.

For more details about how to invoke specific endpoints, p
lease see the tutorials and API
documentation on
http://developer.concur.com
.