In system testing, a software system is tested against requirements.

In unit testing, a software module is tested against the internal requirements for this module which depend on the specific software design and are not visible to the users in general.

I don't like the term internal requirement because a requirement is normally something that is visible to the users of the software and does not depend on its internal structure.

Is there an unambiguous and commonly used term for these internal requirements?

  • It makes me a bit sad that after 10 minutes, 2 of 5 people think that this question can only be answered in an opinionated way. System testing, unit testing and requirements are terms that we use all the time. Do you really believe that they are so ill-defined that an objective answer to my question is impossible? – Frank Puffer Oct 20 '18 at 10:38
  • 1
    "Name-that-thing" questions are off-topic precisely because everybody has their own opinion about what things should be called. For example, in my opinion, subroutines in C should be called procedures, not functions, because they don't behave at all like functions. – Jörg W Mittag Oct 20 '18 at 12:05
  • 1
    @FrankPuffer: No, the logical consequence of my statement is that your particular question in the particular way that it is phrased on this particular website according to the particular rules that we, as a community, have democratically given ourselves, is off-topic. No more, no less. You said yourself "we can make it more precise by agreeing on the use of certain terms". Yes, we can. But on this particular website, questions need to have a single, objectively verifiable, correct answer, IOW the answer needs to be already agreed-upon. Otherwise, it is a discussion, and there are … – Jörg W Mittag Oct 20 '18 at 14:07
  • 1
    … hundreds of websites that are good at discussions, this one is not one of them. In fact, the Stack Exchange engine is deliberately designed to be bad at discussions and discourage them. Why would you want to discuss something in a forum that is deliberately designed to be bad at discussions instead of a forum that is deliberately designed to be good at discussions? – Jörg W Mittag Oct 20 '18 at 14:08
  • 1
    @DavidArno: I have been using the term "internal requirements" because I couldn't come up with a better one. That's exactly the point of my question. What I mean is "requirements" for a single module that are internal to the software system and thus not visible for the user. – Frank Puffer Oct 21 '18 at 19:49

The name is "contract". It refers to the pre-conditions and post-conditions of each method, as well as invariants that are true (pre and post conditions for) all methods, including construction.

If you are using a language or tools that can perform automated contract proofs for you, you will be writing a lot less boring detailed tests. You will still need some at a higher level.


In the V-Model, the project definition and design activities of increasing detail are mirrored by test and integration activities. There is a relation between design artifacts and the tests that are based on these artifacts.

The V-Model, based on material by the ISTQB

Unit tests (= component tests) are there based on the component specification document.[1] This allows test suites to be created by testers in parallel to the programming effort.

[1]: Compare section 2.2.1 Component Testing in the ISTQB Foundation Level Syllabus 2018.

While this diagram is useful to understand different test levels, it does not match the reality of most software projects: the V-Model is effectively unheard of in most parts of the industry. Many projects will never create explicit design documents or specifications, especially in unstructured or agile environments.

Yet having a record of requirements is useful. TDD and BDD suggest: the test is the specification. BDD style tests can be interpreted as executable documentation, requirements specification, and acceptance test all in one. TDD style tests are a complete specification of a component.

So to answer your main question: I'd suggest that unit tests are based on a detailed design or a component specification, whether these are explicit documents, explicit but the same as the test, or just implicit.

  • Thanks, but it does not exactly answer my question: I am not asking for a name of the whole document, A requirement is an (atomic) element of a requirements specification. What are the elements of the component specification? – Frank Puffer Oct 21 '18 at 8:34
  • @Frank the component specification would describe a detailed design of the component, down to the individual classes and methods that form its API (and possibly also its internal structure). You can also read “the test is the specification” backwards: given a thorough TDD-style test suite, that test suite would have all the information necessary to write a corresponding component specification. – amon Oct 21 '18 at 8:52
  • Dinosaurs may well have used the V model when creating COBOL programs but no modern software engineer takes such ideas seriously anymore. – David Arno Oct 21 '18 at 18:16
  • @DavidArno That is an unnecessarily narrow view. The V model is clearly unsuitable for a web dev shop or in house Excel macro development. But it does have value to this day in regulated environments with increased documentation requirements (think government contracts, especially in Germany where the V-Modell-XT is the government's official software project process model), for settings with low acceptable risk so that QA rules (think aerospace), or for other engineering projects that are not primarily about software development. It is also great for teaching testing concepts :) – amon Oct 21 '18 at 18:34
  • @amon I disagree. The reason why solutions in these heavily regulated spaces consistently deliver just a small fraction of the requirements, hugely over-budget and very late is because of process and document-heavy nonsense like the V module. One only uses such a process if forced to by regulators as it adds no positive value to the development effort. – David Arno Oct 21 '18 at 19:11

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.