ВУЗ: Не указан

Категория: Не указан

Дисциплина: Не указана

Добавлен: 17.04.2021

Просмотров: 1376

Скачиваний: 2

ВНИМАНИЕ! Если данный файл нарушает Ваши авторские права, то обязательно сообщите нам.
background image

46

SoapUI 

Pro

by 

SMART

BEAR

Workspaces

SoapUI uses workspaces6 where you do all your work. A workspace 
contains all your current projects. This means that you can work on 
more than one project in the same SoapUI session. When you want 
to change to another project either add it to the current workspace or 
switch to another workspace.

Workspaces can be shared in the team. I am not sure that sharing the 
workspaces are the best idea though. Sharing workspaces will force 
everyone to work with the same set of projects all the time. This may not 
suit how you do the work.

Version control

Storing your projects in a version control system is considered the best 
practice. It will enable you to go back to a known version. It will make it 
easier to share files with other testers.

Why

A shared resource on a file system is a fragile way to share your work. 
People can overwrite files that another person is working on and 
changes can easily get lost. File history is hard to keep track of. Track-
ing who made which changes to the project is not possible. Therefore, 
sharing files through a version control system is often used in develop-
ment projects.

The tests you have created with SoapUI have a significant value and 
should be protected as much as possible. Storing them in a version 
control system is therefore something you’ll want to do.

What

What should be stored then? Your workspace may or may not be 
interesting for other testers. The workspace reflects how you personally 

6 http://www.soapui.org/Working-with-soapUI/managing-workspaces.html


background image

47

SoapUI 

Pro

by 

SMART

BEAR

group different projects. Sharing them with the other testers is some-
thing you need to discuss and then decide upon.

You should store your project files. They are the most important out-
come from your testing work. They should be used and maintained for 
all testers in your team.

SoapUI Pro support saves the project as a composite. This means that 
each part of the project will be saved in separate files instead of sav-
ing the entire project in the same file. This doesn’t have any impact on 
anything more than the possibility to cooperate and allow more then one 
person to work on the same project. But cooperating and sharing is the 
key to scalability. One person can only do so much; two persons can do 
a lot more.

Combining composite projects and storing them in a version control 
system allows the testing effort to scale and more tests can be created 
and maintained, compared to not using composite projects.

How

There are many different version control systems. Some of them are 
large enterprise solutions, others are open source and freely available. 
They all solve the same business problem by providing a single reposi-
tory for your files and versioning the changes.

Open source or an enterprise system?

This is a question that depends a lot on the organization you work with. 
Some organizations want to buy tools, others support open source tools 
and just buy the support they need when they need it.

Open source solutions are used to store some very high profile systems. 
The Linux kernel, for example, is stored using an open source version 
control system called Git. SoapUI is also version-controlled using Git.


background image

48

SoapUI 

Pro

by 

SMART

BEAR

Automation

Automated testing is an area where many companies put in a lot of 
effort. They want to eliminate the mundane, expensive and manual test-
ing that used to be the only way you could verify a system. They also 
want the developers to get fast feedback as soon as they have done a 
change to a system.

How can SoapUI be used for test automation? The trick is to execute 
test suites developed using SoapUI, without using the user interface of 
SoapUI, and instead trigger it from some kind of automation build tool. 
There are many different tools that could trigger the execution. Most of 
them have in common that they are good at triggering anything from a 
command line prompt. This could be a bat script in Windows, a shell 
script in Unix, or it could be Maven project in a Java build environment.

Run SoapUI test suites without SoapUI

The first example will show how SoapUI can be executed from a com-
mand line. The second example will show how Maven can be used to 
run SoapUI.

Command line

Command line tools are good if you want to be able to execute some-
thing from a script that you have created yourself. SoapUI has support 
for executing from a command line.

Execute it like this:

testrunner project_file

where project_file is a SoapUI project file that could look like this c:\
projects\my-soapui-project.xml if you are on Windows.

The command line tool takes a lot of parameters that will allow you to 
control the execution. They are described at the SoapUI Web site.7

7 http://www.soapui.org/Test-Automation/functional-tests.html


background image

49

SoapUI 

Pro

by 

SMART

BEAR

It turns out that it is actually the command line tool that is used when a 
test is executed from the TestRunner. If you want help with running the 
exact same execution from a command line that you executed from the 
TestRunner, then try this:

¿

Execute the test you want from the test runner.

¿

Scroll back in the execution log until you find the launch of the 
test runner in the beginning of the log.

¿

Copy the command and use it in your own script or from a 
command line.

Maven

Maven is a popular build tool for building Java. Running a SoapUI test 
from Maven is similar to running it from a command line. The difference 
is that you need to set up a Maven project and then use Maven. This 
is a good alternative if Maven is already building the rest of the project. 
Many Java projects are using Maven. Let’s set up a Maven project that 
will run SoapUI.

Maven is very good at handling dependencies. There are repositories 
on the Internet where dependencies that could be used in a Maven proj-
ect are stored. When Maven realizes that it doesn’t have a local copy, 
it will download the resources it misses. This is a feature we can use 
when retrieving the SoapUI plugin.

Maven uses a file called pom.xml for all settings. We need to extend an 
existing pom file for your project or create a new one. Going through all 
the details for a Maven project is out of scope here. I will just focus on 
the parts that are SoapUI specific and leave the rest of the details to be 
explained by other resources8 9 on the Internet.

8 http://maven.apache.org/

9 http://thomassundberg.wordpress.com/2013/02/24/maven-the-simplest-possi-

ble-introduction/


background image

50

SoapUI 

Pro

by 

SMART

BEAR

The SoapUI specific things that must be added to a pom are

¿

Specify a repository where the SoapUI plugin can be found

¿

Add and configure a plugin that will execute the test

Add a repository for SoapUI

The SoapUI plugin for Maven must be found and downloaded. It lives in 
a repository that must be specified specifically. Add this to your pom:

<pluginRepositories>
    <pluginRepository>
        <id>eviwarePluginRepository</id>
        <url>http://www.soapui.org/repository/maven2/</url>
    </pluginRepository>
</pluginRepositories>

The value of the id tag could be set to almost anything, as long as it is 
unique. A descriptive name is, as always, preferable.

Now that we can locate the SoapUI plugin, let’s continue with adding 
and configuring it.

Add and configure the SoapUI plugin

Add the following snippet to the build section of your pom:

<plugins>
    <plugin>
        <groupId>eviware</groupId>
        <artifactId>maven-soapui-plugin</artifactId>
        <version>4.5.1</version>
        <configuration>