Functional Testing of Web Services - Software Test Consulting

0 downloads 117 Views 145KB Size Report
Sep 22, 2003 - ➢Web means HTTP protocol,. ➢Services means request – response. ➢Web services is a stateless proto
Yury Makedonov

p. 1 of 12

Functional Testing of Web Services Yury Makedonov, CGI

2004 International Quality Conference, Toronto, Ontario, Canada © Copyright 2004 – CGI Group Inc.

September 22, 2003

September 22, 2004 Functional Testing of Web Services, QAI Conference

1

Agenda ¾ Why we are getting more and more web services testing ¾ What are web services ¾ What is XML ¾ How to test web services ¾ Test Approach ¾ Tools

¾ Summary ¾ Q&A ¾ Intended audience: Testers without development background September 22, 2004 Functional Testing of Web Services, QAI Conference

International Quality Conference, Toronto, Ontario, Canada

2

September 22, 2004

Yury Makedonov

p. 2 of 12

Introduction ¾ Webservices have no GUI. Typically this type of testing is performed by developers. ¾ Independent testing teams started getting more and more webservices testing projects ¾ Why are webservices so special?

September 22, 2004 Functional Testing of Web Services, QAI Conference

3

Why web services? ¾ Web services are a simple interface using HTTP protocol. ¾ Web services can be: ¾ developed by one company, ¾ used by another company, and ¾ hosted by a third company.

¾ Such involvement of several companies is a business cases for independent testing of web services.

September 22, 2004 Functional Testing of Web Services, QAI Conference

International Quality Conference, Toronto, Ontario, Canada

4

September 22, 2004

Yury Makedonov

p. 3 of 12

What are web services? ¾ What’s in the name Web Services? ¾ Web means HTTP protocol, ¾ Services means request – response.

¾ Web services is a stateless protocol ¾ we send a request, ¾ we receive a response, ¾ we are finished.

¾ Why is this so important from testing point of view? ¾ Because we can prepare independent test cases that are

separate files. This makes our test approach relatively simple. 5

September 22, 2004 Functional Testing of Web Services, QAI Conference

XML ¾ Web services use XML encoded ?> ¾ ¾ ¾

Tove

¾

Jani

¾

Don't forget me this weekend

¾

¾

Note.dtd: ¾ ¾ ¾ ¾ ¾

Tove

¾

Jani

¾

Don't forget me this weekend

¾

September 22, 2004 Functional Testing of Web Services, QAI Conference

International Quality Conference, Toronto, Ontario, Canada

10

September 22, 2004

Yury Makedonov

p. 6 of 12

Sample – “Schema Definition” – Schema ¾

Note.xsd: ¾ ¾

September 22, 2004 Functional Testing of Web Services, QAI Conference

International Quality Conference, Toronto, Ontario, Canada

12

September 22, 2004

Yury Makedonov

p. 7 of 12

How to learn XML ¾ Do we need to know all intricacies of XML, DTD, and XML schemas to start testing of web services? ¾ No! ¾ With basic XML principles, described above, you can start development of XML test data files! ¾ I recommend an approach for XML learning: ¾ Get sample XML files with corresponding DTD or XSD files

for your new webservices project. ¾ Go through major elements and try matching definitions from

