Skip to main content

Testing Generally

I sometimes consciously split the functionality I'm testing into two parts: general: behaviour that is the same, or similar, regardless of where it appears, how it is invoked and so on; and specific: which differs according to function, context, time, data types etc. 

I'll tend to do this more on larger projects when the areas are new to me, or to the product, or if they're complex, or I think the test framework will be complex, or the specific is heavily dependent for its delivery on the general, or perhaps when the specific details are certain to change but the general will be stable.  

I'll be looking to implement automation that concentrates first on general functionality and self-consistency and that will serve as a backstop when I move on to the more specific material. 

To speed things up, to get wider coverage easily, and to avoid dependencies, I'll try to avoid crafting new test data by looking for data already in the company that can be reused. Static dumps from live servers can be good, but dynamically changing internal landfill instances are gold dust because they'll be running the latest Dev build and generating new data all the time.

Take the example of a server which exposes an API using HTTP. The API gives clients access to resources (by URLs) and actions on those resources (e.g. searching across back-end data sources).  My functionality breakdown might include the following:
general: each resource is exposed to a client as custom data structures but some properties will be shared across resources, e.g. "children" always represents sub-resources whose URL can be derived from the resource itself.  
An interesting subset of general functionality is those based on standards. In this case, the HTTP standard for client-server communications is  well-defined and independent of your product (although your product may only implement parts of it and there are areas in which there is leeway for client and server to choose an action).  
specific: any functions on the resources that are outside of HTTP are specific. For example, the query parameters on URLs will have a specific meaning to this server.
So how might I set up general testing, using pre-existing data here?

There's a huge space of potential tests to do with conformance to HTTP RFCs. As these tests are, for the most part, independent of  the data in your system  you can implement them without worrying about what data you have (if you request a resource that's not there, the system should respond with a 404).

