Thursday, 29 June 2017

Run SOAPUI project via gradle command.

1. Create a SOAPUI project and save it as xml file
2. install gradle and set path for the same
3.  install eclipse
4. install gradle add on over eclipse ( via eclipse market place)
5. create a gradle project
6. open build.gradle and paste below code

/*
 * This build file was generated by the Gradle 'init' task.
 *
 * This generated file contains a sample Java Library project to get you started.
 * For more details take a look at the Java Libraries chapter in the Gradle
 * user guide available at https://docs.gradle.org/3.5/userguide/java_library_plugin.html
 */

// Apply the java-library plugin to add support for Java Library
apply plugin: 'java-library'


// In this section you declare where to find the dependencies of your project
repositories {
    // Use jcenter for resolving your dependencies.
    // You can declare any Maven/Ivy/file repository here.
    jcenter()
}


dependencies {
    // This dependency is exported to consumers, that is to say found on their compile classpath.
    api 'org.apache.commons:commons-math3:3.6.1'

    // This dependency is used internally, and not exposed to consumers on their own compile classpath.
    implementation 'com.google.guava:guava:21.0'

    // Use JUnit test framework
    testImplementation 'junit:junit:4.12'
}


public class SoapUITask extends Exec  {
String soapUIExecutable = 'C:/Program Files (x86)/SmartBear/SoapUI-5.3.0/bin/testrunner.bat'
   String soapUIArgs = ''

   public SoapUITask(){
       super()
       this.setExecutable(soapUIExecutable)
   }

   public void setSoapUIArgs(String soapUIArgs) {
       this.args = "$soapUIArgs".trim().split(" ") as List
   }

}



 // execute SOAPUI
task executeSOAPUI(type: SoapUITask){
    soapUIArgs = '"G:/testsoap-soapui-project.xml"'
}




** Replace couple of path in the above code/

open command window @ build.gradle location
>gradle executeSOAPUI


Thats all.

No comments:

Post a Comment