DTD/XSD and corresponding XML data. ¾ Use web sites (e.g. http://www.w3schools.com) or XML books

as additional sources of information. 13

September 22, 2004 Functional Testing of Web Services, QAI Conference

Testing web services – Test Approach ¾ When testing webservices we use the same approach as for any other testing project: ¾ identify requirements, ¾ Prepare high level test cases, ¾ Document detailed test cases, etc. ¾

What would be an outcome of a test planning phase: ¾ a set of test cases described in plain English language and

based on a requirements document, ¾ a corresponding set of XML files.

September 22, 2004 Functional Testing of Web Services, QAI Conference

International Quality Conference, Toronto, Ontario, Canada

14

September 22, 2004

Yury Makedonov

p. 8 of 12

Sample test case ¾

Requirement: ¾ “Location type” can be blank in a request

¾

Test case brief description: ¾ “Location type” is blank in a request

¾

XML test data file: ....... 1600 .......

15

September 22, 2004 Functional Testing of Web Services, QAI Conference

How to prepare XML test files ¾ How to prepare XML test files: ¾ We have to get a sample XML file from a software developer

and to enter our values of parameters. ¾ This is not so terribly different from a standard GUI testing. ¾ The only difference:

we have to enter our data into “fields” of XML document instead of fields of GUI.

¾ We have to follow a standard testing procedure, familiar to every black box tester and to use standard testing techniques when testing Web Services: ¾ valid and invalid data, ¾ boundary values, ¾ equivalence partitioning, etc. September 22, 2004 Functional Testing of Web Services, QAI Conference

International Quality Conference, Toronto, Ontario, Canada

16

September 22, 2004

Yury Makedonov

p. 9 of 12

Tools – to prepare XML test files ¾ What tools to use for XML files preparation: ¾ Whatever you have, ¾ from Notepad ¾ and Microsoft Word ¾ to XMLSpy

¾ My favorite tools are: ¾ Notepad (or TextPad for bigger files) ¾ XMLSpy

17

September 22, 2004 Functional Testing of Web Services, QAI Conference

Tools – to execute a test ¾

We have prepared a set of XML files that represent our test cases.

¾

Next step is to process these files.

¾

To process XML files (XML requests) we need: ¾ to POST an XML file (to send it to a specific URL and port), ¾ to capture an XML response and to save it into a file.

¾

We need a tool to do this.

September 22, 2004 Functional Testing of Web Services, QAI Conference

International Quality Conference, Toronto, Ontario, Canada

18

September 22, 2004

Yury Makedonov

p. 10 of 12

Tools – to execute a test ¾

Load Testing tools ¾ Natural choice is any load testing tool, designed to handle

HTTP traffic. ¾

XMLSpy. ¾ XMLSpy can POST a SOAP document and capture a

response. ¾

Custom tools/script: ¾ A Perl script or a Java program can be developed to send a

request and to capture a response. ¾

Empirix eTest: ¾ Commercials tool to test SOAP based web services.

¾

Many more options. 19

September 22, 2004 Functional Testing of Web Services, QAI Conference

Analyzing results ¾

After we have XML response files we have to compare them against expected results, described in our test cases.

¾

Typically we have to verify values in some specified fields.

¾

That task is not so different from a standard GUI testing.

September 22, 2004 Functional Testing of Web Services, QAI Conference

International Quality Conference, Toronto, Ontario, Canada

20

September 22, 2004

Yury Makedonov

p. 11 of 12

Regression testing ¾

In case of a regression testing we can use a less time consuming approach.

¾

We can automatically compare a new set of XML responses to a previous set, using: ¾ WinDiff.exe, ¾ XMLSpy, ¾ MS Windows commands: “Comp” or “fc”

21

September 22, 2004 Functional Testing of Web Services, QAI Conference

Summary ¾

Testing of web services is not so different from a standard GUI testing,

¾

New skills to learn are relatively simple (half a day or a day to learn),

¾

Typical testing team already has most skills and knowledge required for this type of testing,

¾

Testing web services can bring additional job and visibility to an independent test team.

¾

Let’s leverage our skills and knowledge to a new field.

¾

Let’s test web services.

September 22, 2004 Functional Testing of Web Services, QAI Conference

International Quality Conference, Toronto, Ontario, Canada

22

September 22, 2004

Yury Makedonov

p. 12 of 12

Contact Information ¾ Yury Makedonov (416) 481-8685 [email protected] http://www.ivm-s.com

23

September 22, 2004 Functional Testing of Web Services, QAI Conference

References ¾

The above examples are from: CGI projects http://www.w3schools.com, http://www.intertwingly.net/stories/2002/12/20/sbe.html

¾

You can find more information on XML on these and many other web sites.

September 22, 2004 Functional Testing of Web Services, QAI Conference

International Quality Conference, Toronto, Ontario, Canada

24

September 22, 2004