How to write a good test case?

Writing test cases is one of the major and most important activities which any tester performs during the entire testing cycle. The approach for writing good test cases will be to identify, define and analyse the requirements.
When you begin writing the test cases, there are few steps which you need to follow to ensure that you are writing good test cases:

1. Identify the purpose of testing. You need to understand requirements to be tested. The first step is to define testing purpose.
When you start writing test cases for any software module, you must understand the features of the same and user requirements.

2. The second step is  to define how to perform testing. This will include defining Test Scenarios.To write good test scenarios you should be well versed with familiar with the functional requirements. You need to know how software is used covering various operations.

3. Identify Non-funtional requiremts.The third step is  to understand the other aspects of software related to non-functional requirements such as hardware requirements, operating system, security aspects to be considered, and other prerequisites such as data files or test data preparation. Testing of non-functional requirements is very important. For example, if the software requires a user to fill in the form, proper time-out logic should be defined by the developer to ensure that it should not result in time-out while submitting the form once user has filled in all required information. Simultaneously, under the same scenario tester should also ensure that user is getting logged-off after certain defined delay to ensure security of the application is not breached.

4. Fourth step would be to define a framework of test cases. The framework of test cases should cover UI interface, functionality, fault tolerance, compatibility, and performance of several categories. Each category should be defined in accordance with the logic of the software application.

5. Next step would be to become familiar with the modular principle. It is easy to analyze the relevance of the software modules present in the specified application. However, it is very important to understand the coupling between the modules. It is very important to test the "Mutual influence" of modules.
The test cases should be designed to cover influence of any module on other modules of the application. For example, in online shopping software while testing shopping cart and order checkout you need to also consider inventory management and validate if the same quantity of the purchased product is deducted from the stores. Similarly, while testing returns, we need to test its effect on the financial part of application along with store inventory.

Structuring of Test cases
Now you have all the required information to begin writing test cases. We will talk about the structure of a test case. Requirements of the software are mapped with test scenarios, which are further elaborated in test cases. For each test scenario, we define test cases. In each test case, we define Test Steps. Test Step is the smallest entity under any test case. It specifies the action to be performed, Expected result of the test application.

The format of a test case comprises of:
1. Test Case ID ( This is the unique number which helps in identifying a specific test cases)
2. Module to be tested (Usually we provide Requirement ID to maintain traceability between test case and requirements)
3. Test Data ( We provide variable and values based on need of the test case)
4. Test Steps ( Steps to be executed)
5. Expected results ( How application should behave after performing stated test steps)
6. Actual results ( Actual output tester will get after preforming steps)
7. A result ( Pass or fail after comparing expected and actual results)
8. Comments ( We can provide screen shot or any other relevant information to help developer debug the code)
During testing you will mark your results against each step, and the defect report will provide related test case ID, which failed during execution.  This can help a tester to relate back to requirements and understand the business scenario which needs to be fixed in code.
For writing test cases you can use simple xls file or tester can select from a wide variety of tools already available. There are few tools such as Quality Centre, Test Director which tester can avail after paying license cost, or you can avail open source tools such as bugzilla.

The test cases can be written with great details, including a large number of steps, or you can also write relatively simple test cases. I personally do not agree with the approach of a large number of steps to be included in test cases.

Here are my thoughts on how a tester can write effective test cases:
1. Self-explanatory and specific – test cases should have sufficient details so that even a new tester can execute the same without any help. All the pre-requisite which are required to execute a specific test should be mentioned in the tests itself. Further, it should clearly specify the purpose and scope of their steps.
2. Valid and concise – test cases should have all designated steps to test based on expectations of the testing. It should not have unnecessary steps. If there are too many test steps in a single test case to be performed the tester may lose focus and aim.
3. Traceable – test cases should cover all the requirements of the software, and every test case should be mapped with “Requirement ID." This helps in ensuring that testing is providing 100% coverage to complete requirements and tester is performing testing for all requirements. Further, it also helps in impact analysis.
4. Maintainable – with the changes in requirement, tester should be able to easily maintain the test suite of test cases. It should reflect the changes in software and accordingly steps should be modified.
5. Positive and negative coverage– test cases should test for boundary values, equivalence classes, normal and abnormal conditions.  Apart from testing for expected results, the negative coverage can help in testing failure conditions and error-handling.
6. Coverage for Usability aspect – Test cases  should include testing for UI interface from the aspect of ease of use. The overall layout and color should be tested against a style guide, if any defined for the software application under testing or should be tested against the signed off mock- up designs. Basic English punctuations, spellings, drop-down list categorizations such as depended pick lists should be covered.
7. Test Data – there should be the diversity of the data which should be used in test cases such as -   Valid data, Legitimate invalid data (to test boundary value), Illegal and abnormal data ( to test error handling and recovery).
8. Non-Functional aspect – the test cases should cover scenarios for basic performance testing of the application such as Multi-user operation, capacity test.  It should cover security aspects such as user permissions, logging mechanism. Test cases for Browser support  in case of  web application.

