Forum Discussion

autoscout24's avatar
autoscout24
Contributor
14 years ago

Continous Integration - Teamcity- SoapUI Pro plug in

Hi guys,

Can you please provide us some idea of integrating the soapUI pro test in teamCity ?

Regards
Vijay
  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi Vijay,

    you should be able to call either the command-line tools from TeamCity, or just use the soapUI maven plugin and create a standard maven build configuration (although I don't know about the specifics..)

    regards!

    /Ole
    SmartBear Software
    • SmartUI's avatar
      SmartUI
      Occasional Visitor

      hi,

       

      i am looking for the complete procedure about how to integrate SOAPUI and teamcity over windows system.

      system :-

       - windows 7

       - SOAPUI 

       - Teamcity 8

       

      Expectation:

      1. CI executes SOAPUI job/tests and determines if build is 'green' based on test results

       

      Please help me with the setup and execution process.

       

      Thanks in advance.

      • nmrao's avatar
        nmrao
        Champion Level 3

        1. Not sure why did you put the query on the 4 years back topic.
        2. Avoid cross posts, read forum rules.
        3. Open a new topic.

        4. It would help to better understand and look for solution if you provide as much details as possible.

  • Hi,
    We are running the tests in test suite level with Team city. The results generated is not sufficient for the failed test case. I would be more helpful. if you guys modify the script below, which is available in website(http://www.soapui.org/Scripting-Propert ... ricks.html)

    for ( testCaseResult in runner.results )
    {
    testCaseName = testCaseResult.getTestCase().name
    log.info testCaseName
    if ( testCaseResult.getStatus().toString() == 'FAILED' )
    {
    log.info "$testCaseName has failed"
    for ( testStepResult in testCaseResult.getResults() )
    {
    testStepResult.messages.each() { msg -> log.info msg }
    }
    }
    }


    in such way which gives raw request data, response data, response time, etc. all available data of the failed test and store in external file in junit format....so that we can ask the Teamcity to look for this file for results.


    thank you

    regards
    Vijay
  • Hi Guys,

    I modied the code and using it like below.

    import com.eviware.soapui.report.JUnitReport;

    def sTestRunCountry = "DE";
    def sTestSuite = "Smoketext"
    def testSuiteResultLocation ="c:\\temp\\"

    def resultLocation = String.format("%s%s_%s.xml", testSuiteResultLocation, sTestRunCountry, sTestSuite);

    JUnitReport report = new JUnitReport();
    for ( testCaseResult in runner.results )
    {
    testCaseName = testCaseResult.getTestCase().name
    double time = testCaseResult.timeTaken;
    if ( testCaseResult.getStatus().toString() == 'FAILED' )
    {
    def results = new ArrayList();
    def result;
    for ( testStepResult in testCaseResult.getResults() )
    {
    if (testStepResult.toString().indexOf("Request") != -1)
    {
    def request = testStepResult.testStep.getProperty("rawrequest").getValue()
    def response = testStepResult.testStep.getProperty("response").getValue()
    result = "TestStep < " + testStepResult.testStep.name + " > finished with status < " + testStepResult.status + " > Time Taken ::< " + testStepResult.timeTaken + " > ms " + "\n\n" + "----------------------------"+ testStepResult.testStep.name + " Request Message-----------------------" + "\n\n" + request +"\n\n" + "----------------------------" + testStepResult.testStep.name +" Response Message-----------------------" +"\n\n"+ response + "\n\n" + "----------------------------"+ testStepResult.testStep.name + " Assertions-----------------------" +"\n\n"+ testStepResult.messages;
    }
    else
    {
    result = "TestStep < " + testStepResult.testStep.name + " > finished with status < " + testStepResult.status + " > Time Taken ::< " + testStepResult.timeTaken + " > ms " +"\n\n"+ testStepResult.messages;
    }
    results.add(result);
    }
    report.addTestCaseWithFailure(testCaseName, time, testCaseResult.getStatus().toString(), results.toString())
    }
    else
    {
    report.addTestCase(testCaseName, time)
    }
    }
    report.save( new File( resultLocation ))


    I want to keep this script in the script library for testSuite Tear down.

    Please give the me some suggestion how this 'runner.results' can be declared has input parameter of the script library method . Optimisation of the above is highly appreciated.

    Thank you

    Regards
    Vijay
  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    I want to keep this script in the script library for testSuite Tear down.

    Please give the me some suggestion how this 'runner.results' can be declared has input parameter of the script library method . Optimisation of the above is highly appreciated.

    Sorry, what do you mean? Do you want to refactor your script into a method in your script library, that takes runner.result as a parameter?

    Regards

    Henrik
    SmartBear Software
  • Hi ,

    Sorry for not making it clear.

    Yes, That is what I want :-)

    Regards
    VJ
  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Ok, then it should only be a matter of making your script into a method and putting it in a file in the soapUI Pro/scripts folder.

    How to use the script library:
    [link]

    How the file could look:
    import com.eviware.soapui.report.JUnitReport;

    def sTestRunCountry = "DE";
    def sTestSuite = "Smoketext"
    def testSuiteResultLocation ="c:\\temp\\"

    def resultLocation = String.format("%s%s_%s.xml", testSuiteResultLocation, sTestRunCountry, sTestSuite);


    def generateCustomReport( resultsFromRunner )
    {
    JUnitReport report = new JUnitReport();
    for ( testCaseResult in resultsFromRunner )
    {
    testCaseName = testCaseResult.getTestCase().name
    double time = testCaseResult.timeTaken;
    if ( testCaseResult.getStatus().toString() == 'FAILED' )
    {
    def results = new ArrayList();
    def result;
    for ( testStepResult in testCaseResult.getResults() )
    {
    if (testStepResult.toString().indexOf("Request") != -1)
    {
    def request = testStepResult.testStep.getProperty("rawrequest").getValue()
    def response = testStepResult.testStep.getProperty("response").getValue()
    result = "TestStep < " + testStepResult.testStep.name + " > finished with status < " + testStepResult.status + " > Time Taken ::< " + testStepResult.timeTaken + " > ms " + "\n\n" + "----------------------------"+ testStepResult.testStep.name + " Request Message-----------------------" + "\n\n" + request +"\n\n" + "----------------------------" + testStepResult.testStep.name +" Response Message-----------------------" +"\n\n"+ response + "\n\n" + "----------------------------"+ testStepResult.testStep.name + " Assertions-----------------------" +"\n\n"+ testStepResult.messages;
    }
    else
    {
    result = "TestStep < " + testStepResult.testStep.name + " > finished with status < " + testStepResult.status + " > Time Taken ::< " + testStepResult.timeTaken + " > ms " +"\n\n"+ testStepResult.messages;
    }
    results.add(result);
    }
    report.addTestCaseWithFailure(testCaseName, time, testCaseResult.getStatus().toString(), results.toString())
    }
    else
    {
    report.addTestCase(testCaseName, time)
    }
    }
    report.save( new File( resultLocation ))
    }


    regards

    Henrik
    SmartBear Software