1

This great articles explains the difference between unit testing, component level testing and UI testing. At all my previous companies great deal of attention was given to unit testing and less to automated UI testing (end-to-end integration tests). I've never seen component testing practiced in these companies.

It's interesting because as I see it in large applications it's the component testing that helps most during architecture refactoring or ensures against defects by novice developers. Yet, there's almost no information on the web on this subject, almost no books on amazon, while there's a ton of information both on unit testing and automated UI test. Why is it so?

  • 12
    You're probably looking for the wrong thing. Try searching for "integration testing." – Robert Harvey Sep 13 '16 at 17:12
  • 1
    I agree to Robert. Your assumption is wrong. There are tons of information about this topic, you just have to use the right keywords to search for. – Doc Brown Sep 13 '16 at 17:21
  • 1
    What do you consider a "component?" Integration testing means "how do these classes or modules work together?" It doesn't necessarily have to be end-to-end. – Robert Harvey Sep 13 '16 at 17:26
  • 2
    OK. So what is it that you are looking for specifically? Now that you have the correct terms, what is it that you actually need to know? – Robert Harvey Sep 13 '16 at 18:34
  • 3
    "TDD which limits testing to one class and stubs dependent classes" [citation needed]. TDD as a process is actually agnostic about the degree to which you should isolate and stub dependencies; note that many well-known advocates of TDD suggest not using stubs in many situations, see e.g. thoughtworks.com/insights/blog/… and stephenwalther.com/archive/2009/04/11/… – Periata Breatta Sep 13 '16 at 23:24
14

The terms “unit testing” and “component testing” are not defined universally, and different people hold different notions what these terms mean precisely. However, they are generally understood to be the same thing. The ISTQB (a testing qualification organization) does not seem to differentiate between these terms, preferring “component tests” in their literature.

The ISTQB sees the following major testing levels:

  • Acceptance tests, which are performed by the customer.
  • System tests, which verify requirements on the complete system
  • Integration tests, which cover the interaction of components.
  • Component tests, which test components in isolation. Unit tests are component tests.

The article you quoted draws a line at the level of granularity: according to the author, the test subject of unit tests would be single methods, whereas component tests would cover whole modules. Also, the focus would move from verification of the component's contract to validation in the context of the application/whole system. These differences found by that article are not universally recognized. How large the “unit” of an unit test is depends. Often, the unit is a whole class.

Other sources see the difference in the role which performs the tests: whereas unit tests would be performed by developers, component tests and integration tests would be performed by dedicated testers. Again, this difference is not universally recognized. In practice, integration tests always require the assistance of developers, so that test drivers and test stubs can be created to stand in for missing components.

  • So the conclusion is that no one knows with certainty what unit tests or component testes are? – Tulains Córdova Sep 13 '16 at 17:41
  • 5
    The conclusion is that you don't need precise definitions for those words in order to fully understand how to test a system. – Robert Harvey Sep 13 '16 at 18:35
  • 1
    Another conclusion is that using those terms is meaningless, unless you define them. – Jörg W Mittag Sep 13 '16 at 23:20
  • 3
    Yet another conclusion is that a mature reader should understand that different authors writing at different times will use different words to say the same thing. – candied_orange Sep 13 '16 at 23:37
0

Although I agree that part of the problem is that people seem to disagree on what to call different 'levels' of testing and so this complicates matters a bit. The other point I think should be made is that giving advice on unit testing (by which I mean individual functions) or UI testing is much easier to do.

There are some people who dislike 'mid' level tests (Integrated Tests Are A Scam).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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