To summarize, the test cases should first be able to cover all the functional requirements, and then we should also include the test cases which are related to non- functional requirements as they are equally important for the proper functioning of the software.


smesaleskit said...

Now you can Use your iPhone, iPad, or Android tablet to demo your product catalog and brochures to clients and to create and submit quotes and orders on the way. Omni sales app is a mobile sales app that Works on iPad, iPhone and all Android based tablets and phones.

peterson said...

Your information about software is really interesting. Also I want to know the latest new techniques which are implemented in software. Can you update it in your website?
LoadRunner training in Chennai

vonexpy said...

The test cases are really good. Nice informative article on software testing.
mobile application development services

dhanamlakshmi palu said...

I gathered a lot of information through this article.Every example is easy to undestandable and explaining the logic easily.Thanks!
Phonegap Training in chennai | Phonegap Training chennai | Phonegap course in chennai | Phonegap course chennai

Dumi Soft said...

It’s actually an excellent and useful item of information. Check Writing Software | Cheque Printing in Dubai

Pooja Doss said...

Oracle DBA Training in Chennai
Thanks for sharing this informative blog. I did Oracle DBA Certification in Greens Technology at Adyar. This is really useful for me to make a bright career..

Pooja Doss said...

Whatever we gathered information from the blogs, we should implement that in practically then only we can understand that exact thing clearly, but it’s no need to do it, because you have explained the concepts very well. It was crystal clear, keep sharing..
Websphere Training in Chennai

Pooja Doss said...

Data warehousing Training in Chennai
I am reading your post from the beginning, it was so interesting to read & I feel thanks to you for posting such a good blog, keep updates regularly..

Pooja Doss said...

Selenium Training in Chennai
Wonderful blog.. Thanks for sharing informative blog.. its very useful to me..

Pooja Doss said...

Oracle Training in chennai
Thanks for sharing such a great information..Its really nice and informative..

Pooja Doss said...

I have read your blog and i got a very useful and knowledgeable information from your blog.You have done a great job.
SAP Training in Chennai

Pooja Doss said...

This information is impressive..I am inspired with your post writing style & how continuously you describe this topic. After reading your post,thanks for taking the time to discuss this, I feel happy about it and I love learning more about this topic..
Android Training In Chennai In Chennai

Pooja Doss said...

Pretty article! I found some useful information in your blog, it was awesome to read,thanks for sharing this great content to my vision, keep sharing..
Unix Training In Chennai

Pooja Doss said...

I found some useful information in your blog, it was awesome to read, thanks for sharing this great content to my vision, keep sharing..
SalesForce Training in Chennai

Pooja Doss said...

There are lots of information about latest technology and how to get trained in them, like Best Hadoop Training In Chennai have spread around the web, but this is a unique one according to me. The strategy you have updated here will make me to get trained in future technologies Hadoop Training in Chennai By the way you are running a great blog. Thanks for sharing this blogs..

Suseela Susiee said...

What an awesome post, I just read it from start to end. Learned something new after a long time.

Manual testing training in Chennai

Selenium testing training in Chennai

Thanu Abi said...

Really an awesome post. I wondered by reading this blog post. Thanks a lot for posting this unique post which you have shared with us. Keep on posting like this exclusive post with us.

Seo Training in Chennai

Pricilla Prasanth said...

I cant wait to check out some of these blogs! I’ve really wanted to start learning more about cars and auto repairs lately and I think this will help a lot. I think it can save my family some money if we knew how to do some repairs at home.! Thanks again for all the options.

bike spa services in mumbai
house cleaning services in mumbai
car wash services in mumbai

Adrian Dobre said...

Thank you to all of you who found the blog interesting and appreciate it!

Padhma said...

blog was nice,very excellent software information for me,really good one thanks for sharing.
Back to original

Sindhuja Ravi said...

Thank you for taking the time to provide us with your valuable information. We strive to provide our candidates with excellent care and we take your comments to heart.As always, we appreciate your confidence and trust in us
Digital Marketing Company in India

