views:

27

answers:

1

I'm writing tests that check that an external service is providing inventory data (on their test server) that I can check out with, and also cancel. This testing is in the travel/hotel world, and I need to place test reservations, then cancel them.

I take the following steps : 1) search for inventory(a hotel room) 90 days in the future 2) get the first result, and do a test checkout with it 3) cancel the order and confirm I get a cancellation number 4) confirm the appropriate database entries are performed

This testing touches wide ranging parts of the system, and I don't (currently) have mechanisms to isolate each of them. I therefore don't consider this unit testing. However, would this be called functional testing, or something else?

As a follow up, it will probably help to isolate and write tests for each of the subsystems I'm interacting with. Where would you guys start in the isolation process?

A: 

Each of those steps you listed is a good candidate for an isolation:

  1. Get inventory
  2. Check out
  3. Cancel
  4. Get cancellation #

Stringing them together as you do now is only a function of each of them working individually anyhow.

You're currently testing for functionality (good!) but you didn't mention robustness.

I would make a suite of data for each function (as I have listed) that would try to break it and probe corner cases. Try to book in the past, try to over-write POST data, try to over book a room, try to simultaneously book the same room twice, etc. This is all stored as input parameters in a test you have written just for one isolate of your application.

The different isolates will have different data that is useful/meaningful to test with, but with each change/commit/build, you should be able to run the test data against each function and have the results be valid (IE you return a query, check out a room, cancel the reservation, or get the cancellation #)