marți, 19 aprilie 2011

SOAPUI testcases automatization

SOAPUI allows automatization of test.

It organizes as: TestSuite having TestCases having TestSteps. In TestSteps it can have among others: Properties, SoapRequests and TransferProperties.

Properties can be set also by using a text file. They are used like: ${username} in SoapRequests.

On SoapRequests can be added Assertions (verifications on expected results). Notice "Contains" and "Not Contains" ones.

TransferProperties allow to transfer values from one place to another, eg: get values from one test case response and use them in other test case request.

They consist of:

-source definition - from where to get value

-target definition - where to store it

-usage - see Note 1).

How to

Example of using SessionId in different requests:

-create a project from a wsdl, eg Soaptopupsuite53480.wsdl

-generate the TestSuite for all requests with 1 TestCase for each request

-double click on openSession Test Case

-add TestSteps: one of type Properties before the Test Step of type (Soap)Request and one of type PropertyTransfer after it (they can have any name)

-create a text file lines:


-edit TestStep of type Properties and load it from file.

-edit TestStep of type PropertyTransfer and set as in Note 1).

-edit SoapRequest as:


-Add an Assertion of type "Contains" set to "sessionId"

-run the TestCase (not the TestStep)

-notice in TestSuite (!) property used for Transfer that the value is set with a session id.

-open TestCase setSubscriberInfo

-edit the TestStep of type (soap)Request

- fill like: ${#TestSuite#pt_sessionID}

- fill it with the other needed values

-run the TestCase - it runs successfully.








1)TransferPropertis example:

-add place where to store the value of property

-- click on Test Case - on left botton appear 2 tabs

-- click on Test Properties

-- add a name, eg pt_sessionID - nothing set to Value (we'll set at runtime)

-source definition:

Source: OpenSession request - property Response - field: declare namespace soapns='';
//soapns:openSessionResponse[1]/session[1]/sessionId[1] (note: in SoapUI free need to manually edit)

for response:


-target definition:

Target: TestCase - property -the above property name, eg pt_sessionID

-usage : ${#TestSuite#pt_sessionID} (#TestSuite# is a predefined variable)

Niciun comentariu:

Trimiteți un comentariu