Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My code is something like:

function Controller(dep0, dep1) {;;

The test is something like:

function test() {
    dep0Mock = mock.create();
    controller = new Controller(dep0Mock, dep1Real);
share|improve this question

For deciding if a test is a unit test or a functional test, I think I would consider the test's intent and how it is going to be used. I would look especially to practical differences caused by not mocking this dependency. Should this test be run frequently, or can it wait until after a new build is released to test? Does this test run quickly, even with the dependency? Is the dependency at least 99.9% reliable? Unit tests should be easy to run frequently, and they should very rarely fail unless there is a real bug. A unit test that fails due to a dependency is a problem.

However, this also depends on company culture, and I would recommend asking a more senior testing in your own company (if anyone is available). A good developer who has been there for a while might also have an opinion.

share|improve this answer
+1 for the "intent" – David Aug 17 '11 at 8:49

A unit test is a type of a functional test.

I am not sure what distinction you are trying to make, or why it is important to you.

share|improve this answer
Yes, the term 'functional test' is ambiguous. I'm differentiating between unit, functional, and system tests (all of which are functional tests since they're not non-functional tests) which differ in the scope of what they're testing. It's important to me because I feel names are important. As such, I tend to reflect the scope of the tests in the file's name. – Noel Aug 16 '11 at 17:37
It seems to me you are mixing metaphors (e.g. Functional vs. Non-functional types of testing and unit and system 'levels' of testing). – Bj Rollison Aug 17 '11 at 5:01
The definition I'm using is I understand the valid use of the other definition, but that's not what I mean with my question. I don't want this question to get bogged down by definitions. Use whatever term will fit (Google uses Small, Medium, Large, and Enormous). – Noel Aug 17 '11 at 16:16
I still do not understand why this is important to you. We divide things into categories because we believe we need to treat them differently. If introducing the mocking code changes categories, what does that imply to you? For example, does it mean that test responsibility moves from QA to dev? Does it mean that other QA guy should own the test? Does it mean you deserve a promotion? – user246 Aug 17 '11 at 22:44
Who cares? A test provides value or it doesn't. – Squirrel Aug 22 '11 at 21:45

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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