Savithaa Nirmal said...

Thanks for the post, It is very helpful. High appreciate the efforts for sharing all the in-details and browser configurations for testing Selenium Grid.
Check out one of the post related to selenium concepts

Practical Oriented Selenium Training in Chennai

vignesjoseph said...

I do accept that we share our all ideas you post this blog is very presented. It's a really reasonable certainly work post.
Digital Marketing Training in Chennai
Digital Marketing Course in Chennai

Philips Huges said...

Its very useful to me. Wonderful blog.. Thanks for sharing informative Post.

Installment loans in alabama
Payday loans in alabama
Title loans in alabama
Cash Advances in alabama

Jason Borne said...

We are a third party technical support service. Avast Customer Support is here to help you out with the whole procedure to Download Avast Antivirus online, We not only fix your Avast Support related issues but will guide with how to get started with your new Avast product once it gets installed successfully.We at Avast Tech Support provides service to protect your PC from potential online threats and external attacks like viruses, Trojans, malwares, spywares and phishing scams. And Avast Refund. Call on our Avast Phone Number.

Gmail Customer service is a third party technical support service for Gmail users when they face any technical issue or error in their Gmail account. Our Gmail Customer Support team solves issues like forgot Gmail account password, Gmail configuration or Sync issues, recover deleted emails and many more. Toll Free number (800) 986-9271
How you install or reinstall Office 365 or Office 2016 depends on whether your Office product is part of an Office for home or Office for business plan. If you're not sure what you have, see what office com setup products are included in each plan and then follow the steps for your product. The steps below also apply if you're installing a single, stand-alone Office application such as Access 2016 or Visio 2016. Need Help with office setup Enter Product Key? Call 1-800-000-0000 Toll Free
Norton Tech Support is a third party service provider and not in any way associated with Norton or any of its partner companies. We offer support for Norton products and sell subscription based additional warranty on computer and other peripheral devices. Call our Toll Free number 1 855 966 3855
Other Services
Norton Toll Free , Office-Setup , office.com/setup.

sandhosh said...

Thank you for this great article which conveyed a good information.keep more updates.
SEO Company in India
SEO Services in India
SEO Companies in India
SEO Company India
SEO Services India

Guna Sekar said...

Excellent Post, Interesting Article.Indias Fastest Local Search Engine, you can Search Anything, From anywhere at any time CALL360

Cylon Technologies said...

nice blog I really appricate the blogger
Cylon Technologies is best Software Development Company in Michigan  The management’s role at Cylon Technologies is to empower employees to believe in the power of ideas.

Guna Sekar said...

Excellent Article, Keep posting
AC Mechanic in Anankaputhur
AC Mechanic in Ashok Nagar
AC Mechanic in Ayanavaram
AC Mechanic in Chetpet
AC Mechanic in Chrompet

helen shapiro said...

it is a beautiful post, and I want to say thank you so much for sharing this information.
digital marketing services in india

Anonymous said...

I have read your blog and I gathered some needful information from your blog. Keep update your blog. Awaiting for your next update.

QTP Training Videos

Peter Johnson said...

Really Thanks For Posting Such an useful information......

Bala Guntipalli

seo said...

This Blog is very helpful and useful,came to know that i should be strong in my basics and this blog helps me to improve it,Chicago Immediate Care Services Provided by Us.Thanks For Posting.I Am refereed by my friend to this blog and i also want to refer my other friends to this blog.

Lathika Honey said...

It's A Great Pleasure reading your Article, learned a lot of new things, we have to keep on updating it Bala Guntipalli Thanks for posting.

Lathika Honey said...

Excellent article, Cool, Looking ahead to reading a lot. Sensible article USMLE Thanks for posting.

svr online Training said...

Thanks for Providing such an useful and informative article on Salesforce Certification Training

Lathika Honey said...

Really Thanks For Posting Such an Useful and informative article. Mulesoft Certification Training

Nutra Trials said...

Nutra Trials defines personal characteristics of different health products including skincare, weight loss, muscle and male enhancement. The study presented here is briefly described for reader convenience and to deliver them assurance with health standards. The best possible answers are given here regarding the selection of an ideal supplement or cream or serum that possibly remains to be safe for health and do not cause any side effects.

24Layouts said...

Really Thanks For Providing Such an Useful Information.....

Plots for Sale in Vizag

Mediahub news said...

