Monday, February 18, 2013

Testing a web service (Part 1)

I want to do some testing on currency converter. This service is being used by thousands of websites and therefore, you may say it is completely bug-free and reliable. BUT, this is a good example to show you this is not correct. Even if I can't find any bug in the software, it doesn't mean that it is bug-free. This is one of the principals of software testing.

Ok, Let's start. first of all, we need to get familiar with the web service. The currency converter's duty is simply converting a currency to another. You can send "From" and "To" currencies using a Get or Post method and receive XML string that contains the latest conversion rate.Usually SOAP API connections are the best method using such services. 
You can read more about this service by following this link.

Now I need to study and think about the product to design some test cases based on answers to following questions:
  • What does that service supposed to do?
  • What does that service NOT supposed to do?
  • What are inputs and outputs? What are the types? 
  • How can I use the service?

The last question harder to answer. There are many ways to use the service, such as:
  • creating a webpage with form and upload it into a web server that supports SOAP.
  • Adding web service url directly to our libraries or preferences (depends to what compiler or development environment is being used).
  • communication with web service directly with a soap client, using Python, Perl, Java and so on.
  • creating your own version of SOAP to process XML.

At the end, I decide to work on following test cases:
  1. Request a conversion rate from USD to BRIC nation currencies, and make sure that conversion from each side to another would return a logical value. For example if XXX to YYY is returning 10, then YYY to XXX must return 0.1
  2. Request conversion rate from any currency to another (I will try BRIC nation currencies)
  3. Request a conversion rate from/to USD and a fake (not existing) currency.
  4. Test Null as a currency.
  5. Test for conversion a currency to itself.
  6. Test few minor currencies to make sure they are not returning unexpected values.
There are many more test cases that you can create, but I stop here and will continue for more tests after I have finished working on current ones.
Please note that I am not going to test the correctness of the returned values. Likewise, I assume the web service is ready to test and there is no restriction or limit in my internet connection, available protocols, firewall, etc.

No comments:

Post a Comment