Contributions
Re: setting proxy from groovy in SoapUI 5.0.0
Hi Rao, Thanks very much for your reply. I got it to work, using your lines and also adding these 2 lines afterwards. Seems a kind of refresh is required, without it it still didnt work. But all good now. SoapUI.saveSettings(); SoapUI.updateProxyFromSettings(); Cheers Bernhard10 years agoPlace ReadyAPI QuestionsReadyAPI Questions3.6KViews0likes0Commentssetting proxy from groovy in SoapUI 5.0.0
Hi all I am trying to dynamically change the proxy settings (enable or disable) from a groovy script that runs a number of test steps (SOAP requests dont use proxy, REST steps need to go via a proxy). Found some code on the web and it sounded as if this is supposed to be possible but I cant make it work. Below is my code. Note that I start with proxy enabled (preferences/proxy settings is 'Manual' and menu button is green). The first step is a SOAP request and is not supposed to use the proxy. The first log.info SoapUI.settings.getString( ProxySettings.ENABLE_PROXY, "No Value set" ) does return 'true' - as expected. The second log.info SoapUI.settings.getString( ProxySettings.ENABLE_PROXY, "No Value set" ) does return 'false' - also as expected. However, the next request is still going to the proxy!!! When I check the preferences/proxy settings they are set to None, but the menu icon is still green. Only once I click the OK button on the preferences/proxy settings, the menu icon changes to red and the proxy is disabled. Do I miss a step in my groovy script, like saving the settings change or such like? Kind regards, and many thanks for any ideas. Bernhard PS. no, using ProxyUtils.setProxyEnabled(false) instead doesnt do it either. if (testStep.config.type == "restrequest" && currentTestSuite.getPropertyValue("TestsFileName") == 'xxx.xls' && endPoints.getCell(1,0).getContents().toUpperCase().subSequence(0,5) == 'QUAL') { if (loglevel=="DEBUG") log.info('enable proxy'); SoapUI.settings.setString(ProxySettings.ENABLE_PROXY,"true" ); // ProxyUtils.setProxyEnabled(true); } else { if (loglevel=="DEBUG") log.info('disable proxy'); log.info SoapUI.settings.getString( ProxySettings.ENABLE_PROXY, "No Value set" ) SoapUI.settings.setString(ProxySettings.ENABLE_PROXY,"false"); log.info SoapUI.settings.getString( ProxySettings.ENABLE_PROXY, "No Value set" ) }; try { tsResult = testRunner.runTestStepByName(testStep.getName()); timetaken = tsResult.getTimeTaken();10 years agoPlace ReadyAPI QuestionsReadyAPI Questions4KViews0likes3CommentsRe: SoapUI not-Pro: retrieve the completed REST URI
For all of you who use SoapUI non-Pro, I finally came up with a solution: myURI = testStep.getPropertyValue("Endpoint")+context.expand(testStep.getResourcePath())+mytext.subSequence(0,mytext.size()-1) with mytext built like this: mypropnamelist = testStep.getResource().getPropertyNames(); mytext = "?"; for (xx=0;xx<mypropnamelist.size();xx++){ mytext = mytext + mypropnamelist[xx] + "="; mytext = mytext + context.expand(testStep.getPropertyValue(mypropnamelist[xx])) + "&" } Even the sorting of the parameters corresponds to the one used in the teststep (i.e. is not alphabetical). Enjoy Bernhard1.1KViews0likes0CommentsRe: SoapUI not-Pro: retrieve the completed REST URI
Hi Ole, Erik, I have spent a number of days researching this issue, reading API documentation, this forum, and the web, but no luck -please advise. Background info: We have a groovy test automation framework, reading test data and verification criteria from an XLS file, executing the tests and then preparing a test report. With REST the 'request' is, in most cases, the URI being sent, including host, resource path and parameters (all with expanded values if parameterised). This means that if I cant get hold of the 'completed', (i.e. the one being sent) URI, then I have nothing to write into my report about what the test was actually composed of and what parameter values were being used. The suite works very well for web services but for REST services I am also keen to provide a meaningful report, not just run the requests. I tried a number of methods like testStep.getResource() but they all only return the resource path before any parameter substitution and without the resource parameters and their values. Hope you can help. Many thanks Bernhard PS I am using SOAPUI 5.0, free version; our test suites do have a mixture of web and REST services.1.1KViews0likes0CommentsSoapUI not-Pro: retrieve the completed REST URI
Hi guys, I need to retrieve the completed URI of a REST request in a groovy script. There have been two previous posts with the same problem: viewtopic.php?t=16436 viewtopic.php?t=7016 In each case the solution included an event handler. Is there a simple way for those of us who dont have SoapUI Pro? After all, the info is show in request tab 'Raw' at design time (no run required) and is also being logged in the http log at execution time. example: GET /vibevault/rs/users/581896244222xxx42E04400134BEA65B84/tokens/?tokenType=SSO&tokenDuration=30 HTTP/1.1[\r][\n] So it should be available without too much effort I suppose. Please let me know. Many thanks Bernhard1.4KViews0likes2CommentsSimple property transfer as counter
Hi all, I have property MyNum defined at Project level and want to use it in a load test where it should be incremented by 1 in each iteration. I tried to create a simple property transfer test step with the source and target property being my propery MyNum. What's the syntax to increment it by 1 please? I have tried lot of options and searched this forum and the available documentation by no luck; also tried a groovy script by don't know the required syntax either, sorry. Hope anybody can help, looks like such a simple problem. Much appreciated Bernhard Bit of background: the load test will loop (for example) 100 times to configure 100 simulators; each one by sending a REST request to it; simulator names are like MWLK1200, MWLK1201 etc...up to MWLK1300; hence the property will be used like "MWLK1${#Project#MyNum}" in the "value" field of the request (with a starting value of 200).788Views0likes0CommentsRe: LoadTest fails
Hi janhjordie, You mentioned that you created a (property-transfer or groovy?) test step to increase your "counter" property by one. Can you please provide that script. I am stuck with my property "SimNum".... so far I have a groovy script with: def bn = context.expand('${#Project#SimNum}') as int bn = bn + 1 How do I set the property value now? Many thanks Bernhard1.1KViews0likes0Comments