1

I've always know Unit Tests to be something you do in code. You write functions to test other functions. Our team has been working with the same project manager for a while now and he's always referring to system tests as unit tests. By system tests I mean the kinds of tests where a user follows a test plan and performs actions on an application to ensure it meets the requirements. This PM is an Indian offshore resource.

Is this use of terminology something unique to this person? Is it an Indian thing (like "do the needful")? Or am I just not aware that there's more than one definition for what a unit test is?

3 Answers 3

4

Is this use of terminology something unique to this person?

I have no idea if this specific use of terminology is unique or not, but it is not uncommon to find teams or persons in the software industry using terms in a quite unusual, non-standard, or imprecise way.

For example, due to the popularity of tools like JUnit or NUnit, I have very often heard people using the term "unit test" for any kind of automated test driven by one of those tools, and not just for "unit tests" in the proper meaning of that term.

Such a sloppy terminology can be ok to some degree, as long as everyone in the team knows what is meant, and as long as one is aware that the rest of the world might use some some terms a little bit different.

However, using "unit test" as a synonym for "system tests" or forms of non-automated non-unit tests is something I have never heard before. For me, this usage sounds so utterly wrong that I would recommend to give your PM a hint that his/her usage of those terms bears a certain risk of producing misunderstandings.

2
  • I like this answer because it answers the communication question rather than the definition of unit test (which is much more googleable)
    – Liath
    Commented Jun 28, 2019 at 15:54
  • 1
    @Liath: I am pretty sure the OP already knows what the terms unit and system tests usually mean.
    – Doc Brown
    Commented Jun 28, 2019 at 15:56
2

A unit test is an (almost always) automated test which verifies the behaviour of a small, isolated unit of code.

This unit of code is usually a single method or function. Any more than that and you start getting lots of scenarios. There are normally multiple tests verifying a single piece of code with each testing a specific scenario.

Generally a good unit test should be:

  • Isolated (it can be run by itself or alongside others)
  • Fast
  • It should not touch any external resource such as a network or hard disc
  • Repeatable (it should run at any time and give the same result)

System Tests are usually a higher level than that. For example, when I click this button what does the system do. Although this could be a little vague as these are sometimes called Acceptance Tests.

Both Unit Tests and System Tests have different strengths and weaknesses (as do performance and security tests). You need to understand your test approach to understand which are appropriate for your application and risk profile.

However, if you're an engineer and your colleague is a Project Manager I would expect that it would fall to you to define the testing you want to do and not the other way around.

Also, one final point - please please don't give estimates for work and another estimate for tests. The two are one and the same. You can't develop software without tests any more than you can fix a car without starting it up to make sure it works!

2

They are completely different.

Unit testing is concerned with verifying that small chunks (functions/methods) of code work in isolation. They should test cases of common usage, edge cases and any case in which an error can occur. For example, if you have a function that adds two numbers, then your unit test must test whether or not the function calculates the sum correctly.

System testing is concerned with validating whether or not your full system meets the requirement specification. This type of testing is used to determine whether or not the system developed as a whole does exactly what it is expected from it. For example, if you were tasked to develop a calculator, then your system testing must show that all operations that are required by the user are available.

1
  • Good answer, I'd also expand to cover that unit tests often cover far more than the happy path such as nulls/negative numbers
    – Liath
    Commented Jun 28, 2019 at 15:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.