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.
Image: http://flic.kr/p/55ryMX

Comments

  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.)

    ReplyDelete
  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.




    ReplyDelete

Post a Comment

Popular posts from this blog

Can Code, Can't Code, Is Useful

The Association for Software Testing is crowd-sourcing a book,  Navigating the World as a Context-Driven Tester , which aims to provide  responses to common questions and statements about testing from a  context-driven perspective . It's being edited by  Lee Hawkins  who is  posing questions on  Twitter ,   LinkedIn , Mastodon , Slack , and the AST  mailing list  and then collating the replies, focusing on practice over theory. I've decided to  contribute  by answering briefly, and without a lot of editing or crafting, by imagining that I'm speaking to someone in software development who's acting in good faith, cares about their work and mine, but doesn't have much visibility of what testing can be. Perhaps you'd like to join me?   --00-- "If testers can’t code, they’re of no use to us" My first reaction is to wonder what you expect from your testers. I am immediately interested in your working context and the way

Meet Me Halfway?

  The Association for Software Testing is crowd-sourcing a book,  Navigating the World as a Context-Driven Tester , which aims to provide  responses to common questions and statements about testing from a  context-driven perspective . It's being edited by  Lee Hawkins  who is  posing questions on  Twitter ,   LinkedIn , Mastodon , Slack , and the AST  mailing list  and then collating the replies, focusing on practice over theory. I've decided to  contribute  by answering briefly, and without a lot of editing or crafting, by imagining that I'm speaking to someone in software development who's acting in good faith, cares about their work and mine, but doesn't have much visibility of what testing can be. Perhaps you'd like to join me?   --00-- "Stop answering my questions with questions." Sure, I can do that. In return, please stop asking me questions so open to interpretation that any answer would be almost meaningless and certa

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

Testers are Gate-Crashers

  The Association for Software Testing is crowd-sourcing a book,  Navigating the World as a Context-Driven Tester , which aims to provide  responses to common questions and statements about testing from a  context-driven perspective . It's being edited by  Lee Hawkins  who is  posing questions on  Twitter ,   LinkedIn , Mastodon , Slack , and the AST  mailing list  and then collating the replies, focusing on practice over theory. I've decided to  contribute  by answering briefly, and without a lot of editing or crafting, by imagining that I'm speaking to someone in software development who's acting in good faith, cares about their work and mine, but doesn't have much visibility of what testing can be. Perhaps you'd like to join me?   --00-- "Testers are the gatekeepers of quality" Instinctively I don't like the sound of that, but I wonder what you mean by it. Perhaps one or more of these? Testers set the quality sta

Postman Curlections

My team has been building a new service over the last few months. Until recently all the data it needs has been ingested at startup and our focus has been on the logic that processes the data, architecture, and infrastructure. This week we introduced a couple of new endpoints that enable the creation (through an HTTP POST) and update (PUT) of the fundamental data type (we call it a definition ) that the service operates on. I picked up the task of smoke testing the first implementations. I started out by asking the system under test to show me what it can do by using Postman to submit requests and inspecting the results. It was the kinds of things you'd imagine, including: submit some definitions (of various structure, size, intent, name, identifiers, etc) resubmit the same definitions (identical, sharing keys, with variations, etc) retrieve the submitted definitions (using whatever endpoints exist to show some view of them) compare definitions I submitted fro

Build Quality

  The Association for Software Testing is crowd-sourcing a book,  Navigating the World as a Context-Driven Tester , which aims to provide  responses to common questions and statements about testing from a  context-driven perspective . It's being edited by  Lee Hawkins  who is  posing questions on  Twitter ,   LinkedIn , Mastodon , Slack , and the AST  mailing list  and then collating the replies, focusing on practice over theory. I've decided to  contribute  by answering briefly, and without a lot of editing or crafting, by imagining that I'm speaking to someone in software development who's acting in good faith, cares about their work and mine, but doesn't have much visibility of what testing can be. Perhaps you'd like to join me?   --00-- "When the build is green, the product is of sufficient quality to release" An interesting take, and one I wouldn't agree with in general. That surprises you? Well, ho

Make, Fix, and Test

A few weeks ago, in A Good Tester is All Over the Place , Joep Schuurkes described a model of testing work based on three axes: do testing yourself or support testing by others be embedded in a team or be part of a separate team do your job or improve the system It resonated with me and the other testers I shared it with at work, and it resurfaced in my mind while I was reflecting on some of the tasks I've picked up recently and what they have involved, at least in the way I've chosen to address them. Here's three examples: Documentation Generation We have an internal tool that generates documentation in Confluence by extracting and combining images and text from a handful of sources. Although useful, it ran very slowly or not at all so one of the developers performed major surgery on it. Up to that point, I had never taken much interest in the tool and I could have safely ignored this piece of work too because it would have been tested by

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

Test Now

The Association for Software Testing is crowd-sourcing a book,  Navigating the World as a Context-Driven Tester , which aims to provide  responses to common questions and statements about testing from a  context-driven perspective . It's being edited by  Lee Hawkins  who is  posing questions on  Twitter ,   LinkedIn , Mastodon , Slack , and the AST  mailing list  and then collating the replies, focusing on practice over theory. I've decided to  contribute  by answering briefly, and without a lot of editing or crafting, by imagining that I'm speaking to someone in software development who's acting in good faith, cares about their work and mine, but doesn't have much visibility of what testing can be. Perhaps you'd like to join me?   --00-- "When is the best time to test?" Twenty posts in , I hope you're not expecting an answer without nuance? You are? Well, I'll do my best. For me, the best time to test is when there

Play to Play

I'm reading Rick Rubin's The Creative Act: A Way of Being . It's spiritual without being religious, simultaneously vague and specific, and unerring positive about the power and ubiquity of creativity.  We artists — and we are all artists he says — can boost our creativity by being open and welcoming to knowledge and experiences and layering them with past knowledge and experiences to create new knowledge and experiences.  If that sounds a little New Age to you, well it does to me too, yet also fits with how I think about how I work. This is in part due to that vagueness, in part due to the human tendency to pattern-match, and in part because it's true. I'm only about a quarter of the way through the book but already I am making connections to things that I think and that I have thought in the past. For example, in some ways it resembles essay-format Oblique Strategy cards and I wrote about the potential value of them to testers 12 years ago. This week I found the f