Fantastic article to go through, I would appreciate the writer's mind ( fmovies.in.net ) and the skills he has presented this great article to get its look in better style. Fmovies

NutraT line said...

Nice.... article to go through,I would appreciate the writer's and I hope you continue this job well
NutraT line

Sai Elakiyaa said...

Very true and inspiring article. I strongly believe all your points. I also learnt a lot from your post. Cheers and thank you for the clear path.
Selenium training in Chennai
Selenium Courses in Chennai
ios developer training in chennai
Best ios Training institute in Chennai
iOS Course Chennai
JAVA Training Institutes in Chennai
Java Courses in Chennai

Vicky Ram said...

Thank you for sharing this post.


Guest posting sites

nanadhini chandran said...

I am feeling great to read this.you gave a nice info for us.
please update more.
Angular 6 training in Bangalore
AngularJS Training in Anna Nagar
Angular JS Training courses near me

LindaJasmine said...

Awesome Post. I was searching for such a information for a while. Thanks for Posting. Pls keep on writing.
Informatica Training in Chennai
Informatica Training center Chennai
Informatica Training Institute in Chennai
Best Informatica Training in Chennai
Informatica Course in Chennai
Informatica Training center in Chennai
Informatica Training chennai

Anjali Siva said...

Thanks admin, I have learned how to write the test cases with the help of your blog. Continue sharing more like this.
DevOps certification Chennai
DevOps Training in Chennai
DevOps Training institutes in Chennai
DevOps Training in Velachery
Data Science Course in Chennai
Blue Prism Training in Chennai
RPA Training in Chennai

Sathish K said...

Hi, I have read your blog and I gathered some needful information from this blog. Thanks for sharing. Keep updating your blog.

Oracle course in Chennai
Oracle Training
Oracle Certification in Chennai
Best VMware Training
VMware course in Chennai
VMware Course

sai ram said...

Useful information... thanks for posting..

Just News To U 99

Anbarasan14 said...

This is a very helpful blog for one who needs to learn in a short span of time.

IELTS Training Institute in Guduvanchery
IELTS Coaching in Tambaram
IELTS Coaching Centre in Tambaram
IELTS Training in Tambaram
IELTS Coaching Class in Velachery
IELTS Coaching near me
IELTS Coaching in Chennai Tharamani

swetha singh said...

I have gone through your blog, it was very much useful for me and because of your blog, and also I gained much unknown information, the way you have clearly explained is really fantastic. Kindly post more like this, Thank You.
airport ground staff training courses in chennai
airport ground staff training in chennai
ground staff training in chennai

rupa said...

This information is impressive. I am inspired with your post writing style & how continuously you describe this topic. Eagerly waiting for your new blog keep doing more.
Android Training in Bangalore
Android App Development Training in Bangalore
Android Training Center in Bangalore
Angularjs Institute in Bangalore
Best Angularjs Training in Bangalore

LindaJasmine said...

Awesome Post. It was a pleasure reading your article. Thanks for sharing.

Pega training in chennai
Pega course in chennai
Pega training institutes in chennai
Pega course
Pega training
Pega certification training
Pega developer training

jenifer irene said...

Such an excellent and interesting blog, do post like this more with more information, this was very useful, Thank you.
Airport management courses in chennai
airline and airport management courses in chennai
airline management courses in chennai
aircraft maintenance course in chennai

thomus jons said...

Hello, I am thomus jons thank you for this informative post. That is a great job. Wish you more success.Thank you so much and for you all the best. Takes Down

lekha mathan said...

This information is impressive; I am inspired with your post. Keep posting like this, This is very useful.Thank you so much. Waiting for more blogs like this.
Aviation Academy in Chennai
Aviation Courses in Chennai
aviation institute in chennai
best aviation academy in chennai

ajay prakash said...

Very nice blog, Thank you for providing good information.
Air hostess training in Chennai
Air Hostess Training Institute in chennai
air hostess course fees structure in chennai
air hostess training academy in chennai

Georgia Jasmine said...

Times For Health is Online Health & Wellness Program! I came on the your post and i got so information here. Thanks for the valuable post. https://www.timesforhealth.com/

LindaJasmine said...

Amazing Post. Great write-up. Extra-ordinary work. Waiting for your next Post.
Social Media Marketing Courses in Chennai
Social Media Marketing Training in Chennai
Social Media Training in Chennai
Social Media Marketing Training
Social Media Marketing Courses
Social Media Training
Social Media Marketing Training
Social Media Courses