A particular general test  might request the children of a collection resource (effectively a folder) and then request each of them in turn. If they all exist, it confirms a degree of consistency between the back-end data, its presentation in the API, and the client-side view of it. Conversely, requesting a resource that you know should not exist (e.g. http://myserver/collection/thiswasnotachild) can confirm error behaviour. Note that you can not confirm that all of the children that should be there are present this way, without extra knowledge of whatever backs the server.

A subclass of specific tests is close to general: system meta data. That is, a set of attributes of the product that are true regardless of the data that's in the system.  In the server example, perhaps there is a finite set of resource types that the server will enumerate. You can cheaply check that the server's list agrees with a list in your test suite without knowing what data is stored for any of those types.

If there is a lot of data in your test systems, randomising access to it lets you trade run-time of a given invocation of the suite against cumulative coverage over time, because different sets of data will be visited on each run. You can implement a cache of what's been touched in recent runs and avoid it later although I have found this not worth the hassle. On a landfill server, data can change under your feet which adds another dimension to the testing. And note that  it can be productive to run the suite against servers without any data in their back-end stores at all. 

These kinds of suites can also be parameterised. For example, we could ask the randomisation to run tests for a certain period of time, to a certain depth or breadth, for a certain number of data items or some other limit or search strategy.  In an  automated GUI test suite we're building at the moment, we're playing with parameters representing user behaviours such as "fast" vs "slow", "keyboard" vs "mouse" and so on for different invocations of the suite - running the same tests in different ways.

So why might this kind of testing be interesting?
  • It puts you in the product (or in the technologies on which the product depends) immediately, learning about both, getting background for the specific testing and testing to a level that is practical and sensible at any given time.
  • You quickly flesh out the basic structure of your test harness, learn what kinds of utility functions you'll need and the like. This can be invaluable when you're ready to extend to specific tests because you've got the infrastructure in place already.  I try to partition the two sets of tests so that I can run them separately.
  • You end up testing against all sorts of malformed data (intermediate formats; buggy data, crafted data from the dev team, antique data from previous releases...) and learn a lot about how the application copes with them.
  • Consistency is a testing watchword (see e.g. FEW HICCUPPS) and time spent understanding the baseline level of consistency of a feature or product is seldom wasted.General testing is a lot about consistency.
  • When you're ready to, and if it makes sense to, you can extend to creating data as well. If I do this, I make a point of cleaning up test suite data at close.
It's clear that this approach has limitations. In particular, although it's data-driven, it's driven by the data that is present and by a one-sided view of that data. If it passes, it will tell you that  no inconsistencies were found in the data and functionality touched by a particular run, but no more.

Despite this, it can be very productive and later become a regression test that extends as the data you point it at evolves. There's usually suitable data lying in your dev and test environments that belongs to you, was otherwise redundant and that you can get the extra value from.


  1. So would it be fair to say that for you, "specific" means cases which verify specific data (or a known set of data) whereas "general" means cases which don't rely on any specific data, for which any data set could be used? (Or which are good for verifying large and varied data sets.)

  2. @Jenny: Pretty much. I don't think I'd phrase it as "verifying data", though. I think of it more as executing sets of checks against the software may or may not have specific dependencies, although they are primarily data dependencies in this example. Other dependencies might include configuration options, user accounts, server-side plug-ins, additional licensed features etc.


Post a Comment

Popular posts from this blog

Enjoy Testing

  The testers at work had a lean coffee session this week. One of the questions was  "I like testing best because ..." I said that I find the combination of technical, intellectual, and social challenges endlessly enjoyable, fascinating, and stimulating. That's easy to say, and it sounds good too, but today I wondered whether my work actually reflects it. So I made a list of some of the things I did in the last working week: investigating a production problem and pairing to file an incident report finding problems in the incident reporting process feeding back in various ways to various people about the reporting process facilitating a cross-team retrospective on the Kubernetes issue that affected my team's service participating in several lengthy calibration workshops as my team merges with another trying to walk a line between presenting my perspective on things I find important and over-contributing providing feedback and advice on the process identifying a

Testing (AI) is Testing

Last November I gave a talk, Random Exploration of a Chatbot API , at the BCS Testing, Diversity, AI Conference .  It was a nice surprise afterwards to be offered a book from their catalogue and I chose Artificial Intelligence and Software Testing by Rex Black, James Davenport, Joanna Olszewska, Jeremias Rößler, Adam Leon Smith, and Jonathon Wright.  This week, on a couple of train journeys around East Anglia, I read it and made sketchnotes. As someone not deeply into this field, but who has been experimenting with AI as a testing tool at work, I found the landscape view provided by the book interesting, particularly the lists: of challenges in testing AI, of approaches to testing AI, and of quality aspects to consider when evaluating AI.  Despite the hype around the area right now there's much that any competent tester will be familiar with, and skills that translate directly. Where there's likely to be novelty is in the technology, and the technical domain, and the effect of

Notes on Testing Notes

Ben Dowen pinged me and others on Twitter last week , asking for "a nice concise resource to link to for a blog post - about taking good Testing notes." I didn't have one so I thought I'd write a few words on how I'm doing it at the moment for my work at Ada Health, alongside Ben. You may have read previously that I use a script to upload Markdown-based text files to Confluence . Here's the template that I start from: # Date + Title # Mission # Summary WIP! # Notes Then I fill out what I plan to do. The Mission can be as high or low level as I want it to be. Sometimes, if deeper context might be valuable I'll add a Background subsection to it. I don't fill in the Summary section until the end. It's a high-level overview of what I did, what I found, risks identified, value provided, and so on. Between the Mission and Summary I hope that a reader can see what I initially intended and what actually

The Great Post Office Scandal

  The Great Post Office Scandal by Nick Wallis is a depressing, dispiriting, and disheartening read. For anyone that cares about fairness and ethics in the relationship that business and technology has with individuals and wider society, at least. As a software tester working in the healthcare sector who has signed up to the ACM code of ethics through my membership of the Association for Software Testing I put myself firmly in that camp. Wallis does extraordinarily well to weave a compelling and readable narrative out of a years-long story with a large and constantly-changing cast and depth across subjects ranging from the intensely personal to extremely technical, and through procedure, jurisprudence, politics, and corporate governance. I won't try to summarise that story here (although Wikipedia takes a couple of stabs at it ) but I'll pull out a handful of threads that I think testers might be interested in: The unbelievable naivety which lead to Horizon (the system at th

Agile Testing Questioned

Zenzi Ali has been running a book club on the Association for Software Testing Slack and over the last few weeks we've read Agile Testing Condensed by Janet Gregory and Lisa Crispin. Each chapter was taken as a jumping off point for one or two discussion points and I really enjoyed the opportunity to think about the questions Zenzi posed and sometimes pop a question or two back into the conversation as well. This post reproduces the questions and my answers, lightly edited for formatting. --00-- Ten principles of agile testing are given in the book. Do you think there is a foundational principle that the others must be built upon? In your experience, do you find that some of these principles are less or more important than others?  The text says they are for a team wanting to deliver the highest-quality product they can. If we can regard a motivation as a foundational principle, perhaps that could be it: each of the ten pr

Leaps and Boundary Objects

Brian Marick  recently launched a new podcast, Oddly Influenced . I said this about it on Twitter: Boundary Objects, the first episode of @marick's podcast, is thought-provoking and densely-packed with some lovely turns of phrase. I played it twice in a row. Very roughly, boundary objects are things or concepts that help different interest groups to collaborate by being ambiguous enough to be meaningful and motivational to all parties. Wikipedia  elaborates, somewhat formally:  [boundary objects are] both plastic enough to adapt to local needs and constraints of the several parties employing them, yet robust enough to maintain a common identity across sites ... The creation and management of boundary objects is key in developing and maintaining coherence across intersecting social worlds. The podcast talks about boundary objects in general and then applies the idea to software development specifically, casting acceptance test

Where No-one Else Looks

In yesterday's post, Optimising start of your exploratory testing , Maaret Pyhäjärvi lists anti-patterns she's observed in testers that can lead to shallow outcomes of testing. She ends with this call: Go find (some of) what the others have missed! That strikes a chord. In Toujours Testing I recalled how my young daughter, in her self-appointed role as a Thing Searcher, had asked me how she could find things that no-one else finds. I replied Look where no-one else looks. Which made her happy, but also made me happy because that instinctive response externalised something that had previously been internal.  The phrase has stuck, too, and I recall it when I'm working. It doesn't mean targeting the obscure, although it can mean that.  It also doesn't mean not looking at areas that have previously been covered, although again it can mean that. More, for me, it is about seeking levels of granularity, or perspectives, or methods of engagement, or personas, or data, or im

Am I Wrong?

I happened across Exploratory Testing: Why Is It Not Ideal for Agile Projects? by Vitaly Prus this week and I was triggered. But why? I took a few minutes to think that through. Partly, I guess, I feel directly challenged. I work on an agile project (by the definition in the article) and I would say that I use exclusively exploratory testing. Naturally, I like to think I'm doing a good job. Am I wrong? After calming down, and re-reading the article a couple of times, I don't think so. 😸 From the start, even the title makes me tense. The ideal solution is a perfect solution, the best solution. My context-driven instincts are reluctant to accept the premise, and I wonder what the author thinks is an ideal solution for an agile project, or any project. I notice also that I slid so easily from "an approach is not ideal" into "I am not doing a good job" and, in retrospect, that makes me smile. It doesn't do any harm to be reminded that your cognitive bias

External Brains

A month or two ago, after seeing how I was taking notes and sharing information, a colleague pointed me at Tiego Forte's blog on Building a Second Brain : [BASB is] a methodology for saving and systematically reminding us of the ideas, inspirations, insights, and connections we’ve gained through our experience. It expands our memory and our intellect... That definitely sounded like my kind of thing so I ordered the upcoming book, waited for it to arrive, and then read it in a couple of sittings. Very crudely, I'd summarise it something like this: notes are atomic items, each one a single idea, and are not just textual notes should capture what your gut tells you could be valuable notes should capture what you think you need right now notes should preserve important context for restarting work notes on a topic are bundled in a folder for a Project, Area, or Resource and moved into Archive when they're done. ( PARA )

Binary Oppositions

I am totally loving Oddly Influenced, Brian Marick's new podcast. The latest episoide covers ways in which schools of thought and practice can inhibit the cross-fertilisation of ideas.  It includes a case study in experimental physics from Peter Galison's book, Image and Logic , where two different approaches to the same particle analysis problem seem to run on separate, parallel tracks: In the 'head to world' tradition, you use your head to carefully construct situations that allow the world to express its subtle truths ... In the 'world to head' tradition, you make yourself ever more sensitive to the world’s self-expressed truths ... The first of these wants to theorise and then craft an experiment using statistics while the latter wants to gather data and try to understand it visually. Marick is pessimistic about the scope for crossover in this kind of situation: How do you bridge traditions that differ on aesthetics, on different standards of what counts as