SoapUI API/Webservices Testing Part 3
- Internal Links:
- External Links:
restcountries.eu no longer works, restcountries.com works
- Before we start there is news about the link the speaker uses for this video.
- The link from the example https://restcountries.eu no longer works.
- However, there is a https://restcountries.com that looks pretty close to what the speaker was talking about
- It does give us links just like the video.
restcountries.com Navigation
- restcountries.com Home Page has a panel on the left
- There's information about the new version 3 format.
- There is a section for V3 and another for V2
- I'm going to use V2 to get familiar with SoapUI
- In the left panel there is a Heading titled "API ENDPOINTS V2"
- Under that heading, are the following: All, Name, Full Name, etc.
- Just like the instructor in the video, I will use Name
All about Name
- Click the "Name" link under "API ENDPOINTS V2" in the panel on the left.
- The page automatically scrolls to the Name section
- The description for Name is as follows:
- Search by country name. It can be the native name or partial name
- There are three examples of links:
- https://restcountries.com/v2/name/{name}
- https://restcountries.com/v2/name/peru
- https://restcountries.com/v2/name/united
- I believe we can get everything else to work from here, providing we use the newer URLs
- I will update this document to reflect the newer links,
- and because I'm using version 5.7.0 and the video uses 5.5.0
00:30 | SOAP UI - How To Create a Rest Project, Test Suite, Test Case
- he first displays the following from Notepad on his desktop
SOAP UI
How To Create a Rest Project, Test Suite, Test Case
- - - - - - - - - - - - - - - - - - - - - - - - - -
https://restcountries.eu/ - the video uses .eu; we will use .com
00:35 | he opens the above url in his browser
- the Rest Countries page opens
00:52 | he searches for the correct url for the "All" option
- he finds the url
- .eu https://restcountries.eu/rest/v2/all
- .com https://restcountries.com/v2/all
- 01:00 | he opens that url in a browser
- when he first opens the url in his browser, it was completely filled with lines of text, the entire screen, some, very little, in other laguages
Go to Top
- 01:14 | he selects another example, instead of All he selects Name: name/united
- he edits the last folder from "united" to "india"
- 01:21 | this time the browser filled its window with lines of text for 12 lines, roughly one third the "real estate" in the browser window
01:48 | he wants to take a sample
- he chooses a url from the page
- the edited url now looks like this:
02:10 | we all recognize a URL when we see one
- Go to Top
- this is a URL
- https://restcountries.eu/rest/v2/name/india
- https://restcountries.com/v2/name/india
End points, Domains, and Resources
- Go to Top
- 02:17 | End point
- the first part of the URL is refered to as an "End point"
- example: https://restcountries.eu
- example: https://restcountries.com
- an end point contains a domain such as .eu or .com from the above URL
- 02:38 | Domains
- examples of domains: .eu .com .edu .info .gov .net .org
- endpoints contain the domain
- 02:59 | Resource
- the last part of the old url ie: "rest/v2/name/india" is called the resource
- the last part of the new url ie: "v2/name/india" is called the resource
- the server deals with the resource
- a resource can have more parameters by adding a question mark and a parameter
- old example: rest/v2/name/india?population
- new example: v2/name/india?population
03:59 | he will use the url we've been using previously
- old - https://restcountries.eu/rest/v2/name/india
- new - https://restcountries.com/v2/name/india
- he's saying we can send this url as a GET request
4 types of Requests - GET, POST, PUT, DELETE
- Go to Top
- 04:12 | there are GET requests, POST requests, PUT request, DELETE request
- 04:20 | these are different operations we can do .....
04:33 | He list and briefly describes what these request are
- GET - used to mine and Select something from a data base on the server
- POST - Create a new resource in the server
- PUT - Update an existing resource on the server
- DELETE - Delete a resource from the server
Performing a GET request
- Go to Top
- 05:14 | he will use this url: https://restcountries.eu/rest/v2/name/india
- 05:14 | we will use this url: https://restcountries.com/v2/name/india
05:28 | The SoapUI is displayed on his desktop
- he notes there is nothing under the word "Projects" in the Projects pane
3 ways to Create a REST project
- Right-click the word Projects to display the submenu that gives you a menu item for "New REST Project"
- Click File from the menu bar to display the submenu that gives you a menu item for "New REST Project"
- Click the "REST" button in the toolbar to display a dialog box that will create a REST project
the "New REST Project" dialog box
05:46 | titled as: "New REST Project" and a "Close" button on the right
- displayed in the dialog box: Creates a new REST Project in this workspace
- text box labeled as: "URI:"
- inside the textbox is: http://example.com/resource/path/search?parameter=value
- there are also the following buttons:
- a "Help" button, an "OK" and "Cancel" buttons, and an additional button titled "Import WADL..."
-
- looking at the format that the text box wants: http://example.com/resource/path/search?parameter=value
- I break it down in this table below.
|
URL |
Resource |
Path |
Search?Parameter |
Value |
format |
https://example.com |
resource |
path |
search?parameter |
value |
.eu example |
https://restcountries.eu |
rest/v2/name/india |
|
|
|
.com example |
https://restcountries.com |
v2/name/india |
|
|
|
The .eu way
The .eu way
- put it all together and you get : https://restcountries.eu/rest/v2/name/india
- I was surprised that the entire string was classified as a resource
- 06:39 | he clicks the "OK" button
The .com way
The .com way
- put it all together and you get : https://restcountries.com/v2/name/india
- I was surprised that the entire string was classified as a resource
- after clicking the "OK" button
the SoapUI with a REST project
- Go to Top
- the tree view in the Projects panel grew
- 06:46 | the Projects panel looks like this:
the .eu way |
the .com way |
- Projects
- REST Project 1
- http://restcountries.eu
- India [/rest/v2/name/india]
|
|
- The Properties Box is still below the Projects panel
- There are three panels instead of two for SOAP
- there are two panels on the left, and one panel on the right
- the bottom panel on the left has many controls including 3 buttons, "Add..", "Edit..", and "Remove.."
- Go to Top
- instead of one long text box above the panel like in SOAP
- there is a drop-down menu labled "Method" for Get, Put, Post, Delete
- then there's a drop-down text box labeled "Endpoint"
- .eu - the contents displayed in the drop-down text box is: https://restcountries.eu
- .com-the contents displayed in the drop-down text box will be: https://restcountries.com
- the next text box is labeled "Resource"
- .eu - the contents displayed in the text box is: /rest/v2/name/india
- .com -the contents displayed in the text box will be: /v2/name/india
- the next text box is labeled "Parameters"
WADL: Web Application Description Language
06:58 | WADL
- Go to Top
- http://restcountries.eu is the WADL, but this link takes you to a web page
- for the .com way: http://restcountries.com is the WADL, but this link takes you to a web page
- he earlier described how he navigated that web site
- from the tree view in the Projects panel
- the speaker is pointing to the http://restcountries.eu in the tree view in the Projects panel
- the .com way will be http://restcountries.com
- the speaker is saying that this "represents" the WADL
the .eu way
- Projects
- REST Project 1 - - - - - - - - - - - - - - - - - -> (the name of the project)
- http://restcountries.eu - - - - - - - - - -> (WADL)
- India [/rest/v2/name/india]
- India 1
- Request 1 - - - -> (one request)
the .com way
- Projects
- REST Project 1 - - - - - - - - - - - - - - - - - -> (the name of the project)
- http://restcountries.com - - - - - - - - -> (WADL)
- India [/v2/name/india]
- India 1
- Request 1 - - - -> (one request)
07:09 | WADL: Web Application Description Language it is available in the form of XML
- 07:22 | WADL: Web Application Description Language includes the URL
the "Request 1" window
07:47 | double-clicking on the "Request 1" leaf, opens the "Request 1" window with the three panels and the Method, Endpoint, and Resource prompts
- Go to Top
- it appears with the Method set at GET
- the .eu way
- and Endpoint set at https://restcountries.eu
- and Resource set at /rest/v2/name/india
- the .com way
- and Endpoint set at https://restcountries.com
- and Resource set at /v2/name/india
- he says you can pass parameters if you want to
08:12 | he presses the "Run" button
- in the Response pane he received the following text:
- The content you are trying to view cannot be viewed as XML
- Note: on the left side of the Response tab there are four side tabs
the JSON Response
08:23 | How to see the proper response
- Go to Top
- The XML tab has the focus
- he clicks the JSON tab and the Response pane is now filled with JSON data
- for my 5.7.0 version, after clicking the "Run" button,
- the JSON tab automatically took the focus from the XML tab, and displayed the JSON data
- so I did not see the error message for the XML tab until I clicked it.
- 09:01 | this is not a test case, this is a request
- he closes the "Request 1" window
Creating Test Suites and Test Cases
09:07 | based on the WADL (https://restcountries.eu) or (https://restcountries.com) we will create test suites and test cases
- Go to Top
- 09:13 | We have to make sure the leaf that has the focus is labeled (https://restcountries.eu) (soon .com)
- .eu - He first clicks the "Collapse" button for the "India [/rest/v2/name/india]" leaf
. com-He first clicks the "Collapse" button for the "India [/v2/name/india]" leaf
- forcing the "India 1" leaf and the leaf under it, labeled "Request 1", to disappear from view.
- He than clicks on the (https://restcountries.eu) leaf. (soon .com)
- This verifies that the leaf has the focus,
- and he calls that leaf the "WADL".
09:16 | He right-clicks the leaf to display a submenu.
- The speaker is looking for the "Generate TestSuite" menu item from the submenu.
- The screen shot below displays the WADL leaf that has the focus, and the submenu.
the "Generate TestSuite" dialog box
09:20 | the "Generate TestSuite" dialog box is displayed.
- Go to Top
- TestSuite: drop-down text box containing (create)
- Style: with two option buttons, one must be choosen.
- (o) One TestCase for each Resource (default is on)
- ( ) Single TestCase with one Request for each Method
- Resources: "Select all" "Unselect all"
- [x] India: /rest/v2/name/india (is in a large text box that could hold more than one resource)
- This one looks like it's check box is turned on.
- when using .com, the "/rest" will be gone from the path for the resource.
- Generate LoadTest [ ] Generates a default LoadTest for each created TestCase
- The check box for this is turned off.
- There are three buttons: a "Help" button, an "OK" button, and a "Cancel" button.
- 09:24 | He is accepting the defaults and clicks the "OK" button.
- Go to Top
The smaller "Generate TestSuite" dialog box, that wants the name.
09:26 | a smaller dialog box titled "Generate TestSuite" is displayed
- Go to Top
- within the dialog box are the following controls:
- a text box labeled: "Enter name of TestSuite to create"
- with the following contents as a default: https://restcountries.eu TestSuite
- When we use the .com, we will see that reflected as the default.
- the dialog box includes an "OK" and "Cancel" buttons
Go to Top
- 09:38 | he changes the name from "https://restcountries.eu TestSuite" to "CountriesTestSuite"
- 09:38 | later it will be .com "https://restcountries.com TestSuite" to "CountriesTestSuite"
- Here's a screen shot after the name change.
the TestSuite is created
09:42 | he clicks the "OK" button and the TestSuite named "CountriesTestSuite" is created
- Go to Top
- here's a screen shot after clicking the "OK" button
- here's my screen shot from v5.7.0
09:43 | he closes the "CountriesTestSuite" window
- Go to Top
- he expands the TestSuite and a leaf is displayed named "India TestCase"
10:00 | I think he right-clicks "India TestCase" and a submenu is displayed.
- Go to Top
- a screen shot of the submenu is below
- The 5.7.0 Rename TestCase dialog box - before renaming
- The 5.7.0 Rename TestCase dialog box - after renaming
- The 5.7.0 Tree View from the Projects panel - after renaming
10:02 | He demonstrates the "Rename" menu item and "Rename TestCase" dialog box.
- Go to Top
- he renamed it from "India TestCase" to "TestCase1"
- the screen shot below displays the tree view after the re-name.
- the other three leaves popped up after he clicked the "OK" button from the "Rename TestCase" dialog box
- Note that the three leaves belonging to the leaf labeled "TestCase1"
- have parentheses with either a "1" or a "0"
- a "1" for "Test Steps(1)" contains just one request
- "Load Test(0)" and "Security Tests(0)" I believe have no request within them
10:11 | he clicks the "Expand" button for the leaf named "Test Steps(1)"
- Go to Top
- a leaf is displayed below it named "Request 1"
- here's a screen shot of it
10:18 | he clicked the "Request 1" leaf and the "Request 1" dialog box appears
- Go to Top
- and this looks more like the Request and Respond panels from SOAP
- a screen shot of this is below
10:23 | He's pointing out objects in the window, using his mouse cursor.
- Go to Top
- The Endpoint as https://restcountries.eu
- The Resource as /rest/v2/name/india
- we get the resource from the server
- that .eu above will become a .com
- and we will lose the /rest folder because .com doesn't use a named folder like that
10:30 | he clicks the "Run" button
- Go to Top
- he receives the message:
- The content you are trying to view cannot be viewed as XML
10:32 | He says: "Let's change the format".
- Go to Top
- What he does is click the sideways "JSON" tab
- and the Response panel displays JSON data.
- here's a screen shot below
10:43 | he says we are sending the request as a URL
- Go to Top
- He says: We just ran a test case.
Adding an Assertion
10:51 | Once we created a test suite and test case,
- we can add one Assertion to the response.
10:58 | As an example, he clicks the Run button, switches to the JSON tab,
- He scrolls thru the JSON code until he finds "name",
- with the contents of "British Indian Ocean Territory".
- He says: I can place an assertion on this.
the Assertions(0) button
- the zero (0) represents that no "Assertions" have been made
11:25 | after clicking the "Assertions(0)" button
- Go to Top
- The Request and Response panel made room for a new panel to be displayed underneith both of them
- The new panel is displayed in the screen shot below.
11:29 | He clicks the Plus (+) button which "Adds an assertion to this item" as the tool tip points out.
- Go to Top
- A new dialog box is displayed titled "Add Assertion".
- A screen shot of the "Add Assertion" dialog box is shown below.
8 Assertions to choose from
11:32 | There are eight assertions that can be chosen from.
- Go to Top
- Two of them are greyed out, meaning we can't use them.
- Recently used
- Property Content
- Compliance, Status and Standards
- Script
- SLA
- JMS
- JDBC
- Security
- Go to Top
- Note that in the screen shot above, "Recently used" had the focus
- It's description is displayed on the right side of the screen as:
- Contains
- Searches for the existence of a string token in the property value,
supports regular expressions. Applicable to any property.
The screen shot below displays the text for the "Property Content" assertion.
11:35 | He selects "Property Content" from the group of Assertions.
- Go to Top
- There is more text in the description section of the dialog box.
- Contains - Searches for the existence ...
- JsonPath Count - Uses an JsonPath expression to count...
- JsonPath Existence Match - Uses an JsonPath expression to select content...
- JsonPath Match - Uses an JsonPath expression to existence of a node ...
- JsonPath RegEx Match - Uses an JsonPath expression to select content...
- and there's more
- Go to Top
- 11:39 | He goes back to the "Recently used" assertion.
- 11:50 | He clicks the "Add" button in the lower right hand corner of the "Add Assertion" dialog box.
- 11:51 | The "Contains Assertion" dialog box is displayed.
11:57 | Since he earlier copied "British Indian Ocean Territory" into the clipboard
- Go to Top
- he pasted that into the "Content:" box
12:07 | he discusses other options for the "Contains Assertion" dialog box
- Go to Top
- the "Ignore Case:" check box - he leaves it blank
- 12:11 | He then clicks the "Contains Assertion" dialog box's "OK" button.
- The dialog box disappears, and the "Assertions(0)" button now has a one "Assertions(1)" instead of zero.
- And it's indicator light is green, letting us know that it's not empty
- Before it's indicator light was black, letting us know it's empty
- here's it's screen shot
12:21 | In the tree view, the "Request 1" leaf's indicator light, also went from black to green
- Go to Top
- Green indicates there is something in there.
- here's a before and after picture
12:27 | he says if you want to modify the session
- Go to Top
- you click the "Assertions(1)" button located near the bottom of the window
- and like before, a panel opened up under the request and respond panes.
- However this time there is some text inside the pane:
- A green indicator light, then the text: "Contains - VALID"
- With the mouse cursor near by, he display's it's tool tip as: "Assertions for this request"
- here's a screen shot
12:30 | By clicking on the word VALID, a small submenu for two menu items, "Add Assertion" or "Online Help" is displayed.
- Go to Top
- 12:32 | by clicking the or right-clicking, I don't know yet, on the word "Contains -" another submenu is displayed
- also with an "Add Assertion" menu item
- but more important, is the "Configure" menu item used for modifying the Assertion.
the VALID submenu |
the Contains submenu |
|
|
12:33 | he selects the "Configure" menu item from the submenu
- Go to Top
- and the "Contains Assertion" dialog box is displayed
- Note the "Content:" is "British Indian Ocean Territory"
- He will edit the "Content:" by removing the word "Territory"
Content with Territory
Content without Territory
12:38 | He clicks the "OK" button and the "Contains Assertion" dialog box disappears.
- Go to Top
- Note that the text "British Indian Ocean Territory" is still selected,
- probably from the first time he copied it to the clipboard.
- here's the screen shot
12:52 | he wants to run the test case
- Go to Top
- he first closes the "Request 1" window
- he then clicks the "Request 1" leaf from the tree view and the "Request 1" window reappears
- he clicks the "Run" button
- he then clicks the sideways "JSON" tab to see the JSON data in the Response pane.
- the screen shot of this is below
13:02 | he closes the "Request 1" window
- Go to Top
- he says suppose you have multiple test cases you can execute them as a group
- I cannot figure out what he's saying: as a less sequential balance
- we can go to the "TestCase1" level
- he clicked the "Collapse" button for the "TestSteps(1)" leaf
- which hides the "Request 1" (test case ??) leaf
the "TestCase1" dialog box
13:12 | he clicks the "TestCase1" leaf
- and the "TestCase1" dialog box or window is displayed
- Go to Top
- 13:13 | Here's a screen shot of the "TestCase1" dialog box.
13:14 | the "TestCase1" dialog box's controls
- Go to Top
- the top button tool bar includes a "Run" button within the 9 buttons displayed under the title bar
- underneath that there looks like a text box, buts it's actually a status bar
- underneath that there's two tabs labeled "TestSteps" and "Test On Demand"
- it looks like the "TestSteps" tab has the focus
- under the tabs is another set of 17 buttons
- under that is a large text box with a green indicator and "Request 1" the test step is already in there
- under that is a text box with a slider control labeled: "TestCase Description"
- it's contents: TestCase generated for REST Resource [India] located at [/rest/v2/nam....
- the .com will eliminate the "/rest" folder, TestCase generated for REST Resource [India] located at [/v2/nam....
- under the slider control appears to be four buttons:
- Description, Properties, Setup Script, and Teardown Script
- and more stuff below that
13:17 | he's pointing to the "Request 1" with the green indicator that's in the large text box
- Go to Top
- he says it has one step for now
13:20 | and if you want to run this, just click on the "Run" button
- he clicks the Run button and the empty Status Bar displays the word FINISHED and the whole area is green.
- here's the screen shot of this dialog box after the Run button was clicked
13:27 | he closes the TestCase1 dialog box after the run
- Go to Top
- he says: sometimes you can have multiple test cases
- he might be saying, its hard to tell: you may want to run them singularly or parallel
- he says: than you have to select the Test Suite from the tree view
- he collapses the "TestCase1" leaf and then clicks the "CountriesTestSuite" leaf
the "CountriesTestSuite" dialog box
13:35 | he double-clicks on the TestSuite named "CountriesTestSuite" bring up the "CountriesTestSuite" dialog box
- Go to Top
- below is a screen shot of the "CountriesTestSuite" dialog box after he clicked the "Run" button
13:45 | running multiple test cases
- Go to Top
- Inside the larger panel that displays "TestCase1" not as a tab,
- its also the place holder for the second FINISHED status bar
- he says: if you have more numbers of test cases
- you can click the button with the two right arrows under the title bar.
- I think you run several test cases one at a time by clicking that button.
- 13:55 | he talks about the button that's to the left of the double arrow button
- its tool tip displays: "The selected TestCases are run in sequence"
- 14:05 | he closes the "CountriesTestSuite" dialog box
14:12 | he reviews what we accomplished
- Go to Top
- the following text is from his Notepad from his desktop
-> Create Rest Project using URL(WADL)
-> Create test suite and test cases
-> Add contain assertions
-> Execute tests in sequence and parallel
-> Documentation
How to produce "Documentation"
14:36 | he talks about the last item in that list: How to produce "Documentation"
- Go to Top
- he leaves Notepad and goes back to displaying the SoapUI
- he selects the WADL (the "https://restcountries.eu" leaf in the tree view)
- when .com, leaf will display https://restcountries.com
- here's the screen shot of the tree view
14:43 | he right clicks on that leaf to display it's submenu
- Go to Top
- here's the screen shot of the submenu
14:44 | he moves his mouse cursor over the "Create Documentation" menu item
- Go to Top
- he clicks the menu item and the "Create Report" dialog box is displayed
- here's its screen shot
14:52 | he clicks on the "Browse" button and selects a folder to store his documentation
- Go to Top
- the Browse buttons opens a dialog box similar to the "Open" dialog box in Windows
- he decides to use "E:\soapuidoc", a folder he earlier created to save all his documentation
- after clicking the "Open" button from the "Open" dialog box
- the "Open" dialog box disappears and the folder he has chosen is displayed in the "Output Folder:" text box in the "Create Report" dialog box
15:05 | he clicks the "OK" button in the "Create Report" dialog box
- Go to Top
- a small "Progress" message box is briefly displayed
- here's it's screen shot
15:07 | it creates a new document that gets displayed in your browser
- Go to Top
- here's it's screen shot
15:07 | by looking at the URL text box, we can see it's a local file: E:/soapuidoc/wasl-report.html
- Go to Top
- the file extension is .html, therefore displayed in a browser
15:14 | he briefly discusses what's in this document
- Go to Top
- he points out the first line: https://restcountries.eu
- he says: this is the actual URA
- he then points to the line under the bulleted Resources
- the lines contents: https://restcountries.eu/rest/v2/name/india
- this is the actual request we are sending
- and he says: the GET request we are sending
- note in this document, the text "GET" is under the word "Methods"
- ".com" will replace the ".eu", and the "/rest" folder will no longer be needed in the path
YouTube Videos
using the v1/film endpoint
REST Resources
Learned from Joe
From one of Joe's screen shots using Endpoint Explorer
- Go to Top
- Method: GET
- Endpoint: https://api.us.veezi.com/v1/film
- Header: VeeziAccessToken
- Value: 19m3sgh48vcax1p9mmhp4dd87w
To change the Response to XML, use the following in the "Authentication & Headers" tab on the "Endpoint Explorer"
- First you click the "+ Add header" in the "Authentication & Headers" tab
- 2 new text boxes show up, one under Header and another under value
- Header: Accept
- Value: application/xml
other Endpoints that worked
- Endpoint: https://api.us.veezi.com/v1/filmpackage
- Endpoint: https://api.us.veezi.com/v1/screen
- Endpoint: https://api.us.veezi.com/v1/attribute
- Endpoint: https://api.us.veezi.com/v1/session
- Endpoint: https://api.us.veezi.com/v1/websession
Adding a Film Id to the Endpoint
- https://api.us.veezi.com/v1/film/ST00000144
Screenshots of the single film that belongs to id: ST00000144
Same Id used with the Endpoint Explorer
Before the Send Button
After the Send Button
Buried in the XML Schema is the Id that = ST00000144
Screenshots of SoapUI Requests that worked
- the Endpoint Explorer has a way to save the Request, and the following screen shot was made
Using the additional header of Accept and value of application/xml
Running the Request thru the other Request window, and I got XML !!
- After saving the Request in the Endpoint Explorer, I was able to run the request from the Tree View in the Project pane.
Reserve
00:00 | reserve reserve
- Go to Top
- reserve
- reserve
- reserve
- reserve
Reserve
- Go to Top
- reserve
- reserve-grey
- reserve-red
- reserve-grey2