Testing (Software Development)

The idea here is to introduce you to the world of testing in software industry and provide some guidelines and things to keep in mind while you are doing so.

Open in new tab

What is Software Testing?

Testing in it’s very basic terms, means “check if something is working as espected”. There are many ways of doing it. Some do by it by hand, some peole automate it, some do it in controlled environment, some do it in in production, some do it themself, some ask someone else to do it for them. In software industry, testing is almost the same thing.

Consider software project analogous to your dream house building project. In general, you plan for it, design it, hire people to get doing things and then in general you’ll not test it while you are developing it! Once developed, you’ll show it to someone, get it approved. Then you either sell it to someone or live in the same house.

If you live in that same house, you will, probably, be able to extend or modify the house as per your needs because you know how you have built it. But the other guy who purchased your house, it’s quite hard to modify or extend it, because he has no clues when the house will fall apart, unless you provide a written specs of the house.

Whatever you do with the house, as time passes it becomes increasingly difficult to modify/extend/maintain that house, unless you have an efficient and repeatable way of testing it’s capabilities.

Software testing is very much, what’s the case with testing a house. It’s useful, most people don’t do it, it’s costly and hard to it and you feel it’s increasing need as time passes.

Why testing is important?

In softwares industry, a bad code is acceptable, not a wrong code.

  • Know your code works
  • Save time
  • Better code
  • It help a software live longer
  • It makes everyone happy, removing fear
  • “Debugging is hard, testing is easy”

When to test code?

As with anything,

Softwares must be tested, as soon as possible.

The reason being, if you don’t 1) probably you’ll never do it 2) the value of that test decreases as much as you delay it.

Now is better than never.
Zen of Python, PEP20

How to test?

Tools are your friend, keep them handy and sharp.

Testing Tools

If you are able to write or speak in a particular lauguage, it become very easy to test or tell it to someone what to test. Now, if you have a better tools, it just becomes a breeze to test anything.

While testing, the tools can be categorized in two catergories:
1. Tools that help in discovering, run and cleaning up a test (pytest, unittest, nose, tox, DjangoTestRunner, etc.)
2. Tools you can use inside your test code (mock, freezegun, responses)

Further Reading:

  1. pytest.org
  2. Testing Your Code – Python Guide – by Kenneth Reitz
  3. Getting Started Testing – by Ned Batchelder