How should you start a testing program or department?

  • 1 February 2021
  • 1 reply

Userlevel 1
Badge +2

Over on Stack Overflow, user sam78 asked a question about starting a testing department from scratch.

Although it’s a very broad question, it is an interesting one… Is there any general advice you could offer people who are creating a formal testing situation for their employer?

I’m going to put my own answer below, but I’d love to hear your thoughts on what a new testing department should aim to do, how they should do it, and how to demonstrate value and success.

1 reply

Userlevel 1
Badge +2

👾Dylan here! I’m the Manager of Developer relations at Sauce Labs, but this isn’t official advice; Instead, it’s my personal opinion based on the interactions I’ve had with staff, customers and developers in general.

It’s almost impossible to answer this without significant knowledge of the products, quality goals and existing tooling of the company in question… But I’ve got some Opinions™ that might help, starting with some philosophy (sorry).


What You're For

The function of a testing department isn't to test; the goal is to help the company be confident in its delivery of products. Your customers want to know that your software is accurate and stable. Your Operations team wants to avoid Production going down. Your Developers want to feel confident that their changes work and don't have any negative side effects.

I personally feel that the best way for a testing team to provide that confidence is not by writing tests; It's by editing them. The testing team provides the tooling, guidelines and expertise to help the rest of the Engineering departments make testing an integral part of the process.

It's like cooking. You don't make a well seasoned meal by chopping and sautéing and stirring and then giving it to a head chef to taste. You taste continually while you go because you're the one who knows what the food should be like. The head chef trains you and provides feedback on the final dish so that you learn how to season correctly.


Choosing Tools

Irrelevant. Mostly.

Your tools need to give you what you're after and then get out of your way. At the moment, the company barely knows what it's after, so you could even use a Google Doc to track defects.

You don't want to get in anyone's way to begin with, or they'll start to resent you. Your team needs to provide value and start to earn the social capital to change the Engineering processes to help deliver your goals.

So, use whatever document sharing tools are already in use; Whether that's a Wiki, Google, Dropbox etc. If you're choosing a new one because there's no collaboration, I'm partial to Notion.

If your team already has a collaborative build tool (eg Jenkins, Travis) it's probably best to stick with that, adding in testing steps. Again, the less friction you introduce, the better your initial outcomes.

I wouldn't bother building and maintaining a test grid; Instead, lean on a vendor like Sauce Labs for infrastructure and expertise. That way you've got easy parallelisation, wide platform coverage, test asset collection, insights, as well as their experience in supporting Testing teams. Disclaimer: I'm the Manager of Developer Relations at Sauce Labs, so I'm probably biased ;)

As for testing tools; If you want your engineering teams to collaborate on test production, you need to stick with an ecosystem they can use. This likely means whatever they're already using.


How To Start Testing

Selecting What To Test

Your organisation wants testing so bad they're hiring you. That implies there's a traumatic event that they want to avoid happening again. So, start there. Find out what it is, and create a test for it.

If Black Friday overwhelmed their site, do Load testing. If their build is always breaking, concentrate on unit testing. If functionality doesn't work in Prod, add an integration test.


Test Coverage

There's a trap for new players, and you're likely to hear this from your devs:

We're so far behind on test coverage we'll never catch up

That is absolutely true.... if you never start! Add the tests that prevent the trauma that bought you on board and you're already adding value; You'll catch that problem next time.

Another trap is setting test coverage goals. Test coverage is a great way to monitor your process but a terrible way to improve it. Force your teams to increase test coverage (or not let it slip) and they'll start to resent the process... And write crap tests just to boost the percentage.

Instead, use coverage for feedback. If coverage goes down during a commit, discuss why and talk about how to improve it. if it drops way down you might want to do something, but a little dip while you're getting started is A-OK.

Assuming you've covered the trauma that got you hired, increasing test coverage is best done on an as-worked basis. If a developer is writing new code, it gets tests. If a developer is modifying old code, it gets tests to (at least) prove that the modifications work, and ideally to prove that they don't break the old functionality either.

You may come across old code that literally can't be tested. That's a good time to refactor that code. If people are scared of refactoring because it might break, point out that that's exactly what tests are for. Try to pull out to a level where you can test. If you can't test a unit, test the class. If you can't test the class, test the package. Then, go back in and start re-working. You have to do it some day.

Oh, no, we'll be replacing the Fizzwangle with a new Buzzshooper implementation soon; There's no need to take the risk of refactoring for testability.

This is a lie. Even if they mean it truthfully, it's a lie. Buzzshooper isn't coming any time soon. Refactor that shit.


Tests Are Code, Code Is Tests

Your tests need to be treated like high quality code. Use all the abstractions you use when writing code, like inheritance, polymorphism, modularisation, composability.

Look at techniques like the Page Object Model for front end testing. Your test code should restrict implementation detail knowledge (eg, element locators) to the least number of places, so that changes are easy to implement.

Oh, and also, your Code is Code. Learn about then help your teams write code for testability, and tests for code-ability. Structure your tests and app so you can test in parallel, reliably, as fast as possible:

  • Give HTML elements unique, simple IDs
  • Write tests that test a single thing
  • Bypass complicated test setup by doing things like pre-populating databases
  • Log in once, then use session management to avoid doing it again
  • Use data generators to create unique test data (including logins)


Other Resources

Check out past conference talks like SauceCon Online.

Testing Talks Online has some great discussions and is the closest thing I've found to a real-life meetup during Covid.

There's also a lot of great content over at Ministry of Testing.

Finally, I’d like to think this humble forum is a great place to find interesting, useful test data.


“I fundamentally disagree with everything you’ve just said!”

Awesome!  I’d love to hear your perspectives.  Please join in the discussion below!