2

I need some clarification on White-Box vs Black-Box testing.

Is it correct that:

White-box testing is testing your code that you are familiar with?

Black-box testing is testing someone else's code you are unfamiliar with, or having someone unfamiliar with your source code test it?

BeerusDev
  • 137
  • 3
  • 2
    Does this answer your question? [What is black box unit testing?](https://softwareengineering.stackexchange.com/questions/362746/what-is-black-box-unit-testing) – gnat Jan 20 '21 at 19:15
  • 2
    Does this answer your question? [Valid use-cases for white-box testing?](https://softwareengineering.stackexchange.com/questions/388668/valid-use-cases-for-white-box-testing) – Bart van Ingen Schenau Jan 21 '21 at 07:04

3 Answers3

7

Black/White -box testing refers to whether or not the internals of the code under test is known to the tester.

Black-box testing tends to be more high-level, possibly based on a high-level requirements document. User-acceptance testing is one form of black-box testing.

White-box testing is more low-level. It might be based on a detailed design document, and might include test scenarios that only the developer(s) of the code could think of. Unit testing is white-box testing.

FrustratedWithFormsDesigner
  • 46,105
  • 7
  • 126
  • 176
  • I'm not sure I'd agree with this - TDD is definitely unit testing, but I don't know what the internals of the code are when I'm writing the tests *because I haven't written the code yet*. – Philip Kendall Jan 20 '21 at 19:20
  • Maybe TDD starts of as "no-box testing", because you just start off with tests before code! :P – FrustratedWithFormsDesigner Jan 20 '21 at 19:29
  • @PhilipKendall I would not call them tests. I'd call them aspirational programs. They just happen to be written in the format of a unit test. – Kain0_0 Mar 09 '21 at 06:36
2

Black Box It is a way of software testing in which the internal structure or the program or the code is hidden and nothing is known about it. It is mostly done by software testers. No knowledge of implementation is needed. It can be referred as outer or external software testing. No knowledge of programming is required. It is the behavior testing of the software. Types of Black Box Testing:

  1. Functional Testing
  2. Nonfunctional testing
  3. Regression Testing

White Box It is a way of testing the software in which the tester has knowledge about the internal structure of the code or the program of the software. It is mostly done by software developers. Knowledge of implementation is required. It is the inner or the internal software testing. It is mandatory to have knowledge of programming. Types of White Box Testing:

  1. Path Testing
  2. Loop Testing
  3. Condition testing
Ishan Shah
  • 339
  • 1
  • 9
1

Philip Kendall's response to the above post refers to an extremely important(!) element of this picture – which really should have been presented as an "answer." Namely: "because I haven't written the code yet."

In lots of practical software-engineering situations, "the source-code is perfunctory, as long as it fulfills the requirements." The key realization being that: "what are(!) the requirements" is the actual issue at hand. Therefore, you can very-definitely "test" a piece of software that no one has yet written, because any time spent writing source-code against incorrect or incomplete requirements is "by definition, wasted." (And, "dreadfully expensive.")

Mike Robinson
  • 1,765
  • 4
  • 10