EDUCBA

EDUCBA

MENUMENU
  • Free Tutorials
  • Free Courses
  • Certification Courses
  • 600+ Courses All in One Bundle
  • Login
Home Software Development Software Development Tutorials Software Testing Tutorial How to Write Test Case?
Secondary Sidebar
Software Testing Tutorial
  • Advance
    • Cyclomatic Complexity
    • Decision Table Testing
    • Decision Tree Algorithm
    • What is Continuous Integration
    • Mantis Bug Tracker
    • Equivalence Partitioning
    • Gantt Chart Software
    • Acceptance Testing Types
    • Load testing tools
    • Install TestNG
    • Install Unity
    • Defect Management Process
    • Test Plan Template
    • Testing Interview Questions
    • Testing of Mobile application
    • What is Test Automation Frameworks
    • Test Automation Framework
    • Application of Automation
    • Test Automation Process
    • Automation Testing Roles and Responsibilities
    • What is Instruction Cycle?
    • What is Cucumber?
    • 15 Best Popular Bug Reporting Tools
    • What is Automated Testing?
    • Software Maintenance Types
    • Types of Penetration Testing
    • Software Reliability
    • Best Gantt Chart Software
    • Code Coverage
    • Branch Coverage
    • Decision Coverage
    • Statement Coverage
    • What is Test Case
    • Types of Test Case
    • What is Test Scenario
    • Formal Review
    • Alpha Beta Pruning
    • What is Cyclomatic Complexity?
    • Test Coverage
    • How to Write Test Case
    • Testing Documentation
    • Performance Testing Life Cycle
    • Test Harness
    • Test Strategy
    • Software Incident Management
    • What is Debugging
    • What is Defect?
    • Listeners in TestNG
  • Basics
    • What is Software Testing
    • Careers in Software Testing
    • Defect Life Cycle in Software Testing
    • Bug Life Cycle
    • Levels of Software Testing
    • Software Testing Life Cycle
    • Software Tester Work
    • Software Testing Principles
    • Software Testing Services
    • Testing Methodologies
    • Test Approaches
    • Types of Software Testing
    • What is a Bug in Software Testing
    • Benefits of Automation Testing
    • What is Automation Testing?
    • Types of Automation
    • Typical Journey of a Software Tester
    • Automation Testing Process
    • Mobile Automation Testing
    • Automation Testing Life Cycle
    • Software Quality Assurance
    • Software Quality Assurance
    • What is Test Environment?
    • Verification and Validation Testing
  • Types of Testing
    • Adhoc Testing
    • Types of System Testing
    • Manual Testing Types
    • Unit Testing Types
    • Unit Testing Benefits
    • Agile Testing
    • What is Agile Testing
    • Acceptance Testing
    • Stress Testing Types
    • Alpha and Beta Testing
    • Application Testing
    • Automation Testing
    • Automation Testing Advantages
    • Benchmark Testing
    • Black Box Testing
    • Domain Testing
    • Dynamic Testing
    • Ecommerce Testing
    • Fuzz Testing
    • Gray Box Testing
    • GUI Testing
    • Installation Testing
    • Interface Testing
    • Interoperability Testing
    • Mainframe Testing
    • Manual Testing
    • Mutation Testing
    • Monkey Testing
    • Negative Testing
    • Penetration Testing
    • Penetration testing phases
    • Penetration testing framework
    • Protocol Testing
    • Recovery Testing
    • Regression Testing
    • Mobile Penetration Testing
    • Accessibility Testing
    • Sanity Testing
    • Scalability Testing
    • Security Testing
    • Spike Testing
    • Stability Testing
    • State Transition Testing
    • Static Testing
    • Gatling Load Testing
    • System Integration Testing
    • Structural Testing
    • Locust Load Testing
    • System Testing
    • Control Flow Testing
    • Unit Testing
    • Cypress testing
    • Volume Testing
    • Web Testing Application
    • What is Exploratory Testing
    • What is Stress Testing
    • What is Usability Testing
    • White Box Testing
    • Types of White Box Testing
    • Compatibility Testing?
    • Use Case Testing
    • Beta Testing
    • Integration Testing
    • Non Functional Testing
    • Non Functional Testing Types
    • What is Functional Testing
    • Functional testing types
    • Cookie Testing
    • Alpha Testing
    • Boundary Value Testing
    • Equivalence Class Testing
    • Glass Box Testing
    • SOA Testing
    • Smoke Testing
    • Visual Testing
    • Visual Paradigm
    • Model-Based Testing
  • Testing techniques
    • Software Testing Methodologies
    • Black Box Testing Techniques
    • Static Testing Techniques
    • Test Case Design Techniques
    • What is Static Analysis
  • Testing tools
    • Manual Testing Tools
    • Visual Testing Tools
    • Automation Testing Tools
    • Functional Testing Tools
    • GUI Testing Tools
    • Penetration Testing Tools
    • Performance Testing Tools
    • SOA Testing Tools
    • Accessibility Testing Tools
    • What is QTP
    • Regression Testing Tools
    • Security Testing Tools
    • Test Management Tools
    • Defect Management Tools
    • Code Coverage Tools
    • Test Coverage Tools
    • Defect Tracking Tools
    • Continuous Integration Tools
    • Install Bugzilla
    • Test data generation tool
    • Unit Testing Tools
    • Web Testing Tools
    • Stress Testing Tools
    • Performance Monitoring Tools
    • Mobile Testing Tools
    • Responsive Testing Tool
    • Cross Browser Testing Tools
    • Risk Based Testing
    • Database Testing Tools
    • WinRunner
    • What is Squish?
    • CubicTest
    • What is WinRM?
    • Bugzilla Tool
    • Code review tools
    • Penetration Testing Open Source Tools
  • Inteview Questions
    • Automation Testing Interview Questions
    • Manual Testing Interview Questions
    • ISTQB Interview Questions
    • Cucumber Interview Questions
    • Software Testing Interview Questions
    • Penetration Testing Interview Questions

How to Write Test Case?

By Priya PedamkarPriya 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
Popular Course in this category
All in One Software Development Bundle (600+ Courses, 50+ projects)
  600+ Online Courses |  3000+ Hours |  Verifiable Certificates |  Lifetime Access
4.6
Price

View Course

Related Courses

Software Testing Training (11 Courses, 2 Projects)4.9
Penetration Testing Training Program (2 Courses)4.8
TestNG Training (4 Courses, 2 Project)4.7
Primary Sidebar
Footer
About Us
  • Blog
  • Who is EDUCBA?
  • Sign Up
  • Live Classes
  • Corporate Training
  • 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
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

Let’s Get Started

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

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