willis7 / soapui-gradle-plugin

SoapUI Gradle Plugin
MIT License
14 stars 14 forks source link

new tasks only available when project.xml given #1

Closed willis7 closed 6 years ago

willis7 commented 10 years ago

When the 'soapui' plugin is applied to the project, tasks should only be available once the project.xml is provided. This will avoid the need to throw an exception later on.

sumangongali commented 8 years ago

Hi , I want to drive the build.gradle to multiple project files with for each project file has a list of properties, I tried my self hard , like applying the below code could you please assist me how to achieve that .

original soapui test extension object

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 }

}

i tried the following. drive through the below map , map contains projectFilename as key and list of test suites as value

def map = [ 'project1':['assertProject.xml',['A','B','C']],'project2':['assertProject.xml',['A','B','C']],'project3':['assertProject.xml',['A','B','C']] ]

soapui {

map.count{ mit-> test {myit->

    projectFile = 'src/${myit.key}'        
    testSuite = ${myit.value}      
    printReport = true
    junitReport = true
    outputFolder = 'out'
    globalProperties = 'ServiceEndpoint=localhost:7201'
    endpoint = 'http://localhost:7201'
    testFailIgnore =true
}
}
}
willis7 commented 8 years ago

@sumangongali I have created a new ticket to track this activity. Please see #14 for the solution.

sumangongali commented 8 years ago

HI Wills,

I appreciate and Thank you for your quick response.

One small thing is still missed. the above new task still driving a different test suites from a single soap ui project .. What we requested is, that we have different wsdls or rest services which are independent soapui projects each project has different suites . right now a build file can be written for single soapui project with multiple suites , but is it possible to have multiple same tasks where each task takes different soapui projects and corresponding testsuites in it.

Once again i really want to thank your efforts.

Regards, Suman.

sumangongali commented 8 years ago

Also To bring to your notice "https://github.com/creising/soapui-plugin-example-" which is built on top this build . but what i found different from yours code is, it is using testsuite list as convention , you can see an example below

https://github.com/creising/soapui-plugin-example-/blob/master/build.gradle

In real time basically the the list of project.xml would stay in a folder and we as a team has a requirement to drive every project.xml with its list of testsuites

eg: under resource folder we have some thing like this

Project1.xml has suites ['Asuite','Bsuite'...'Nsuite'] Project2.xml has suites ['Dsuite','Esuite'...'Nsuite']

at a go we want to drive all projects and suites.

I know very little gradle, very hard to get the flow and how it works Since you have developed lot of code already , it would be nice that we can add more value to it.

Thanks, Suman.

willis7 commented 8 years ago

Hi Suman,

Thanks for your interest in the project. I think I understand what you want to do now. Here's a workaround which should help you:

ext {
    projects = ["projectA", "projectB"]
    suites = ["suiteA", "suiteB", "suiteC"]
}

soapui {
    test {
        printReport = true
        junitReport = true
    }
}

projects.each { project ->
  suites.each { suite ->
    task "${project}${suite}Test"(type: TestTask) {
      projectFile = "${project}.xml"
      testSuite = "${suite}"
    }
  }
}

Note\ I've not tested the above with the plugin, but it should work.

Here we are programatically adding tasks based on the 2 lists; projects and suites. I will create a feature request to add the functionality you desire to the plugin officially.

sumangongali commented 8 years ago

Hi Williams,

Thank you very much for the code provided.

In the above code there is no mapping like suites- project i.e., SuiteA,SuiteB belongs to ProjectA and suiteC belongs to ProjectB then I feel the code wouldn't work.

projects = ["projectA", "projectB"] suites = ["suiteA", "suiteB", "suiteC"]

in the driver code projects.each is driving all the suites for all the projects. i hope that will not be the case.

Also i have another utility, called soapui report generation in HTML as ant file which will generate good soupui html reports, we can add them as a feature to our plugin since gradle ant references are easy to do.

I have attached report utility for your reference.

the attachment zip contains a build.xml which points to soapui reports directory and it creates a junit html report using xsl file. this is what most of the users look for ..we can advertise this for large audions, and most of the enterprise api testing are looking for this feature to integrate with jenkins.

Regards,

Suman.

sumangongali commented 8 years ago

Unfortunately , after i tested, what i found is

FAILURE: Build failed with an exception.

BUILD FAILED

Total time: 10.519 secs Stopped 0 compiler daemon(s).

sumangongali commented 8 years ago

I Hope Test task code has some bug it seems.

Regards, Suman.

willis7 commented 8 years ago

The workaround I offered does expect there are suites of the same name in each of the projects. If that is not the case then you will need to write a Gradle task per project and suite. For example:

soapui {
    test {
        printReport = true
        junitReport = true
    }
}

task testASuiteA(type: TestTask) {
    projectFile = 'sample-soapui-projectA.xml'
    testSuite = 'SuiteA'
}

task testASuiteB(type: TestTask) {
    projectFile = 'sample-soapui-projectA.xml'
    testSuite = 'SuiteB'
}

