SoapUI JUnit MockRunner Project

This application will bootstrap SoapUI Mock in its own classloader context to prevent clashes with any project dependencies that are under test. The mockrunner uses Plexus Classworlds/Container and Aether to decouple the execution of the mock from the projects under test.

Лицензия

Лицензия

Категории

Категории

JUnit Тестирование компонентов
Группа

Группа

io.fares.junit.soapui
Идентификатор

Идентификатор

soapui-junit-mockrunner-project
Последняя версия

Последняя версия

0.0.3
Дата

Дата

Тип

Тип

pom
Описание

Описание

SoapUI JUnit MockRunner Project
This application will bootstrap SoapUI Mock in its own classloader context to prevent clashes with any project dependencies that are under test. The mockrunner uses Plexus Classworlds/Container and Aether to decouple the execution of the mock from the projects under test.
Ссылка на сайт

Ссылка на сайт

https://github.com/bertramn/soapui-junit-mockrunner
Система контроля версий

Система контроля версий

https://github.com/bertramn/soapui-junit-mockrunner.git

Скачать soapui-junit-mockrunner-project

Имя Файла Размер
soapui-junit-mockrunner-project-0.0.3.pom 14 KB
Обзор

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/io.fares.junit.soapui/soapui-junit-mockrunner-project/ -->
<dependency>
    <groupId>io.fares.junit.soapui</groupId>
    <artifactId>soapui-junit-mockrunner-project</artifactId>
    <version>0.0.3</version>
    <type>pom</type>
</dependency>
// https://jarcasting.com/artifacts/io.fares.junit.soapui/soapui-junit-mockrunner-project/
implementation 'io.fares.junit.soapui:soapui-junit-mockrunner-project:0.0.3'
// https://jarcasting.com/artifacts/io.fares.junit.soapui/soapui-junit-mockrunner-project/
implementation ("io.fares.junit.soapui:soapui-junit-mockrunner-project:0.0.3")
'io.fares.junit.soapui:soapui-junit-mockrunner-project:pom:0.0.3'
<dependency org="io.fares.junit.soapui" name="soapui-junit-mockrunner-project" rev="0.0.3">
  <artifact name="soapui-junit-mockrunner-project" type="pom" />
</dependency>
@Grapes(
@Grab(group='io.fares.junit.soapui', module='soapui-junit-mockrunner-project', version='0.0.3')
)
libraryDependencies += "io.fares.junit.soapui" % "soapui-junit-mockrunner-project" % "0.0.3"
[io.fares.junit.soapui/soapui-junit-mockrunner-project "0.0.3"]

Зависимости

Библиотека не имеет зависимостей. Это самодостаточное приложение, которое не зависит ни от каких других библиотек.

Модули Проекта

  • soapui-junit-mockrunner
  • soapui-junit-mockrunner-tests

SoapUI JUnit MockRunner

Overview

Ever tried to start a soapui mock service from within your junit test? Sure the soapui-maven-plugin make a good job when you just run from command line ... but if you develop in an IDE that is not always the case.

This module can be used to execute a soapui mock service within a classloader jail. This will ensure the project under test is not dependent on SoapUI itself. The classloader jail will resolve all required dependencies from the official soapui maven repository.

Example

The most simple example on how to fire up a Junit test with a SoapUI mock service running in the background.

import static org.junit.Assert.*;
import org.junit.ClassRule;
import org.junit.Test;

public class SomeMockServiceTest {

  @ClassRule
  public static SoapUIMockRunner runner = new SoapUIMockRunner()
                                                  .simpleBinding()
                                                  .withProjectPath("embedded-soapui/TestSoapUIProject-soapui-project.xml")
                                                  .withMockServiceName("WeatherMockService")
                                                  .withMockHost("localhost")
                                                  .withMockPort(8097)
                                                  .withMockPath("/weather-change");

  @Test
  public void testMockRunner() throws Exception {
    assertTrue(runner.isRunning());
    System.out.println("do some testing against endpoint: " + runner.getMockEndpoint());
  }

}

Configure SoapUI Version

Because the soapui starts in a classloader jail, one can also a) compile this libary against a different version:

mvn clean install -Dsoapui.version=5.1.2

or if the compiled version of soapui-junit-mockrunner is largely compatible with what you are trying to run, simply specify the version on the SoapUIMockRunner:

new SoapUIMockRunner()
        .simpleBinding()
        .withProjectPath("embedded-soapui/TestSoapUIProject-soapui-project.xml")
        .withMockServiceName("WeatherMockService")
        .soapuiVersion("5.1.2");

The option is risky when you specify a runner version that is incompatible with the soapui classes that are loaded.

I sucessfully ran a soapui-junit-mockrunner compiled against SoapUI 5.0.0 using a 5.1.2 runtime version (as above example).

TODO

Instead of the dodgy simple binding, should really use com.eviware.soapui.tools.SoapUIMockServiceRunner.main() with a set of standard SoapUI path parameters.

Limitiations

  1. the reflection binding does not work with path, port and host settings (use simple binding)
  2. searching for the local maven repo for cached artefact bindings is rather crude
  3. need to improve exception handing, especially with the rule
  4. not enough tests and examples

Версии библиотеки

Версия
0.0.3
0.0.2