Contributions
Re: Cannot open Editor for test steps for v. 4.6.2+
It's 3 years later and I'm using ReadyAPI! v2.5.0 and I'm having the same problem. Wish we could have a custom solution so that we don't have to wait on third party developers.5 years agoPlace ReadyAPI QuestionsReadyAPI Questions2.5KViews0likes1CommentRe: Reading SOAP Request Attachment using Groovy
I figured it out. Let me first state what I wanted to do. I wanted to get the SHA-256 value from the cached attachment in my SOAP Request and then place that value in the SOAP Request as a property. If the attachment changes it doesnt matter because the test will generate a new hash value from it. To do this: 1. I created a Groovy Script test step to go get the attachment, generate the SHA-256 value and return it. import java.security.MessageDigest import java.math.BigInteger def attachment = testRunner.testCase.testSteps['SOAP_Request'].httpRequest.getAttachmentAt(0).data String sha256 = org.apache.commons.codec.digest.DigestUtils.sha256Hex(attachment); assert sha256 return sha256 log.info(sha256) 2. I created a Property Transfer test step to move the "result" property value to a property I created at the Test Case level. 3. I then reference the custom Test Case property in my SOAP Request by using${#TestCase#sha256} (where sha256 is the name I gave the custom proerty) in the corresponding XML element.6 years agoPlace ReadyAPI QuestionsReadyAPI Questions2.8KViews0likes1CommentRe: Reading SOAP Request Attachment using Groovy
Hi Olga, I'm just trying the suggested solution today. Unfortunatelly I've had no luck so far. I'm reading the groovy-lang.org documentation. I'll be sure to post a solution when I find it. Thanks!6 years agoPlace ReadyAPI QuestionsReadyAPI Questions2.8KViews0likes0CommentsRe: Reading SOAP Request Attachment using Groovy
Hello. Thanks for your reply. Apologies for such a late response.I'm ashamed to admit I don't understand your solution. I'm not a developer or technical person at all, but Ireally want to improve my testing. I'm assuming you are refering tho the line def sha256 = {var.java.security.MessageDigest.getInstance("SHA-256").digest(attachment).toString()} I tried a couple things with no luck. // I tried this with no luck def sha256 = { [->] var.java.security.MessageDigest.getInstance("SHA-256").digest(attachment).toString() sha256.call() } //Doesnt work either def sha256 = { sha256 -> var.java.security.MessageDigest.getInstance("SHA-256").digest(attachment).toString() sha256.call() } I came back to this after the holidays and It's turned into a headache.6 years agoPlace ReadyAPI QuestionsReadyAPI Questions2.8KViews0likes0CommentsReading SOAP Request Attachment using Groovy
Hello, I have a SOAP request with an attachment. I'm trying to read the attachment, generate it's SHA-256 hash, and put the value in the request before sending. I've found various snippets of each step in the community, but nothing seems to work. This is what I have so far in my Groovy script: import java.security.MessageDigest def attachment = testRunner.testCase.testSteps['SOAP Request'].httpRequest.getAttachmentAt(0).data def digest = MessageDigest.getInstance("SHA-256") def sha256 = { var.java.security.MessageDigest.getInstance("SHA-256").digest(attachment).toString()} The result I get is: "Script-result: Script54$_run_closure1@6fa2bce9" Any help is appreciated. ThanksSolved6 years agoPlace ReadyAPI QuestionsReadyAPI Questions2.9KViews0likes6Comments