Opening and updateing an excel sheet using jxl
Hello, I am working using the following code example but I am unable to get it to work. import jxl.*; import jxl.write.*; import java.io.*; public class CreateExcel_JxlApi { public static void main(String[] args) { //create WorkbookSettings object WorkbookSettings ws = new WorkbookSettings(); try{ //create work book WritableWorkbook workbook = Workbook.getWorkbook(new File("C:/FileLocation/ExcelFile.xls")); WritableWorkbook workbookCopy= Workbook.createWorkbook(new File("C:/FileLocation/NewExcelFile"), workbook); System.out.println("Did excel file create?"); //create work sheet WritableSheet workSheet = null; workSheet = workbook.createSheet("Test Report" ,3); SheetSettings sh = workSheet.getSettings(); //write to datasheet workSheet.addCell(new jxl.write.Label(10,0,"User Name")); workSheet.addCell(new jxl.write.Label(11,0,"Password2")); workSheet.addCell(new jxl.write.Label(13,0,"Another one for the Road")); //write to the excel sheet workbook.write(); //close the workbook workbook.close(); }catch(Exception e){ e.printStackTrace(); } } } What I am trying to do is: 1. Open the excel worksheet with Groovy using jxl. 2. Write New Data onto the same Excel worksheet in a different Row. 3. Make Sure the previous data on the worksheet does not erase. There have been some threads in the past but they either don't explain how it was accomplished or any links relating to the post are broken. Thanks for looking.Solved12KViews0likes4CommentsRetreiving data from Mongo db using Groovy and assigning it to a test case property
Hi, I'm looking to create a test step that can connect toMongoDB, run a query, and then assign the result to a test case property. I have the connection working and I can retrieve a result as a row count. However I cannot get the actual result to assign it to a test case property. I know how to assign a value to a test case property but simply cannot get the result in order to do that. Below is my existing code. I'm connecting to a MongoDB called database called 'digital', within that there is a collection called 'QuoteSummary'. Within 'QuoteSummary' I'm searching for a "quoteRefNo" where "workReferenceNo" = GPE0024879. Its the resulting "quoteRefNo" that I want to assign to a test case property. import com.gmongo.GMongoClient import com.mongodb.MongoCredential import com.mongodb.ServerAddress import com.mongodb.BasicDBObject def credentials = MongoCredential.createCredential('hidden_user', 'digital', 'hidden_pwsd' as char[]) def serverAddress = new ServerAddress('hidden_servername_and_port') def mongo = new GMongoClient(serverAddress, [credentials]) def db = mongo.getDB('digital') BasicDBObject query = new BasicDBObject("workReferenceNo":"GPE0024879") BasicDBObject query1 = new BasicDBObject(quoteRefNo: 1,_id: 0) def collection = db.getCollection('QuoteSummary') //log.info(collection.find(query).count()) log.info(collection.find((query),(query1)).count())Solved10KViews0likes5CommentsHow to create a property using groovy script???
Hi Team, In my automation script i am in need to create a property and store the value dynamically ,so that the value stored is used in upcoming steps for further process,Could anyone help in this. I tried online every article says on set and get property in groovy,but i need to create a property in groovy.Solved6.6KViews0likes4Commentshow to extract "Rest Request properties" via groovy Script from Rest Test step
I need help in trying to extract the Rest Request Properties associated with a Rest Request test stepin ReadyAPI via Groovy Script. Scenario - want to extract the Resource property listed under Rest Request Properties. The Resource path property available under Rest request propertythen needs to be parameterized so that it can be updated at run time by using a project parameterand support two or more versions of code base by modifying one of the path parameters at run time. I have more than 30 APIs so cant go manually and change the Resource path to a parameterized. Using groovy script I am able to extract the custom parametersbut not able to extract the Rest Request properties. Cansomeone please help in guiding with a solution or pointing to an existing answer. I did found lot ofquestions asked byother userson extracting Custom properties from the request but could not find anything related to Rest Request properties.Solved6.3KViews0likes3CommentsAdd minutes to current date time using groovy
To get the Current Date Time value, im using this: ${= Calendar.getInstance(TimeZone.getTimeZone('GMT')).format("yyyy-MM-dd'T'HH:mm:ss")} which gives DateTime as2020-02-05T22:07:34 I want to add 40 minutes to the current DateTime Value: the expected result should becurrentTime + 40 min. Which is:2020-02-05T22:47:34Solved5.3KViews0likes1Commentpassing 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.1KViews0likes11CommentsCall test step of another test case through Groovy
Hi friends, A common test scenario to call test step of another test case in SoapUI. My question is that how does called test step (REST GET request) retrieve property value? (i.e. one parameter is ${#TestCase#userID}). when I call this step using below Groovy code: (Example) Case 1 REST Step 1 REST Step 2 Case 2 Groovy Step 1 // call "REST Step 1" of Case 1 in Case 2 def targetTestStep = testRunner.testCase.testSuite.testCases["Case 1"].testSteps["REST Step 1"] targetTestStep.run(testRunner, context) "REST Step 1" has a parameter with "${#TestCase#userID}", if run above code, the "REST Step 1" cannot get property value from "Custom Properties" of test case. It seems retrieve property value from caller's properties rather than called one. is it about "testRunner"? If I want called test step to get property value from its own test case. How can I proceed it? Thanks Regards, /AaronSolved5KViews0likes5CommentsSet SSL Keystore using Groovy on Test Step level
On the Project Level i have setup the Keystore. Now i want to be able to Select this on Test Step Level using Groovy. In the Step : Select SSL on Test Step i wrote a groovy to do the same but it is failing. import com.eviware.soapui.impl.rest.RestMethod import com.eviware.soapui.impl.rest.RestRequestInterface.HttpMethod import com.eviware.soapui.impl.rest.RestResource import com.eviware.soapui.impl.wsdl.support.wss.WssCrypto import com.eviware.soapui.impl.wsdl.teststeps.RestTestRequestStep import com.eviware.soapui.impl.wsdl.support.wss.crypto.CryptoType def step = testRunner.testCase.testSteps['GET - TEST'].testRequest log.info step.getSslKeystore() // This step works fine and reads the Keystore Selected on the Test Step (if any) step.setSslKeystore( 'keystore.jks') // This step does not work and gives error message Error : groovy.lang.MissingMethodException: No signature of method: com.eviware.soapui.impl.wsdl.teststeps.RestTestRequest.setSslKeystore() is applicable for argument types: (java.lang.String) values: [keystore.jks] Possible solutions: setSslKeystore(com.eviware.soapui.impl.wsdl.support.wss.WssCrypto), getSslKeystore() error at line: 13 Please note that my tests require for me to be able to select & deselect the SSL Keystore for a test step dynamically (through groovy) based on the environment i am running my tests on .. (for ex : QA , UAT etc)Solved4.9KViews0likes8CommentsHow do i fetch raw request for REST, the one that you see by clicking on the RAW button,using groovy
How do i fetch a raw request using a Groovy script. Understand that I don't want the raw request shown in the custom property, but the one which you can see when you click on the RAW tab. it includes, the endpoint details, headers, body etc. something like this. GET https://chrus.au.club.io/orders/0754855/memo HTTP/1.1 Accept-Encoding: gzip,deflate X-Transaction-Id: gfr456d03ygh38s2 Host: chorus-scg-api-v1-sit.au.cloudhub.io Connection: Keep-Alive User-Agent: Apache-HttpClient/4.5.2 (Java/1.8.0_112)Solved4.5KViews0likes2CommentsRequestFilter.filterRequest Script applied to only specific Test Cases
hello, I have a Project in SoapUI that contains lots of Test Cases. I have created a Event Handler Script to add a Header to the Rest Requests that uses the RequestFilter.filterRequest Event. My problem is I want to apply the Event script to ALL Test Cases that do not end in the words "- forbidden" (See photo below) How should I go about this problem? If I use the field 'Target' in the Event Handler? If so how do I filter using test cases names that end in "- forbidden"? If I try and include in the logic of the Event Handler to check if the Test Case name, I'm unable to access the TestRunner to access the test case name.Solved4.4KViews0likes5Comments