Contributions
Re: get swagger ident from groovy script
Well, finally I found it : when you get your interface's data (your APIs) restServiceList = testRunner.testCase.testSuite.project.getInterfaceList() and you select the one you want (I have two of them), then you can identify the context and get the url restServiceList.each{ interface -> if (interface.getName() == "myInterfaceName") { myContext = interface .getDefinitionContext() log.info myContext.url // ==> gives you the swagger's path } }2 years agoPlace ReadyAPI QuestionsReadyAPI Questions529Views1like0Commentsget swagger ident from groovy script
Hi, In my project, I import a swagger (.yaml) file to do definition update. I would like to know if it is possible to get its identification from a groovy step ? ie. in my resources / Specification tag, I can see my Original definition path, this is the information I would like to get with a groovy scriptSolved533Views0likes1CommentRe: Setup script execution from another groovy step
Hello, unfortunately it seems that this solution does not work any longer on latest ReadyAPI versions (problems in 3.8.0 and 3.9.0) so I had to find another way to perform what I wanted, ie. to play a part of each testCase's setup script. The workaround I found is to modify temporarily the concerned tests : - I get the list of their testSteps id (I use config.id as a unique identifier) and status (disabled or not) - I disable all the testSteps - I store the setup script and modify it accordingly to my needs (in my case I neutralize an initialization call) - I store the teardown script and erase it - I run the test so it can clean all the unwanted properties that were created during the test runs (and that were needed for further testing) then I reset my tests back to their original configuration - I enable the testSteps according to their original status - I replace the setup script with its original value - I replace the teardown script with its original value here is the code associated: testRunner.testCase.testSuite.project.testSuiteList.each { suite -> name = suite.getName() suite.testCaseList.each{ TC -> if ((TC.setupScript != null)&&(TC.setupScript.contains("removeProperty"))) { log.info "clear lists from test '${TC.name}'" // store testSteps state ts_state_map = [:] //testRunner.testCase.gettes TC.getTestStepList().each{ //log.info "${it.config.id} / " + it.isDisabled() ts_state_map[it.config.id] = it.isDisabled() // neutralize each testSTep if (it.isDisabled() != true) it.setDisabled(true) } log.info ts_state_map // neutralize Setup script init phase s_script = TC.setupScript // store the script TC.setSetupScript(null) // clear setup script // neutralize init_test_case part sscript = s_script.replace("setup.init_test_case","//setup.init_test_case") sleep(1000) TC.setSetupScript(sscript) // replace initial setup script // neutralize TD script as well td_script = TC.tearDownScript TC.setTearDownScript(null) // execute testCase in order to execute only setup script def async = false TC.run (context.getProperties(), async) // restore TD script TC.setTearDownScript(td_script) // restore initial setupScript // re-enable setup init TC.setSetupScript(s_script) // restore testSteps state TC.getTestStepList().each{ //log.info "${it.config.id} / " + it.isDisabled() // restore state if (ts_state_map[it.config.id] != true) it.setDisabled(false) } } } }3 years agoPlace ReadyAPI QuestionsReadyAPI Questions1KViews0likes1Commenthow to launch ready API without a project ?
Hello, I have a problem with launching readyAPI on a computer I haven't used for a year. I updated readyAPI to 3.9.0 but when I launch it, it indicates "Missing REST Resource for Request". I guess it tries to open the project that was set before. As I can't (and don't want) to go through my 600 requests I want to open SOAP UI without any project, then properly update my sources and load my project. To do so I removed the readyapi_settings.xml file and other .db files from my user profile, but still I can't open readyAPI, it still requires replacement of missing resources. Is there something else I could do ? Alex3 years agoPlace ReadyAPI QuestionsReadyAPI Questions428Views0likes1CommentRe: How to run a testSuite setupScript from a groovy step
I tried with result = suite.run (context.getProperties(), async) if (String.valueOf( result.status ) != "PASS") { msg = "unexpected failure during $tc_name processing" testRunner.fail(msg) } and it worked, finally I have juste one more problem : if I want to play only a specific TAG, how can I configure it ?3 years agoPlace ReadyAPI QuestionsReadyAPI Questions644Views0likes0CommentsHow to run a testSuite setupScript from a groovy step
Hello, I'm trying to run a testSuite's setup script from a groovy step. I manage to play testCases setup script through the testCase's runSetupScript method but I can't find if the equivalent exists at testSuite's level. As testSuite have setup and teardown scripts I think that it should be possible to do so ... I tried the following testRunner.testCase.testSuite.project.testSuiteList.each { suite -> suite.runSetupScript(context, testRunner) ... // other code } but it provokes an error groovy.lang.MissingMethodException: No signature of method: com.eviware.soapui.impl.wsdl.WsdlTestSuitePro.runSetupScript() is applicable for argument types: (com.eviware.soapui.impl.wsdl.panels.support.MockTestRunContext...) values: [[ThreadIndex:0, log:Launch all available tests#423277805:INFO in Default, ...], ...] Possible solutions: runSetupScript(com.eviware.soapui.model.testsuite.TestSuiteRunContext, com.eviware.soapui.model.testsuite.TestSuiteRunner), getSetupScript(), setSetupScript(java.lang.String) error at line: 121 or I may use the wrong context and runner ? but my tesSuite is not executed on its own, just parsed for playing eligible tests (with particular tags) Maybe my first approach is not optimized as I could play the testSuite with tags but how can I do it from a groovy step ?3 years agoPlace ReadyAPI QuestionsReadyAPI Questions660Views0likes2CommentsRe: Setup script execution from another groovy step
Finally I found out how to do it : it requires to modify context.ExecutionID /* check setup scripts if those contain testRunner.testCase.getPropertyList().each{ testRunner.testCase.removeProperty(it.name) } it means that, prior to execution the setup script will clear data that will be (re)created during test execution it means that this data is likely to be detected as a relevant modification in git though it is not to avoid this this script will detect which test has such a setup script and will execute the setup script in order to delete these dynamic properties */ testRunner.testCase.testSuite.project.testSuiteList.each { suite -> name = suite.getName() if ((name.contains("USE CASES -"))||(name.contains("TOOLS - Configuration"))) { suite.testCaseList.each{ TC -> if ((TC.setupScript != null)&&(TC.setupScript.contains("removeProperty"))) { s_script = TC.setupScript // store the script TC.setSetupScript(null) // clear setup script // neutralize init_test_case sscript = s_script.replace("setup.init_test_case","//setup.init_test_case") sleep(1000) TC.setSetupScript(sscript) // replace initial setup script // execute the modified setup script to clean properties without launching init context.ExecutionID = TC.config.id TC.runSetupScript(context, testRunner) // restore initial setupScript // re-enable setup init TC.setSetupScript(s_script) } } } }3 years agoPlace ReadyAPI QuestionsReadyAPI Questions1.2KViews0likes2CommentsRe: Setup script execution from another groovy step
actually, it looks like it takes, as a context, the script that executes the research. Even if this one does not have a setup script, it executes the setup script of a target testCase but with its own characteristics (I've put a log that shows the name of the testCase that is run and it gives the one of my cleaning script !)3 years agoPlace ReadyAPI QuestionsReadyAPI Questions1.2KViews0likes3CommentsSetup script execution from another groovy step
Hello, I have several testCases in my project for which the setup script cleans the properties (generated dynamically during testCase execution). In order to clean my project before GIT commit, I wish to clear those dynamic properties and I created a testCase with a groovy script that parses all my project's testCases and, if the setup script cleans the properties, execute it. However, though my detection is correct, the script execution does not occur. Am I missing something ? here is my script : /* check setup scripts if those contain testRunner.testCase.getPropertyList().each{ testRunner.testCase.removeProperty(it.name) } it means that, prior to execution the setup script will clear data that will be (re)created during test execution it means that this data is likely to be detected as a relevant modification in git though it is not to avoid this this script will detect which test has such a setup script and will execute the setup script in order to delete these dynamic properties */ testRunner.testCase.testSuite.project.testSuiteList.each { suite -> name = suite.getName() // if (name == "USE CASES - Configuration") if ((name.contains("USE CASES -"))||(name.contains("TOOLS - Configuration"))) { suite.testCaseList.each{ TC -> if ((TC.setupScript != null)&&(TC.setupScript.contains("removeProperty"))) { log.info "concerned test " + suite.getName() + " ; " + TC.name TC.runSetupScript(context, testRunner) } } } }Solved3 years agoPlace ReadyAPI QuestionsReadyAPI Questions1.2KViews0likes4CommentsRe: SOAPUI Groovy to run .exe files
Hello, I did something like this through the use of batch files (as they are launched on a remote simulator PC), though I did not launched the .exe directly. I describe it below, hoping it can help : For instance, I have a .bat file that launches simulator exe as follows: start %2\\WaterMeter -KNXAddressIndex 2/0/22 -KNXAddressFlow 2/0/23 -IPserver %1 -DeviceName \"Water1\" -RefresRate 10 -PulseMode 4 ping 1.1.1.1 -n 1 -w 10 > nul in that line the exe name is WaterMeter.exe, the rest concerns launching parameters. the %1 and %2 data are batch parameters that are set in the command line launched in the groovy step. The groovy step is the following (the interesting part is at the end) : // launch the required simulators for non reg execution // use domo-simu server def simulator_ip = context.expand( '${#Project#DOMO-SIMU_address}' ) def simulator_path = context.expand( '${#Project#simu_tools_path}' ) def simulator_name = context.expand( '${#TestCase#simulator_name}' ) switch(simulator_name) { case "generic": file = "launch_generic_simu.bat" break; case "hot_water": file = "launch_hot_water_simu.bat" break; case "electricity": file = "launch_electric_meters_simu.bat" break; case "gas": file = "launch_gas_meters_simu.bat" break; case "water": file = "launch_water_meters_simu.bat" break; case "ventilation": file = "launch_ventilation_simu.bat" break; case "close": file = "closeAll.bat" break; case "All" : default : file = "launch_simulators.bat" // launch all available simulators break; } cmd = simulator_path + "\\$file " + simulator_ip + " " + simulator_path log.info "cmd = $cmd" process = Runtime.runtime.exec(cmd) Thread.sleep(2000) This process allows me to send my simulator interfaces. command parameters : - Simulator_path+file is the path where the batch file is. - simulator_ip is specific to my case as the server that pilots the simulator interface is on a remote PC - the last simulator_path data is, if I remember well, the location from where you launch the .exe You will probably not need to proceed this way. Setting your paht/appli.exe in cmd then launch the process will be sufficient. I don't deal with return data, though the 'process' variable should help you to get some information.1.3KViews0likes2Comments