JSON Project
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
JSON Project
Now that my Groovy script is working, I am working to add the script to other projects. Most of my projects are XML so they are straight forward. I am one project which is JSON and I am not sure how to create testStep for it.
In this JSON, the working API has the following attributes:
1. Method: PUT
2. Endpoint: https://10.14.151.51:8443
3. Resource: /rem/sentinel/api/hssdata/subscriberdata/sip:+13313140097@ims.mnc130.mcc302.3gppnetwork.org
4. Parameters: ?selectionKey=Metaswitch::::&rhinoInstanceId=Local
Screenshot is attached. Tel-Number is the only input parameter to put in the Resource and the JSON body. So, my plan is to create a Groovy to read a file of Tel-number and then execute the testStep one by one.
Can I create a Groovy for JSON? I tried and somehow I cannot using property for Tel-Number in the Resource field.
Any help is appreciated.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Where is Telephone number? Is it in the url? or is it in the request body?
- I see it xml payload. Where is the json?
- Are the both query parameters fixed always?
Regards,
Rao.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Where is Telephone number? Is it in the url? or is it in the request body?
The Tel number is in both the Resource line and in the request body. It is the same value in both places.
- I see it xml payload. Where is the json?
The payload (request body attached). It is in JSON, right?
- Are the both query parameters fixed always?
Yes, this is the only variable. The Groovy script will read and inserts it into the teststep.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Not sure where do you need groovy and why?
- You can change the resource from
sip:-13313140097
to
sip:${#TestCase#PHONE_NUMBER}
- And add the PHONE_NUMBER in test case custom property with value. Change each time if you want to send for different number. Use the same way in the pay load as well
- Even for query parameters, change the values to use custom properties as suggested in the above.
Regards,
Rao.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I input the TAS project and renamed it to TAS-Groovy. I then created the TestSuite and TestCase. I then copied a working request (PT-TAS-PUT-CFU) as the first TestStep (PT-TAS-PUT-CFU-1).
Somehow the screen of PT-AS-PUT-CFU-1 is different than PT-TAS-PUT-CFU. I wanted to modify the Resource field to a custom property but it would not let me edit the filed. Also, Method field is different as well. Please refer to the attached screenshot (please zoom in, there are 2 API displayed in SoapUI).
Not sure how to proceed now. Maybe I should not copy in the create-testcase.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Just renaming a project, doesn't make any difference.
Sorry, Not sure what is the issue here?
Regards,
Rao.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
https://gist.github.com/nmrao/3e001382bc107751bddeb84bf641cdc4
Regards,
Rao.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Regards,
Rao.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Somehow my screen (screen-1 below) is not the same as yours.
In your screen and in my working API (screen-2 below), there is a Endpoint and in my screen, it is called Request URL.
There is a Resource filed in your screen, in my screen there is no Resource field.
Also, the property table has different number of columns.
When I created the teststep, I chose http. Is this right? If I can get a screen like screen-2, I can replace the Tel-Number by $(#TestCase#Tel-Number).
