tomovermeersOccasional ContributorJoined 7 years ago6 Posts2 LikesLikes received1 SolutionView All Badges
ContributionsMost RecentMost LikesSolutionsRe: Execute next testcase when the previous one failed You should add a groovy script like this : Script of one of my projects where I need the same as you /*If individual exists ... else ... */ def matchMessage = 'No person was found' def message = context.expand( '${#TestSuite#message}' ) log.info(message) def createPersonStep = context.testCase.testSuite.testCases['06_createPerson'].testSteps['01_Soap_Call_createPerson'] def getPersonIdPropertyTransferStep = context.testCase.testSuite.testCases['05_getPerson'].testSteps['05_getPersonId_Property_Transfer'] if (message == matchMessage){ log.info("We will create this person") createPersonStep.run(testRunner, context) }else{ log.info("This person is already created.") getPersonIdPropertyTransferStep.run(testRunner, context) } Re: Script Assertion each statement Can you try ${expectedResults[0]} instead of ${expectedResults[0]}} ? Re: Authorization when working with multiple environments Hello, You can do it in different ways. 1. You can read a csv file with the different autentication variables via groovyscript 2. You can write a groovyscript with a switch statement with the different environments and declare the different authentication variables there. If you can show me your project, i can help you with the groovy script cause I am automating tests all day. Re: FTP with dynamic Port values No it just doesn't want to do the ftp. But I found a workaround : I added this script and it works: // Get the test step objects def tsFTP1 = testRunner.testCase.getTestStepByName("03_FTP_file1") def tsFTP2 = testRunner.testCase.getTestStepByName("04_FTP_file2") def tsFTP3 = testRunner.testCase.getTestStepByName("05_FTP_file3") def tsFTP4 = testRunner.testCase.getTestStepByName("06_FTP_file4") def tsFTP5 = testRunner.testCase.getTestStepByName("07_FTP_file5") //Get the port number def tmpFtpPort = context.expand( '${#TestSuite#tmpFtpPort}' ) // Set the ports tsFTP1.setPort(tmpFtpPort) tsFTP2.setPort(tmpFtpPort) tsFTP3.setPort(tmpFtpPort) tsFTP4.setPort(tmpFtpPort) tsFTP5.setPort(tmpFtpPort) FTP with dynamic Port values Hi community, I have a script that loads dynamic values in TestSuite properties. It looks like this: import com.thoughtworks.xstream.mapper.Mapper log.info("Initialize TestSuite for ProPlannerVehicle") def testSuiteName = testRunner.testCase.testSuite.name log.info("testSuiteName: " + testSuiteName) def env_extracted = testRunner.testCase.testSuite.project.getPropertyValue("arg_environment") def env_extracted_from_name = testSuiteName.substring(10, testSuiteName.length() ) log.info("env extracted: " + env_extracted) log.info("env extracted from name: " + env_extracted_from_name) if(env_extracted == null) { if(env_extracted_from_name == 'DEFAULT') { env_extracted = testRunner.testCase.testSuite.getPropertyValue("defaultEnvironment") } else { env_extracted = env_extracted_from_name } } log.info("env computed is: " + env_extracted) //create null Strings for tmpVariables def host = '' def env = '' def port = '' switch (env_extracted){ case 'TT': host = 'esb-tt01.dieteren.be' port = '26' env = 'TT' break case 'CI': host = 'esbci-dv.dieteren.be' port = '26' env = 'CI' break case 'DV': host = 'esb-dv.dieteren.be' port = '22' env = 'DV' break case 'QA': host = 'esb-qa.dieteren.be' port = '24' env = 'QA' break case 'PP': host = 'esb-pp.dieteren.be' port = '21' env = 'PP' break case 'TR': host = 'esb-tr.dieteren.be' port = '23' env = 'TR' break default: log.error("ERROR: Target environment '" + env_extracted + "' not handled.") testRunner.fail("ERROR: Target environment '" + env_extracted + "' not handled.") break } log.info("Host found: '" + host + "'") log.info("Environment found: '" + env + "'") testRunner.testCase.testSuite.setPropertyValue( "tmpPort", port) testRunner.testCase.testSuite.setPropertyValue( "tmpHost", host) testRunner.testCase.testSuite.setPropertyValue( "tmpEnvironment", env) testRunner.testCase.testSuite.setPropertyValue( "tmpTestSuiteName", testSuiteName) testRunner.testCase.testSuite.setPropertyValue( "tmpId", "ESB_SANITY_" + env) Then I want to use the 'tmpPort' value in my ftp step. It must be an int value but I get a String value if i use ${#TestSuite#ftpPort}. Does somebody have a solution for this? SolvedLaunch teststep automatically from groovyscript I am new to SoapUI. This is the groovyscript I wrote. But now I want to launch a teststep called "isAlive-SoapCall" in a TestCase "Sanity-TC" in a TestSuite "Sanity-TS". So while i loop and change every time the endpoint I want to execute this one teststep and maybe log the result to be sure the teststep is executed in the 6 different environments. How can I achieve this? I would like to know also where i place the groovyscript in my soapui-project. Do not forget that I am a junior who has everything still to learn. Thanks in advance. def environments = ['tt':'10', 'dv':'20', 'qa':'30', 'pp':'40', 'pr':'50', 'tr':'60'] environments.each{environment , url -> testRunner .testCase .getTestStepByName("isAlive-SoapCall") .getHttpRequest() .setEndpoint("http://esb-${environment}.xxx.be:7800/esb/v1/vehicle/xxx") }