How to drive a plug in task for multiple values


(gongali) #1

I have a build.gradle file in which i want to drive “test” block for multiple values , I want to drive it for multiple project files, here i cannot extend the plugin , but i want to write block of code in the same file as ‘testtask’ which drive multiple times the “test”

test {
projectFile = ‘src/ABC.xml’
testSuite = [ ‘INTEGRATION_SUITE’]
printReport = true
junitReport = true
outputFolder = ‘out’
globalProperties = ‘ServiceEndpoint=localhost:7201’
endpoint = ‘http://localhost:7201
testFailIgnore =true
}

build.gradle :

apply plugin: “org.urbanbyte.soapui”
apply plugin: “java”

buildscript {
System.setProperty(‘http.proxyHost’,’www-proxy.us.oracle.com’)

repositories {
maven {
url “https://plugins.gradle.org/m2/”
}
mavenCentral()
maven { url ‘http://smartbearsoftware.com/repository/maven2/’ }
flatDir {
dirs ‘libs’
}
jcenter()
jcenter {
url “http://jcenter.bintray.com/”
}
}
dependencies {
classpath “gradle.plugin.org.urbanbyte:soapui-gradle-plugin:0.4.3″
classpath fileTree(dir: ‘libs’, include: ‘*.jar’)
}
}

soapui {
test {
projectFile = ‘src/ABC.xml’
testSuite = [ ‘INTEGRATION_SUITE’]
printReport = true
junitReport = true
outputFolder = ‘out’
globalProperties = ‘ServiceEndpoint=localhost:7201’
endpoint = ‘http://localhost:7201
testFailIgnore =true
}
load {
projectFile = ‘src/test/resources/loadtest2.xml’
testSuite = ‘loadtest’
testCase = ‘loadtest1’
loadTest = ‘loadtest’
outputFolder = ‘out’
printReport = true
threadCount = 5
limit = 60
endpoint = ‘http://localhost:7201
}
tool {
projectFile = ‘src/test/resources/rest.xml’

}
mock{
projectFile = ‘src/test/resources/mockservice2.xml’
}
}

===========Build file ends============


(Benjamin Muschko) #2

Every unique task can only be executed just once per build execution. If you want to execute the tests multiple times, you’d have to create multiple tasks of type Test and then hook them into the build lifecycle. Something along the lines of the following pseudo code.

task testProject1(type: Test) {
    // configure task
}

task testProject2(type: Test) {
    // configure task
}

check.dependsOn testProject1, testProject2