SOAP UI

Contents
Introduction
Creating a Test Suit in SOAP UI
Assertions in SOAP UI
XPath Match Assertion
Install SOAP UI in Linux
Related Articles

Introduction

О чём эта статья

В этой статье Вы узнаете о том что такое SOAP UI и увидите некоторые примеры использования.

Если Вам проще изучать материал от самого простого к более сложному - рекомендую сперва прочитать первые несколько страниц моего учебника здесь

SoapUI is an open-source web service testing application for service-oriented architectures (SOA) and representational state transfers (REST).

Its functionality covers web service inspection, invoking, development, simulation and mocking, functional testing, load and compliance testing.

A commercial version, SoapUI Pro, which mainly focuses on features designed to enhance productivity, was also developed by Eviware software.

In 2011, SmartBear Software acquired Eviware.

SoapUI was initially released to SourceForge in September 2005. It is free software, licensed under the terms of the European Union Public License.

Since the initial release, SoapUI has been downloaded more than 2,000,000 times.

It is built entirely on the Java platform, and uses Swing for the user interface. This means that SoapUI is cross-platform.

Today, SoapUI also supports IDEA, Eclipse, and NetBeans.

SoapUI can test SOAP and REST web services, JMS, AMF, as well as make any HTTP(S) and JDBC calls.

SOAP UI изображение с сайта www.eth1.ru

Как отправлять запросы

New REST Project Пишем URI Запрос создаётся, можно добавлять новые.

Method можно выбирать из выпадающего списка.

Проект имеет иерархическую структуру.

Project Service Resource Method Request

Названия отражают суть:

Request (запрос) это то место, где можно поменять тело запроса и просмотреть ответ сервера. Чтобы отправлять запросы нужно нажимать зелёный треугольник.

Method (метод) указывает GET, POST, PUT или другой метод, который Вы будете использовать. Все дочерние запросы будут иметь один и тот же Method.

Resourse (ресурс) отвечает за ту часть URL, которая добавляется к базовой.

Service (сервис) отвечает за базовую часть URL

Как сохранять проекты

Советую помимо использования «Save all projects» закрывать все новые окна вручную. Тогда SOAP UI предложит Вам сохранить каждый проект по отдельности.

После того, как все новые проекты сохранены, Вы можете закрыть SOAP UI. Я стараюсь закрывать SOAP UI только когда все окна закрыты.

Creating a Test Suit in SOAP UI

Shortly:

Right Click on your Project

Create New TestSuit (CTRL + T)

Specify name of TestSuit

Right Click on your TestSuit

New TestCase (CTRL + N)

Specify name of TestCase

Expand Test Case

Click on Test Steps

Add Step

Choose request (e.g. SOAP Request)

Specify name for new step

Select operation to invoke for request

Add Request to TestCase (OK)


Green «+» icon will appear. By clicking it you can add Assertions.

Подробно:

SOAP UI New Test Suite Правый клик Project изображение с сайта www.eth1.ru
Правый клик на названии проекта

Create New TestSuit (CTRL + T)

Specify name of TestSuite изображение с сайта www.eth1.ru
Укажите имя для TestSuit

Правый клик на TestSuit

New TestCase изображение с сайта www.eth1.ru
New TestCase (CTRL + N)
Specify name of TestCase изображение с сайта www.eth1.ru
Укажите имя для TestCase

Expand Test Case

Кликните на Test Steps

Add Step

Выберите request (e.g. SOAP Request)

Укажите имя для new step

Выберите операцию, которая запускает request

Добавьте Request в TestCase (OK)


Зелёная «+» иконка плюса появится наверху. Кликнув на неё Вы можете добавить Assertions.

Assertions в SOAP UI

Assertions are added to the TestSuits so to be able to add Assertions you need to create at least one TestSuit and click the green + sign.

SOAP UI assertion types изображение с сайта www.eth1.ru

Then you can choose one of the wide variety of available assertion types.

SOAP UI assertion typesизображение с сайта www.eth1.ru

Property Content → Contains

ChooseContains. With this assertion it will be possible to search for the existence of a string token in the property value. It supports regular expressions and is applicable to any property.

Specify unique name of Assertion

