dataSource grid - active | deactivate checkbox
Hi there, With the dataSource teststep, i created a 'grid' Is there a possibility to activate or deactivate the checkbox via Groovy? If YES, can u please provide the code to me? If NO, is there a other solution to preform this action? Regards, GroovyErik2.3KViews0likes5Commentspassing result or variable value from Groovy to test step
Dear Team, I have query below to achieve one of the requirements. I am using ReadyAPI with proper license. I would like to pass Goovy script result as one request body(XML/JSON) parameter for API. I have written a Groovy script and test step under it. But dont know how to specify groovy result as body request parameter. For example: deftoday = new Date() today.format("dd/MM/yyyy") //Add some random number to Date field and store it in some variable like cutom_date Now I would like to pass custom_date as request body(XML) parameter for API step under the groovy script as below ........ ........ <app_date>?</app_date> ....... ....... cutom_date from groovy script should come and sit at ? place above. Can anyone help on this please ?Solved5.2KViews0likes11CommentsNullPointerException at com.eviware.soapui.impl.wsdl.teststeps.RestTestRequestStep
I am stuck with below error . I am calling a groovy test step from assertion of a Test Step and this groovy test step is calling another test case . it is running but below exception is coming . Just sample code . Test Step 1 - > In assertion calling another test step based on some conditions context.testCase.getTestStepByName("VerifyAddress").run(context.testRunner,context) Test step 2 (VerifyAddress) //calling another step based on few conditions def key = context.testCase.testSuite.project.testSuites['Keywords_Addresses'].testCases['ApproveAdress'] key.setPropertyValue("city",city) def runner = key.run( null, true ) runner.waitUntilFinished() Thu Apr 29 22:53:32 IST 2021: ERROR: java.lang.NullPointerException java.lang.NullPointerException at com.eviware.soapui.impl.wsdl.teststeps.RestTestRequestStep.run(RestTestRequestStep.java:921) at com.eviware.soapui.model.testsuite.TestStep$run$0.call(Unknown Source) at Script7.run(Script7.groovy:14) at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.run(SoapUIGroovyScriptEngine.java:94) at com.eviware.soapui.support.scripting.groovy.SoapUIProGroovyScriptEngineFactory$SoapUIProGroovyScriptEngine.run(SoapUIProGroovyScriptEngineFactory.java:83) at com.eviware.soapui.impl.wsdl.teststeps.assertions.basic.GroovyScriptAssertion.assertScript(GroovyScriptAssertion.java:150) at com.eviware.soapui.impl.wsdl.teststeps.assertions.basic.GroovyScriptAssertion.internalAssertResponse(GroovyScriptAssertion.java:186) at com.eviware.soapui.impl.wsdl.teststeps.WsdlMessageAssertion.assertResponse(WsdlMessageAssertion.java:164) at com.eviware.soapui.impl.wsdl.teststeps.RestTestRequest.assertResponse(RestTestRequest.java:150) at com.eviware.soapui.impl.wsdl.teststeps.RestTestRequest.setResponse(RestTestRequest.java:141) at com.eviware.soapui.impl.support.panels.AbstractHttpRequestDesktopPanel.afterSubmit(AbstractHttpRequestDesktopPanel.java:606) at com.eviware.soapui.impl.wsdl.panels.teststeps.RestTestRequestDesktopPanel.afterSubmit(RestTestRequestDesktopPanel.java:365) at com.eviware.soapui.impl.wsdl.WsdlSubmit.notifyListenersAfterSubmit(WsdlSubmit.java:111) at com.eviware.soapui.impl.wsdl.WsdlSubmit.run(WsdlSubmit.java:157) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:835)Solved2.1KViews0likes4CommentsHow to use a regex in groovy for reading a excel file and assign a value.
hallo, I am trying to read an xls file having few columns and rows. I am getting a string value from an api and from this string value i am trying to look into the row having six values. There is an output value which i then compare and assign a closest value to it and choose which columnnamenumber. Let me explain with an example with the picture i have attached. In this case, i get a string value "test8" this excel makes a search and i have already implemented and i get the result for example "test8" with a output value 176. Now the row values which are in test8 are 174 181 192 204 211 My task is in reading this alle row cell values which is assigned to row "test8" If have a output value for a number 176 from the below code def output= bucket.getoutput(). Here maybe i need to use regex. i do not know! i wanted to use it for the previous row value in this case for 174 from six row values. Then it would search for which column header it is assigned, in this case it would be -1. If the output value was somewhere in around 191-204 ex(198). Then it should setcolumn name to +1. Please helpme in building/suggesting it. I have added my class file. I am not getting the right output i need. I have defined in the line def value. ps: Sheet1 code looks for the program from the data slotnumber which is already been implented. case1,case2 is minimumvalue and maximumvalue. I tried : private void calculateweight(BBucket bucket, ZWorkbookImpl workbook) { //find right row, extract data try { def testProgram = bucket.getTestProgram() workbook.goToSheet("Sheet2") workbook.goToPosition(0, 0) //Searches for particular test program in the first column ex:Test8 while(true) { if(workbook.readCell(false).contentEquals(testProgram)) // Here it finds Test8, now how to get the values of row Test8 ?? { workbook.goToNextCell() der value = //Todo "read the values of particular row and take one value which fits" container.getAll(new FilterAllDomainObjects()).each{e -> e.setProgramExtension(value) //calculate program //Store program on the stent } break; } workbook.goToNextRow(false) } } catch (Exception e) { throw new Exception("Error parsing ${fileName} file", e) } }Solved1.1KViews0likes3CommentsGroovy Script to delete test cases that begin with value
Disclaimer - My knowledge of Groovy is very limited. I basically require a groovy script within my test case to delete test steps that begin with 'Order'. I have tried this below, but to no avail, but that's kind of what I want. No idea if the syntax is correct or not! testSuite.removeTestStep.startswith(Order) This script would ideally be at the bottom of the test case and delete all the test steps that begin with the word 'Order' Any help would be greatly appreciated. Many Thanks. Ben1.1KViews0likes5Commentscustom authorization in groovy script .need explanation for each in body section?
defauthProfileName = "Name of your profile"; defproject = testRunner.getTestCase().getTestSuite().getProject(); defauthProfile = project.getAuthRepository().getEntry(authProfileName); authProfile.setUsername("newUsername"); authProfile.setPassword("newPassword"); authProfile.setDomain("newDomain"); //Set to true for pre-emptive authentication //Set to false for using global preference authProfile.setPreemptive(true); defstep = testRunner.testCase.getTestStepByName("Name of your request").getHttpRequest(); step.setSelectedAuthProfile(authProfileName); nmraorupert_anderson top contributors please help849Views0likes2CommentsI am not able to get output of remote shell script from groovy script in soapui
for an example I have added below dummy code in shell file auto.sh - CURRENTDATEONLY=`date +"%b %d, %Y"` echo Current Date is: ${CURRENTDATEONLY} sleep 2 and calling above shell script auto.sh from groovy script in soapui def command = "C:/Program Files/PuTTY/putty.exe -ssh root@ip -pw passwd -m C:/auto.sh" log.info command def process = command.execute() def outputStream = new StringBuffer() def errorStream = new StringBuffer() process.consumeProcessOutput(outputStream, errorStream) process.waitFor() log.info("return code: ${process.exitValue()}") log.error("standard error: ${process.err.text}") log.info("standard out: ${process.in.text}" + outputStream.toString()) context.testCase.setPropertyValue("propertyName", outputStream.toString()) running above groovy script opens a new putty prompt and runs command as expected, but i am unable to capture the output in testCasepropertyName o/p of groovy Tue Jan 19 16:13:47 IST 2021:INFO:C:/Program Files/PuTTY/putty.exe -ssh root@ip -pw passwd -m C:/auto.sh Tue Jan 19 16:13:54 IST 2021:INFO:return code: 0 Tue Jan 19 16:13:54 IST 2021:ERROR:standard error: Tue Jan 19 16:13:54 IST 2021:INFO:standard out: it would be great if someone can help me how to capture the o/p and store it in testcase property please correct me if something is wrong with codeSolved3KViews0likes4CommentsData Generator - Change "duplicate each value" property through Groovy
Hello all, I have used a DataSource with DataGenerator type selected, in one of my test cases and I'm trying to set the "duplicate each value" property through a Groovy step. What I'm trying to achieve here is to set this value from a project-level custom property. The test case is setup as shown below and I have managed to go as far as this in my Groovy step: def valueRepetition = context.expand('${#Project#repeatValue}') def objDsStep = context.testCase.testSteps["Data Generator"] // objDsStep is a com.eviware.soapui.impl.wsdl.teststeps.WsdlDataSourceTestStep def objSource = objDsStep.getDataSource() // objSource is a com.eviware.soapui.impl.wsdl.teststeps.datasource.DataGenerator.UI.DataGeneratorDataSource object log.info(objSource.toString()) I've looked through the API documentation but I cannot find which method to call in order to retrieve the generator's properties and update the 'repetitionCount' method . Can anyone provide some help on this? Thanks in advance!968Views0likes2Comments