Possibility to trigger request when request received by MockService - groovy

I'm trying to automatically trigger a soapui request with a groovy script when my mockservice receives a request. The request to trigger is based on a different WSDL than the service.
if possible, how would I go about to achieve the above?
Sorry if this is a totally stupid question...

If you have a TestSuite for the MockService and the SoapUI request as a TestStep, you can run the test step by it's name in the OnRequest Script for the MockService
testRunner.runTestStepByName("AnotherSoapRequest")

Related

Azure devops pipeline testrun results to be updated in testrail

Hi we run the azure devops pipeline having all the test cases. We are using jmeter scripts to run and producing the run results for all the test cases. Is there any possibility that we could update these test results in TESTRAIL automatically after every run? Testrail is where we store our test cases.
TestRail has an API so you should be able to submit results from JMeter directly, take a look at the Example POST Request
POST /index.php?/api/v2/add_result/1 HTTP/1.1
Host: example.testrail.com
Content-Type: application/json
{ "status_id": 1 }
The equivalent JMeter's HTTP Request sampler setup would be something like:
you will also need to add a HTTP Header Manager and configure it to send the relevant Content-Type header

Replace a request with a scheduled job and use the Response to update an endpoint

I am a newbie on this so my question looks a bit more simple.
i am working on a logic app where the steps are like:
Run the logic app on a scheduled trigger to get a list of orders that have a specific status (e.g. not processed) from an endpoint (endpoint1).
Process each orderNumber and send a request to another endpoint (endpoint2) to retrieve the status of each order number.
Get that status and send it back to endpoint1 along with the orderNumber with an updated status (endpoint1 Update method with the orderNumber and orderStatus)
Problem:
I can do step 1 by doing "When a HTTP request is received" but need to know how can I run a scheduled job to get a list of orderNumbers and then pass them in For-Each loop.
In For-Each, I am sending a request against each orderNumber and getting the response, but don't know how can I use that response to update the orderNumber with the new status in endpoint1.
Appreciate if someone can guide me on this.
For scheduled workflows, choose the "Recurrence" trigger.
In the For-Each loop, with the assumption that the response of your first http request is in JSON format, you will first need a "Parse Json" step. In 'Content' you should have the response from your http step. Then use a sample response payload to generate the response schema. Once this is done, you can use another http request to fire the next API call. You should be able to use the response fields from the first API call to make the next call.

Alexa HTTPS endpoint - don't get any request

I was successfully set the Alexa Build steps(checklist) on Alexa Developer Console.
As endpoint I want to use my own remote server(nodeJS, not AWS lambda), I found the next example and trying to use it now:
https://github.com/Glogo/alexa-skill-sample-nodejs-express
By using POSTMAN I can send a JSON with intent to my nodeJS server and successfully get a response.
But once I try to test the flow through Alexa Test Simulator (Test tab in Alexa Developer Console) I don't get any response... On the server side, I can't see any request that comes from Alexa.
I wonder, what is the problem in this case?
Maybe I didn't understand how it should work... I expect to receive a JSON request from Alexa and to output a response.
It's important to mention that I didn't set any properties "Distribution" and "Certification" tabs. As I understand, for testing it's not necessary.
From the screenshot of test simulator, you didn't invoke/launch your skill. Once you launch your skill, a request JSON will be generated by which you can check whether your nodejs server can handle that request.
You can invoke your skill from Test Simulator by:
open, <skill invocation name>
This will trigger a LaunchRequest
You can directly trigger an intent of your skill by,
ask <skill invocation name> <a sample intent utterance>
This will trigger an IntentRequest with the mapped intent
For different invocation phrases, check this.
You first need to open your skill, because the simulator won't open it for you. You can do this by typing/saying
open/start/launch <invocation name>
To trigger one of your intent use
ask/tell <invocation name> <a sample utterance for your intent>

Access to requestContent within AfterRequest Script soapui

I'm trying to simulate an asynchronous response on a webservice mock. The goal is to response a synchronous acknowledge message and then a delayed message back to the replyTo address. The approach I have selected uses mock service that will handle the acknowledge and then run a test case that will handle the processed message back to the replyTo. I'm using OnRequest Script to generate the acknowledged message and AfterRequest Script to run the test case that will emulate the delay and the response back to the replyTo.
So the question is which script object I can use to have access to the requestContent. I have seen examples using:
def holder = new com.eviware.soapui.support.XmlHolder( mockRequest.requestContent )
but the mockRequest instance is not available on AfterRequest, Which object I can use instead to have a holder with the request content?
I did find that
def holder = new com.eviware.soapui.support.XmlHolder( mockResult.getMockRequest().requestContent )
do the trick, but now I find that running a test script in AfterRequest delays the synchronous response back, Why could this be happening? Isn't AfterRequest's script executed after the mock service response back? Do i have to explicitly execute something at Dispatch or at OnRequest in order to summit back the response before AfterRequest code being executed?
I know this is really old question, but I just faced the same issue myself. I have no idea why it works as it works, but you can avoid the problem by accessing the request content in OnRequest, then store needed information to context and use the context in AfterRequest to get the information you need.

How to return http 500 with soapUI

I am mocking my web service using soapUI.
Now, I also want to test fault. For this, the mock service (=soapUI) should return a HTTP 500.
Does anyone know, how soapUI can do this?
thanks
This can be achieved with the following Groovy code:
mockRequest.getHttpResponse().sendError(500)
Create a mock service.
Create a new mock response.
Open the mock response editor (by double clicking it) and click on the exclamation mark symbol which creates a SOAP Fault response.
If you look at the RAW code of the answer, you see a 500 error code. (HTTP/1.1 500 Internal Server Error)
Btw if you have created two reponses, a successful and a fault response, then when using the mock service service, SOAPUI alternates between the two responses.
Right Click on the MockResponse > Show MockResponse Editor Enter.
Look at MockResponse Properties on the left hand side, bottom
Scroll down to search for "Response HTTP-Status" edit the value to 500.

Resources