Contributions
Re: Question on SoapUI projects XML "id"
Hi, thank you for you answer. My use case is: I have a lot of REST APIs (17, in development) to test in SoapUI. There are hundreds of methods. There are unitary projects and test cases for each API. Then I have to create a project common to multiples API to do some tests on chaining API calls from differents API. I want to develop mainly in each individual API project then copy/paste the interfaces into the common APIs test project and do as few modifications as possible. That is the reason why I wanted to copy and paste some API configurations (and so their IDs) into new project(s). No test case from unitary projects will be imported and new test cases would be developed in the common APIs project. Does this implementation seems problematic to you ? And please excuse me, I am no expert of the type of documentation you linked me to and it looks a bit cryptic to me, even though I can ask colleagues to help me if the right way of implementing this solution is to use some methods of the SoapUI API.1.2KViews0likes0CommentsQuestion on SoapUI projects XML "id"
Hi, Looking at some SoapUI project XML we observe that a lot of elements got an "id" as the form of an UUID (I guess?). Example: <con:testCase id="5a707623-0251-4526-8b09-d9762d77c3ff" [......]> OR <con:interface xsi:type="con:RestService" id="2b3b5225-a503-4e19-9e0a-bf39f8cc0cc3" [.......]> I looked for info but can't find any that helps me. How are these "id" used internally in SoapUI ? What is the risk if I manipulate the project's XML and create duplicate ID's? Can I create new components manually and generate a UUID with a UUID v4 generator ? Thank you, 7v1.3KViews0likes2CommentsRe: Using context parameter in Request Authorization
This case is now resolved. I created a Properties Test Step named "StepProperties" as the first step. I now stock my variables in the step properties thanks to the following script: import groovy.json.JsonSlurper responseContent = testRunner.testCase.getTestStepByName("POST User Login").getPropertyValue("response") jsonParser = new JsonSlurper().parseText(responseContent) testRunner.testCase.getTestStepByName("StepProperties").setPropertyValue("JWT",jsonParser.token) Then I pass as a header parameter the following properties In the following calls: At the end of the test case I run a TearDown Script that erases every properties created in StepProperties during that run: data = context.testCase.getTestStepByName("StepProperties"); String[] propToRemove = new String[data.getPropertyCount()]; propToRemove = data.getPropertyNames(); if(propToRemove.size()==0){ log.info("No properties to remove.") }else{ log.info("Removing properties...") for ( int i = 0 ; i < propToRemove.size(); i++ ){ data.removeProperty( propToRemove[i] ); } log.info("Properties removed.") } This documentation helped me understand how to access different hierarchy of properties in SoapUI: https://groovyinsoapui.wordpress.com/tag/teststep-level-property-access/ Bye !3.6KViews2likes0CommentsUsing context parameter in Request Authorization
Hi, I am currently building a Test Case in which I use scripts to parse the response body of a few REST API Call Test Steps. 1. I create a user: POST /user/signup. 2. I log in with the created user: POST /user/login ( response body contains a JWT token that I want to use as Authorization in the following API Calls ) 3. I parse the token with the following script: import groovy.json.JsonSlurper responseContent = testRunner.testCase.getTestStepByName("POST User Login").getPropertyValue("response") jsonParser = new JsonSlurper().parseText(responseContent) context.JWTToken = jsonParser.token log.info ("Token in context: " + context.JWTToken) The token correctly logs in the log.info (line 5 of the script), so it is valid and stocked as a context variable. 4. I want to create a product: POST /products . This API Call needs a valid JWT to suceed, so I want to pass my stocked context.JWTToken as the value of the the Access Token. It doesn't work and I would gladly like to get some help on how to make it work. I also tried: ${context.JWTToken} ; context.JWTToken ; JWTToken ; ${=JWTToken} ; ${JWTToken} Thank youSolved3.7KViews1like2Comments