How do you approach testing?
One aspect of this field I have always been curious about since day one is: how do other people approach testing? I've been developing and building our testing requirements and procedures and am always interested to see how other people and teams handle their tests.
For example, I usually work SOAP services, and usually a service fits into one of three categories:
- Read Service where the source data is external and is ingested.
- Stand-alone service that is Read/Write all in one WSDL/Schema package.
- Service pair where the Read and Write services are both individual to each other but work in conjunction.
Most of my tests are the 3rd of the list, and there are a few that match 1 and 2. I'll walk through my approach for the read/write pair since that closely matches both the 2nd and 3rd.
- Analyze the write object and write a groovy script to generate data based on uniqueness required from business rules.
- Determine the different possibilities of a Write.
- Build at least one write test for each possible combination, if possible.
- Also build a write test to later update, and one to delete.
- Follow the same pattern for Delete, if there are choice models make a test for each of those.
- Similar for update.
For all of these, I will have one overarching test suite that contains one test case for each of the operations. It'll look like:
- Test Suite
- Add Test Case
- Update Test Case
- Delete Test Case
Read services are similar, in that, I'll have a test case for each of the operations. Read services are usually less complex in that they only have a Get or an Is method, but often offer different branching conditionals or logical operators that can be used to query against the data from Write. Here, I tend to cover as many logical/conditional read steps as I can and often leverage a groovy script assertion to validate the response matches the query made.
- I can usually have an combination of:
- Element Equals/Does not equal/contains/does not contain
With that, I'll work with all of the available filters to cover as many cases as possible to show that the Read service works as intended. The And/OR statement lets me chain different queries together and just adds another layer of stuff to test.
That's just a quick and brief overview of how I approach testing. I'd love to learn and see how others attack their services. :)