How to Create a Test in SoapUI Pro


in this video we’re going to cover test
creation in soap UI Pro we’ll add validations with assertions we’ll make
our request dynamically populate values from an external excel file and we’ll
generate a report based on the findings to create tests in soapui pro we first
need to create a project so we can go file new soap project provide a project
name such as we’ll call this one demo and then we provide the wsdl to a web
service that gets us with the weather information once we click OK we parse
the wsdl for all available operations where we can see the sample requests
against each operation then from sample operation we can quickly add the
operation to the test case so if we right click on the sample operation
click on add to test case we can generate a test suite that will hold our
test case that we’ll add our get city forecast by zip step right in the test
case so here’s the test case that we generated with the get city forecast by
zip step where we can supply different zip codes such as 02111 and submit
that into our web service behind the scenes the data we submit and receive is
still XML format but you can see we have friendly editors that allow us to type
stuff into the form view and receive it in overview and outline views for easier
representation to the user in addition to that we can use the outline view to
easily create assertions a quick validation checks so for example
if we want to validate that success element always comes back with the value
true it’s as easy as right-clicking on the success element saying add assertion
for content and that creates an XPath assertion that points down to the
success element and we check that the result value is always true so we’ll
save that assertion and every following check we do will confirm that that
element is in the response so now we can submit many different zip
codes validate that everything works as expected so we can go back into our test
case and instead of manually changing every different zip
we’ll use data-driven testing scenario so we’re going to add a different type
of a step called data source give it a name and then we can go to an external
data source such as file for CSV or other delimited files JDBC to add a
connection to a database pull data through a select statement or in this
case we can use an excel file to look at the data pulled into our test case so
I’m going to browse to a local file that I’ve created called zip codes so I’m
just going to select that in here you can see the file that I’ve created it
contains a first column of zip codes and the corresponding cities that should
correspond to the ZIP codes as provided in this input file then we can
add properties that will correspond to each column so first column that we had
contained contains zip codes so we’ll create probes if second column that will
create will contain the city information the people from an excel file and
another thing is if we look at this excel file the first column actually
contains names we can completely omit the column header names and we can start
pulling data with cell a2 so with this quick configuration we can quickly hit
play to pull in the first 10 rows into our datasource element and you can see
that we pull in data directly from an Excel spreadsheet into our test step so
now we have propzip and we have prop city declared right in soap UI with data
from external excel file going back into our test case we can move that data
source to be first so we can pull that data first so accidentally opened it and
then we can go into the request and instead of using a hard-coded zip code
of 02111 we can erase that and point to a datasource property to do
that in soapuiPro again we can right click do get data and point to a
datasource previous that within our test case and point to a
prop zip now it will populate the zip codes from the zip column in Excel
spreadsheet into this request and send that in in the second column if you
remember we had a city that should have corresponded to the zip code that we
sent in so we can quickly add an assertion for that so you’ll see I
opened the assertions tab but in outline view I can select a city add another
assertion for content and instead of using a hard-coded value of Boston for
the response I can quickly map that to a datasource element of city so again I’m
right-clicking in the expected result browsing to my datasource step and
selecting a prop city property that we’ve defined just about a minute ago so
now I have two assertions for XPath one the checks the success element is there
and it’s true the other one is that the city element is there and that it equals
to the value we pull from an excel file so we’ll go back to our test case and
we’ll add a final step called datasource loop so that we can loop and iterate
through all of the values in our datasource so once we add the datasource
loop step I can double click to configure it to go back to the
datasource fetch the next row and populate the values from the next row
into this request so we can click OK and hit play this will fail a test case at
some point but I am expecting that so as we run through all of the different
values you can see that we loop through step one where we send a zip code of
02111 where we find our success information here for the city of
Boston Massachusetts so all of our assertions pass for the second row we
pass in zip code of 92199 and we are able to get the response
that also contains success true element for San Diego California it looks like
the third row worked fine as well because that step is highlighted in
green but for the fourth row the assertions fail the steps for
all the test case failed and we were able to raise that to your attention
with this red step and failed test case so we can double click go in and for zip
code 11111 the response actually did not contain a city and not
only that but the success element was false as you can see right in the
response so now that we were able to find that out we may want to print the
report and actually share that with the rest of our QA team to question the
input file that’s been provided so to generate a report out of this test case
you can click on this icon that I’m highlighting right now and then generate
a test case report I’m just going to accept the defaults and this will
generate a report that provides the test metrics that describe the project the
steps that you’ve provided within the project and the actual metrics so this
is the important information that includes start time end time and time
taken so you can see it took me just under two seconds to run this test case
but the important part here as well is the number of failed tests step counts
so you can see here I actually have a single failed test step so that deserves
my attention and I need to get to the bottom of why it failed below the
metrics we have detailed step results so we have our get city forecast by zip
failure where we failed information for the zip code of 11111 you can see
here for example we expected the success value true but the actual value received
back was false and in addition to just this description in the report we also
provide full information for the failed test step so we’ll provide you with the
status the messages to contain the description properties including the
endpoint so if you are testing against multiple environments such as dev UAT
potentially three different UAT environments this endpoint will tell you
which environment this step failed in and then we provide the full request and
response that was sent and received from the web service so
here for example we can see that in the full response we can double check that
success came back as false so you can take this report save it as a PDF Excel
HTML as many different formats share that with the team so this point point
we were able to provide steps on generating the test case using
data-driven functionality to vary the inputs into your test case validate
everything with assertions and then generate a report based on our findings
so hopefully this gave you a good overview on how to get started using soapUIpro I thank you for your time

Leave a Reply

Your email address will not be published. Required fields are marked *