What is a Test Case? – question answered!
The “What is test case?” question is a very common interview question in Software Testing field.
Taking QA class in a college you might be just fine giving THE definition provided in that course. But, for the purpose of a successful job interview you might come up with a brief discussion, showing the multitude of views and concepts.
The Institute of Electrical and Electronics Engineers defines test case as “A set of test inputs, execution conditions, and expected results developed for a particular objective, such as to exercise a particular program path or to verify compliance with a specific requirement.”
Wikipedia provides slightly different definition: “Set of conditions or variables under which a tester will determine whether an application or software system meets specifications.”
The difference between two is “verifying compliance with requirement” versus “meeting specification”. In the ideal world we have perfectly defined requirements. In the real world we might have literally none. So, in QA we might deal with actual requirements or with self-inflicted, self-imposed requirements. No matter how well the formal requirements or specifications are defined Software tester will develop and execute test cases in the course of testing the software product.
To the testers who are developing the test cases it is an instrument of planning for future testing. Many companies are outsourcing execution of test procedures. As a result we are seeing more and more people for whom test cases are about execution, not planning. This is why the Internet is now full of definitions like “test cases is a document that describes step-by-step process how to test the application”. Step-by-step process of executing something developed by someone else. You can mention that as one of the existing views, but in Silicon Valley you should not make it your preferred definition.
Practically all the definitions imply that test cases will either fail or pass. And that is how tester verifies the requirement. But there is a very important difference in viewing or not viewing test case as smallest test with no more than one verification inside. In some companies one requirement has just one test case assigned. And that single test case will have many verifications inside. Wikipedia expresses different opinion:
1. “there must be at least one test case for each requirement”. By the way. Think about how many negative test cases we might have for just one positive test case
2. “test cases are usually collected into test suites”. Not into other test cases.
There is an absolutely amazing definition I found on PC Magazine web site: “A test case validates one or more system requirements and generates a pass or fail”. Wow!!! It is not even one test case for one requirement. It is about one test case validating multiple requirements.
Think about it. You come to an interview. They ask you “What is test case?”. And the person who asks the question might be a proponent of any of the views we discussed so far. The only way not to take the risk of coming with your favorite definition is giving an overview of existing concepts. Make sure you tell the interviewer that you do not know exactly how that QA team defines the term, but you will be happy to adopt their definition.
Credit for the article – Portnov computer school