major automation bug
For the past two months I have been dealing with a weird bug in SoapUI. Just thinking about making a post on this forum gives me headache. TLDR; Sometimes when testcase has multiple soap steps, RawRequest (custom properties) does not contain correct data. It contains previously launched test step's data. Long story, starting with background so you can understand what I'm doing and what I'm trying to achieve. I work for a company which has many internal systems and these systems rely on bunch of web services (in my scope around 10). Each web service has roughly from 10 to 150 web methods. There was an internal project aimed at upgrading systems and my purpose in this process was to assure, that nothing was affected in a bad way. This company has many test environments and for this project, two were allocated. Let's name them T2 and T3. Environment T2 had as-is systems, while T3 had everything upgraded, but the data were the same. My job was to create a comparison between these two environments and make sure, the upgrade did no harm and responses from web methods were identical. My approach For every web method, I created a test case and in this test case were few steps. Mostly Request_T2, Request_T3, sometimes Properties. I created one "main" test suite in which was just one test case with two steps. Init - groovy script that recursively sweeps whole solution, deletes any (old) Verificator and then replaces it with new one, and creates an excel template containing all test cases and test steps. Verificator - groovy script which is placed on last position in every test case. It searches for every soap-type test step that has _T2 suffix in its name. Then searches for its twin, test step with _T3 suffix in its name. It does many internal verifications, writes both _T2 and _T3 requests and responses to a directory structure that resembles how SoapUI test suite structure. These are for future analysis if necessary. It also writes verdict to the excel template that Init created. Sounds good, right? It actually works really well, and the script is very complex as it uses functions and methods not used in groovy scripts very often. The script looks almost like a library for inspiration or a buffet of functions. The problem One day analyst told me, that I saved wrong "REQ" file and that it is not corresponding to "RES" file. Few hours later I was even more confused. As it turned out, RawRequest was containing wrong data! This is a bit complicated, there are some conditions. For example Request_T2 Request_T3 Verificator In this setup, Request_T3 contains RawRequest of Request_T2 (it's a copy, Request_T2 has correct data). When I switched the requests like this: Request_T3 Request_T2 Verificator then everything was OK. How can this be? Well, I found out, it happens only sometimes. And the cause seems to be, that Request_T2 was aimed at a system with enabled security (basic auth, outgoind wss, global http settings). Not only that, but when I launched the test from the test case window, the RawRequest was filled with incorrect data. But then I opened the Request_T3 in a separate window and executed it like that, RawRequest was filled with correct data. This is the only way to get correct data written. Mitigation How to deal with this? I've tried many things. It does not matter how you get the data, whether you use testStep.httpRequest.response.requestContent or context.rawRequest or testStep.getPropertyValue("RawRequest") because you are reading the wrong data. When you open the Custom Properties in SoapUI you can see the behavior for yourself. Execute from test case - wrong data. Execute individually - correct data. What I've done so far was a dilemma between using context.request and context.expand('${Request_T3#Request}'). Since the bug occurs only sometimes and I need a generic Verificator script, I use following setup: I read testStep.httpRequest.response.requestContent and testStep.httpRequest.response.responseContent. I use ${=java.util.UUID.randomUUID()} as messageID in request header, so I use xmlHolder and compare the values of the elements in REQ vs RES. If they match, great, bug did not occur. But when they don't match, it means bug is present. The dilemma is there because context.request is a request with all variables and functions, like the one mentioned above. The context.expand('${Request_T3#Request}') executes all variables and functions again, so ${=java.util.UUID.randomUUID()} is generated again and it does not match the original. BTW I've also tried tweaking the security settings and trying to refresh the Request or SoapUI somehow, but nothing makes SoapUI work correctly. And keep in mind, I'm testing repeatedly hundreds of web methods At this point I'm stuck with something I can barely call a workaround. I cannot use SoapUI for automation if such bugs exist. Actually I'm a bit surprised this hasn't been discovered or addressed yet. Nowhere on the internet have I seen anybody talk about this. Only positive thing about this is that response is always correct.21Views0likes0CommentsCannot start MockService through Groovy Script
Hello everyone, I have a problem with really simple task. I want to automatize the start-up of MockService using Groovy Script so that when I execute TestCase, Mock services are started, and other steps are executed sequentially. I found a few examples online, but whatever I do, I receive "groovy.lang.MissingPropertyException: No such property:". SoapUI version is 5.7.0, and mock service name is Incidents_Binding MockService Could you please help? I'm attaching a few examples of the script I'm using:43Views0likes0CommentsHow to change the API of a REST test step
Hi guys, If you test REST APIs in SoapUI, you may encounter an issue where you cannot change the API attached to the REST test step. I am not aware of any standard way to do it, so I prepared a simple Groovy script to change the test step's API programmatically: testRunner.testCase.getTestStepList().each(){ step = it service = step.getService() log.info("TestStep: ${step.getName()}") config = step.getRequestStepConfig() log.info "Before: ${step.getService()}" config.setService("BankGround_v1.12") log.info "After: ${step.getService()}" } I thought this may help those of you who work with REST APIs, which get changed over time (new versions). For a longer story, you can visit the following article: https://www.linkedin.com/pulse/soapui-what-rest-api-changes-karel-husa-7vb2e45Views2likes0CommentsHow to upload a file via SOAP, as an attachment using python zeep
Hi folks, I am trying to attach a log.txt file with my createAttachment web service. I am using zeep as a client to do so but unable to do. I tried the same using MIME but unable to do so. import requests url = "WSDL url" payload = '''<?xml version="1.0" encoding="utf-8"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://www.ca.com/UnicenterServicePlus/ServiceDesk"> <soapenv:Header/> <soapenv:Body> <ser:createAttachment> <sid>'''+sid+'''</sid> <repositoryHandle>doc:12</repositoryHandle> <objectHandle>cr:1306599</objectHandle> <description>Testing to attach document to change order</description> <fileName>log</fileName> </ser:createAttachment> </soapenv:Body> </soapenv:Envelope>''' files=[ ('fileName',('Testing.txt',open('C:/Users/prasaka/Desktop/Testing.txt','rb'),'text/xml')) ] headers = { 'Content-Type': 'text/xml; charset=utf-8', 'soapAction': 'application/soap+xml' } response = requests.request("POST", url, headers=headers, data={'data' : payload}, files=files) print(response.text) print(response.status_code)2.5KViews0likes3CommentsHow do I set the status of a Script Assertion?
After looking at this documentation, GroovyScriptAssertion (SoapUI 3.0.0 API) (smartbear.com), I've tried the following def currentStep = context.getCurrentStep(); def assertion = currentStep.getAssertionByName('Script Assertion'); assertion.setStatus(com.eviware.soapui.model.testsuite.Assertable.AssertionStatus.FAILED); but I get the error setStatus() exception: groovy.lang.MissingMethodException: No signature of method: com.eviware.soapui.impl.wsdl.teststeps.assertions.basic.GroovyScriptAssertion.setStatus() is applicable for argument types: (com.eviware.soapui.model.testsuite.Assertable$AssertionStatus) values: [FAILED] If I output assertion.getClass() It tells me that assertion's class is com.eviware.soapui.impl.wsdl.teststeps.assertions.basic.GroovyScriptAssertion@71d72a30 What am I doing wrong? I'm using 5.7.1 Edit: If it's not possible to set the status of a test assertion or test step, is it possible to set the status of a testCase?193Views0likes1CommentDynamic Operation name in Mocking
Hi Team, By default the operation name for mocked response is picked from UI as shown below: I am trying to generate dynamic response based on the operation name at runtime but not able to get the correct Groovy code for that. I tried checking this 'log.info mockOperation.name' but it returns the overall mock operation and not the one displayed in UI Can you please let me know the corresponding Groovy script to achieve this?Solved221Views0likes1CommentMass Install via Intune Soap UI latest Version
Hello Team, Hello team, as a company we would like to use your product and distribute it via Intune. Do you have any documentation on how we can deploy your software to all our clients via Intune? Which version do you recommend? Which installation command do you recommend? Which uninstall command do you recommend? Which detection rules should be set. I look forward to hearing from you as soon as possible. Many thanks and best regards Michael257Views0likes0Comments