EDUCBA

EDUCBA

MENUMENU
  • Explore
    • Lifetime Membership
    • All in One Bundles
    • Fresh Entries
    • Finance
    • Data Science
    • Programming and Dev
    • Excel
    • Marketing
    • HR
    • PDP
    • VFX and Design
    • Project Management
    • Exam Prep
    • All Courses
  • Blog
  • Enterprise
  • Free Courses
  • Login
Home Software Development Software Development Tutorials Software Testing Tutorial How to Write Test Case?

How to Write Test Case?

Priya Pedamkar
Article byPriya Pedamkar

How to Write Test Case?

Overview of How to Write Test Case?

Consider a scenario where you were asked to write test cases for testing an application. Would you be able to begin? You might have heard terms like test cases, test scripts, test plans, etc. These terms might sound confusing to you as they all sound very similar, but they are different in their meanings. It is very important to have a clear understanding of these software terminologies so that you can differentiate among them. In order to be well efficient in testing, you must begin with understanding what test cases are and how can you write them in a way such that it covers the given requirements.

Remember that a good tester is one who is detail-oriented. Besides having an eye for detail and specifications, a good tester should be able to write test cases effectively. Test case writing is not an easy task as it requires talent, experience, and good business understanding. One of the key skills required for writing quality test cases is decent writing skills. Good test cases are written with an objective to define the “what” and “how” of an application. Some testers might consider test case writing as a boring task, but the quality of test cases will determine the quality of your software, thereby determining the value and productivity and success of the team the company.

Start Your Free Software Development Course

Web development, programming languages, Software testing & others

Writing a Test Case

We can define a test case as a set of input and output conditions or variables that will help a tester determines if the AUT(application under test) satisfies the requirements specified in the software requirement specification or the requirement document. It is basically a document that contains information such as the preconditions for testing, the test data used for testing, the test id, the test description, the postconditions for testing, and the steps to perform testing. It also contains details about the result observed, i.e., actual result and the result as per the requirement, i.e., expected result.

All these details are specified for a particular test scenario so as to test for conformity against the requirement document. Then, a test case is marked as pass and fail depending on the comparison between the actual result and the expected result. A pass test case has an actual result, just like the expected result mentioned in the requirement. On the other hand, a failed test case does not have an actual output matching the expected output, and hence it is tagged as failed.

A test case is a scenario that is single and executable. It is carried by a tester guided by the “steps to be followed” specified in the test case clearly. Thus, a test case can be considered a series of instructions provided in steps to verify and validate the software behavior as per the requirements.

Test case parameters are:

  • Test Case Id
  • Test Case Name
  • Test Case Description
  • Test Data
  • Preconditions
  • Test steps
  • Expected Result
  • Actual Result
  • Postconditions
  • Test Case Environment

Test cases do impact the testing phase, so it should be made sure they are written even before the testing phase actually starts. Test case writing is just as important and unavoidable as the process of testing.

Steps for Test Case

The steps to write a good test case are:

  • A good test case has a test id along with a strong test name that ensures the clarity of the module being tested. Take an example where you are testing the signup page. In this case, use a title that contains “SignUp Page” in the title.
  • A good test case has a well structured, strong, compact and clear description of the test to be performed. At times, this section might include preconditions, information of the test environment and other such factors.
  • A good test case mentions the assumptions or any preconditions required to perform the given test properly. This might contain any requirement, such as any access permissions required to access the module being tested in the application.
  • A test case mentioning the test data being used for testing is regarded as a good test case.
  • The steps in the test cases should be concise, simple and clear. Also, make sure that the steps are not misleading so that there is no wastage of time while testing is done.
  • The expected and actual results for every step should be clearly mentioned. These are very helpful for the tester as using this, a tester can clearly identify the step at which the application fails during the time of failure.
  • Last but not least, make sure to make the test case is reusable

Sample Test Case for testing if the user is able to register into an application containing email, phone number, set password in the form.

  • Test Case Name: Signup page authentication
  • Description: A new user should be able to register successfully in the application.
  • Precondition: The user should be a new user.

Tc01

Tips and Tricks

While writing test cases, you should keep some points in mind like:

  • Ensure that a test case provides a good test coverage, i.e., no key functionality is missed from testing
  • Ensure the negative test cases or negative test scenarios are also documented and tested thoroughly.

Conclusion – How to Write Test Case?

Test cases are powerful and are beneficial to future employees, providing them with the truth about the system and its functionalities.

Recommended Articles

This has been a guide to How to Write Test Case? Here we have discuss the introduction, writing test cases, steps to write a good test case, parameters, and some tips and tricks. You can also go through our other suggested articles to learn more –

  1. What is Software Testing?
  2. Black Box Testing
  3. Careers as a Software Engineer
  4. Test Plan Template
ADVERTISEMENT
All in One Excel VBA Bundle
500+ Hours of HD Videos
15 Learning Paths
120+ Courses
Verifiable Certificate of Completion
Lifetime Access
ADVERTISEMENT
Financial Analyst Masters Training Program
2000+ Hours of HD Videos
43 Learning Paths
550+ Courses
Verifiable Certificate of Completion
Lifetime Access
ADVERTISEMENT
All in One Data Science Bundle
2000+ Hour of HD Videos
80 Learning Paths
400+ Courses
Verifiable Certificate of Completion
Lifetime Access
ADVERTISEMENT
All in One Software Development Bundle
5000+ Hours of HD Videos
149 Learning Paths
1050+ Courses
Verifiable Certificate of Completion
Lifetime Access
Primary Sidebar
Footer
About Us
  • Blog
  • Who is EDUCBA?
  • Sign Up
  • Live Classes
  • Certificate from Top Institutions
  • Contact Us
  • Verifiable Certificate
  • Reviews
  • Terms and Conditions
  • Privacy Policy
  •  
Apps
  • iPhone & iPad
  • Android
Resources
  • Free Courses
  • Java Tutorials
  • Python Tutorials
  • All Tutorials
Certification Courses
  • All Courses
  • Software Development Course - All in One Bundle
  • Become a Python Developer
  • Java Course
  • Become a Selenium Automation Tester
  • Become an IoT Developer
  • ASP.NET Course
  • VB.NET Course
  • PHP Course

ISO 10004:2018 & ISO 9001:2015 Certified

© 2023 - EDUCBA. ALL RIGHTS RESERVED. THE CERTIFICATION NAMES ARE THE TRADEMARKS OF THEIR RESPECTIVE OWNERS.

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you

Let’s Get Started

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA
Free Software Development Course

Web development, programming languages, Software testing & others

By continuing above step, you agree to our Terms of Use and Privacy Policy.
*Please provide your correct email id. Login details for this Free course will be emailed to you

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA Login

Forgot Password?

By signing up, you agree to our Terms of Use and Privacy Policy.

This website or its third-party tools use cookies, which are necessary to its functioning and required to achieve the purposes illustrated in the cookie policy. By closing this banner, scrolling this page, clicking a link or continuing to browse otherwise, you agree to our Privacy Policy

Loading . . .
Quiz
Question:

Answer:

Quiz Result
Total QuestionsCorrect AnswersWrong AnswersPercentage

Explore 1000+ varieties of Mock tests View more

🚀 Extended Cyber Monday Price Drop! All in One Universal Bundle (3700+ Courses) @ 🎁 90% OFF - Ends in ENROLL NOW