task testBSuiteA(type: TestTask) {
    projectFile = 'sample-soapui-projectB.xml'
    testSuite = 'SuiteA'
}

task testBSuiteB(type: TestTask) {
    projectFile = 'sample-soapui-projectB.xml'
    testSuite = 'SuiteB'
}
sumangongali commented 8 years ago

I have got it on the intial one

we need to import the class in order to work you first workarround

import io.byteshifter.plugins.soapui.tasks.TestTask

On Tue, Mar 15, 2016 at 11:44 PM, Sion Williams notifications@github.com wrote:

The workaround I offered does expect there are suites of the same name in each of the projects. If that is not the case then you will need to write a Gradle task per project and suite. For example:

soapui { test { printReport = true junitReport = true } }

task testASuiteA(type: TestTask) { projectFile = 'sample-soapui-projectA.xml' testSuite = 'SuiteA' }

task testASuiteB(type: TestTask) { projectFile = 'sample-soapui-projectA.xml' testSuite = 'SuiteB' }

task testBSuiteA(type: TestTask) { projectFile = 'sample-soapui-projectB.xml' testSuite = 'SuiteA' }

task testBSuiteB(type: TestTask) { projectFile = 'sample-soapui-projectB.xml' testSuite = 'SuiteB' }

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/byte-shifter-ltd/soapui-gradle-plugin/issues/1#issuecomment-196956212

Regards, -Suman

willis7 commented 8 years ago

You shouldn't need to do that if you have apply plugin: 'io.byteshifter.soapui'

sumangongali commented 8 years ago

could you please help me why the below is not working , just in the place of list i placed map

ext { projects = ["A", "B","C"] suites = ["A", "B", "C"] map = [ 'project1':['assertProject1',['A','B','C']],'project2':['ProjectABC',['D','E','F']],'project3':['ProjectXYZ',['Y','X','N']] ] }

map.each {

project->

println "${project.key} has ${project.value.first()} --- ${project.value.getAt(1)}---${project.value.first()}.xml"

task "${project.value.first()}Test" (type: TestTask) {

     projectFile = "${project.value.first()}.xml"
     testSuite =  ${project.value.getAt(1)}

     //.toList
}

}

On Tue, Mar 15, 2016 at 11:50 PM, Suman Reddyg gsuman2009@gmail.com wrote:

I have got it on the intial one

we need to import the class in order to work you first workarround

import io.byteshifter.plugins.soapui.tasks.TestTask

On Tue, Mar 15, 2016 at 11:44 PM, Sion Williams notifications@github.com wrote:

The workaround I offered does expect there are suites of the same name in each of the projects. If that is not the case then you will need to write a Gradle task per project and suite. For example:

soapui { test { printReport = true junitReport = true } }

task testASuiteA(type: TestTask) { projectFile = 'sample-soapui-projectA.xml' testSuite = 'SuiteA' }

task testASuiteB(type: TestTask) { projectFile = 'sample-soapui-projectA.xml' testSuite = 'SuiteB' }

task testBSuiteA(type: TestTask) { projectFile = 'sample-soapui-projectB.xml' testSuite = 'SuiteA' }

task testBSuiteB(type: TestTask) { projectFile = 'sample-soapui-projectB.xml' testSuite = 'SuiteB' }

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/byte-shifter-ltd/soapui-gradle-plugin/issues/1#issuecomment-196956212

Regards, -Suman

Regards, -Suman

sumangongali commented 8 years ago

for answer to this

"You shouldn't need to do that if you have apply plugin: 'io.byteshifter.soapui'"

yes I did it, but still i was forced to import, otherwise the above error it gave me.

aucasal commented 8 years ago

Hi guys,

I am also trying to specify a new project file and after following the examples given above, I am unable to set the projectFile property.

it picks up the testSuite but not the projectFile proerty.

Has anyone been able to get it working? I can see on the TestTask class, the projectFile property is set up differently from the others.. i. e. :

    SoapUITestCaseRunner runner = new MySoapUITestCaseRunner(
            'soapUI ' + SoapUI.SOAPUI_VERSION + ' Gradle TestCase Runner')
    runner.setProjectFile( getProjectFile() )

    if ( getEndpoint() ) {
        runner.endpoint = getEndpoint()
        logger.debug "Runner endpoint: " + getEndpoint()
    }

Not sure if that matters

willis7 commented 8 years ago

Guys, unfortunately I no longer have the time to maintain this project. This was a really challenging project because of the mess around project dependencies, and this has been made worse recently with a migration to a new provider. If you would like to help maintain this project I would be more than happy to take your pull requests.

daggerok commented 7 years ago

hi all,

@sumangongali, @aucasal, @XN137 and @vbossica, please, let me know what actually from that thread is still valuable for you. Otherwise, I'm going to close that issue as 'not needed'. Thanks.


BR, Max

daggerok commented 6 years ago

no one answer from July. Closing this issue as not needed.