Before knowing how to write test cases, let us see what a test case is?
What is a test case?
A Test Case is a set of actions executed to verify a particular feature or functionality of your software application.A test case has components that describe an input, action or event and an expected response, to determine if a feature of an application is working properly or not.
There are levels in which each test case will fall in order to avoid various duplication efforts.
Level 1: To write the basic test cases from the available specification and the user documentation.
Level 2: This is the practical level in which writing test cases depend on actual functional and system flow of the application.
Level 3: In this you will group some test cases and write a test procedure. Test procedure is nothing but the group of small test cases maximum of 10.
Level 4: The Automation of the project. This will minimize human interaction with the system and thus QA (Quality Analysis) can focus on current updated functionalities to test rather than remaining busy with regression testing.
Fields in test cases:
Test case id:
Unit to test: What to be verified?
Test data: Variables and the values
Steps to be executed:
Writing test cases is one of the key activities performed by the tester in the Software Testing Life Cycle (STLC).
You can use start writing test cases in the excel sheet. You can continue with excel or choose the open source or any paid test case management tool from the variety of list. There are different test case management tools like Quality Centre, Test Director or Test Link etc. in the market, these tools supports excel import feature, so you can import above written test case easily.
Writing test cases is one of the major and most important activities which any tester performs and it is done during the entire testing cycle. The approach for writing good test cases will be to identify, define and analyse the requirements.
TIPS for writing good test cases:-
Tests only one thing:-
Always make sure that your test case tests only one thing at a time, if you try to test multiple conditions in one test case it becomes very difficult to track results and the errors.
Organize your test cases consistently:-
You can organize your test cases in many ways however you should always follow the same pattern to organize your test cases.
Write independent test cases:-
Your test cases should not have dependency on other test cases, i.e. you should be able to execute your test case individually with having dependency on other test cases.
Write small test cases:-
Always mention purpose of each test case clearly in the test case.