SOAP UI assertion types изображение с сайта www.eth1.ru

Type in content that you expect to receive in case of successfull request

Contains Assertion изображение с сайта www.eth1.ru

Property Content → Not Contains

Choose Not Contains. With this assertion it will be possible to search for the non-existence of a string token in the property value. It supports regular expressions and is applicable to any property.

Specify unique name of Assertion

SOAP UI assertion types изображение с сайта www.eth1.ru

ype in content that you definitely do not want to receive in the response

Contains Assertion изображение с сайта www.eth1.ru

Compliance, Status и Standards

SOAP Response

Choose SOAP Response. With this assertion you can check that the last received response is a valid SOAP Response. It is applicable only to SOAP TestRequest Steps only. Do not try to use it with REST.

Double click on the Assertion. It does not require any additional parameters and can be added to the test step only once.

SOAP Request assertion изображение с сайта www.eth1.ru

Compliance, Status и Standards

Valid HTTP Status Code

Choose Valid HTTP Status Code. With this assertion you can check that the last received response is a valid SOAP Response. It is applicable only to SOAP TestRequest Steps only. Do not try to use it with REST.

Valid HTTP Status Code assertion изображение с сайта www.eth1.ru

Type in the HTTP Status Codes that are appropriate for your request.

Usually it is 200 but you need to read system specification to be sure.

Valid HTTP Status Code assertion изображение с сайта www.eth1.ru

SLA → Response SLA

Choose Response SLA. With this assertion you can validate that the last received response time was within the defined limit. It is applicable to Script TestSteps And TestSteps that send requests and receive responses.

Response SLA assertion изображение с сайта www.eth1.ru

Specify the maximum response time (ms)

If response time is not mentioned in the spec add some reasonable time.

Укажите максимальное время ответа soap ui response assertion изображение с сайта www.eth1.ru

Property Content → XPath Match

Выберите XPath Match. Этот Assertion использует выражение типа XPath чтобы выбрать содержимое указанного объекта и сравнить результат с ожидаемым значением.

Может быть применён к любому объекту, который содержит XML.

Нажмите Declare

Чтобы подтвердить что нужные данные присутствуют в ответе напишите exists (//данные_которые_должны_придти)

В поле Expected Result напишите true.

Specify XPath expression and expected result изображение с сайта www.eth1.ru

Чтобы проверить не наличие как таковое, а значение какой-то величины введите в XPath Expression либо полный путь до величины либо её имя.

А само значение, которое Вы ожидаете получить введите в поле Expected Result.

Specify XPath expression and expected result изображение с сайта www.eth1.ru

В случае, если, например, мы не можем соединиться с сервером и все наши assertions зафейлились у них появятся красные индикаторы.

SOAP UI failed assertions изображение с сайта www.eth1.ru

Сервис-имитация

О том как создать сервис-имитацию (mock-service) вы можете прочитать в статье Mock Service

Нужен ли SOAP UI?

Ответ на этот вопрос зависит от уровня Вашей подготовки, предпочтений и, в каком-то смысле, идеологии.

Начинающему тестировщику SOAP UI пригодится хотя бы потому, что хранить и создавать запросы в нём прощё и быстрее чем другими способами.

Тестировщик с опытом программирования, например, на Python может написать все необходимые скрипты самостоятельно.

Идеологическим приверженцам работы из консоли или только из Linux тоже может показаться что в SOAP UI слишком много UI.

Установка SOAP UI в Linux

Обратите внимание на необходимость предварительной установки Java (JRE).

Как установить Java читайте здесь

Существует официальная инструкция, но если хотите сэкономить время и нервы…

Переходим на страницу загрузки.

Скачиваем установщик. Копируем в нужную директорию, например, в /opt. Распаковываем.

tar -zxvf SoapUI-5.4.0-linux-bin.tar.gz

Переходим в директорию SoapUI-5.4.0/bin

sh soapui.sh

Related Articles
Testing
Education
Lessons
API Testing
Automation
Theory
Mock Service with SOAP UI
List of open API
Banner Image

Search on this site

Subscribe to @aofeed channel for updates

Visit Channel

@aofeed

Feedbak and Questions in Telegram

@aofeedchat