How to write effective test cases?
What is test case?
• It is a document which covers all the possible test scenarios for specific
requirements.
• A test case in software testing is document that consists set of conditions or
steps designed to verify if a particular feature/functionality in a software
application is working as expected.
• It defines the inputs, actions, and expected results for a specific test
scenario to ensure the software behaves correctly under various conditions.
• A test case typically includes information like the test case ID, description,
steps, preconditions, input data, execution steps, expected outcome, and
any post-conditions or cleanup required
When Testcase?
Test cases are written in different situations:
• Before development: Test cases could be written before the
actual coding as that would help to identify the requirement of the
product/software and carry out the test later when the
product/software gets developed.
• After development: Test cases are also written directly after
coming up with a product/software or after developing the feature
but before the launching of a product/software as needed to test
the working of that particular feature.
• During development: Test cases are sometimes written during
the development time, parallelly. so whenever a part of the
module/software gets developed it gets tested as well.
Why test case?
1.We write test case to have better test coverage
a. When the req comes in dev are busy in developing the product, same time TEs
are free so they identify all possible scenarios and document it
b. When the build comes TE can spend time in executing the scenarios and because
of this number of scenarios that you are covering will be more
2.To have consistency in test execution: It means if you have documented the scenarios,
you can make sure that you are executing all the scenarios in all test
cycles/sprint/release
3.To depend on the process rather than on person
4.It avoids training every new TE on the product or on the requirement
5.Test case is to the only document which acts like a proof for customer, dev team and
manager that we have covered all possible test scenarios
6.Test case acts like a base document for writing the automation scripts, if you refer test
case and write automation scripts you can ensure that same kind of coverage even in
automation scripts
7.If you have documented the test cases, you don’t have to remember the scenarios
8. If you have documented the test cases, test execution happens in a very organized
way.
9. If you have documented the test cases, time taken to execute will be very less.
How to write a test case?
• Test design technique
• Clear and concise test.
• Uniform nomenclature
• Fundamental/Atomic Test cases
• Leave no scope for ambiguity
• No Assumptions
• Avoid redundancy
• Traceable tests
• Ensure to cover the different aspects of the software
• Test data
Test case Attributes
• Test Case Id – A unique identifier of the test case..It is a mandatory field that uniquely identifies a test case e.g. TC_01.
• Test Summary – One-liner summary of the test case.
This is an optional field. Normally the test cases either have the ‘Test Summary’ field or the ‘Description’ field.
• Description – Detailed description of the test case.
This field defines the purpose of the test case e.g. verify that the user can login with a valid username and valid password.
• Prerequisite or pre-condition – A set of prerequisites that must be followed before executing the test steps.
For example – while testing the functionality of the application after login, we can have the pre-requisite field as “User should be
logged in to the application”.
• Test Steps – Detailed steps for performing the test case.
This is the most important field of a test case. The tester should aim to have clear and unambiguous steps in the test steps field so
that some other person can follow the test steps during test execution.
• Test Data – The value of the test data used in the test case.
For example – while testing the login functionality, the test data field can have the actual value of the username and password to
be used during test execution.
• Expected result – The expected result in order to pass the test.
Based on the test steps followed and the test data used, we come up with the expected result e.g. the user should successfully login
and navigated to home page.
• Actual result – The actual result after executing the test steps.
This field is filled during test execution only. In this field, we write the actual result observed during the test case execution.
• Test Result – Pass/Fail status of the test execution.
Based on the expected result and the actual result, the test case is marked as passed or Failed. Apart from Pass/Fail, we can have
other values also like-Deferred, when the test case is marked to be executed later, for some reason.
Blocked, when the test case execution is blocked due to some other issue in the application).
• Automation Status – Identifier of automation – whether the application is automated or not.
This is an optional field used only when we have automation in the project
• Date – The test execution date.
This field helps in keeping track of the different iteration during multiple test execution cycles.
• Executed by – Name of the person executing the test case.
This field helps when there are multiple team members working on the test execution activity.
Test case Template
TEST CASE NAME REQIREMENT NO TEST DATA PRECONDITION
TESTCASE TYPE SEVERITY BRIEF DESCRIPTION
TCID DESCRIPTION TEST
STEPS
INPUT
DATA
EXPECTED
RESULT
ACTUAL
RESULT
STATUS COMMENTS
AUTHOR REVIEWER APPROVED BY APPROVED DATE
EXAMPLE OF TEST CASE
TEST
CASEID
DESCRIPTION PRE
COND
ITION
TEST STEPS TEST
DATA
EXPECTED
RESULT
ACTUAL
RESULT
STATUS
TC_01 Verify login with
valid credentials
User is
on the
login
page
1. Enter
valid
username
2. Enter
valid
password
3. Click
"Login"
USER
NAME:
yash@
gmail.
com
PWD:Y
ash@1
23
user is
redirected
to
dashboard
To be
filled after
execution
Pass/Fail
Tools to write test case
Manual
• Excel
• Word
• Google sheets
Summary
• Effective test cases improve software quality
• They are clear, reusable, and traceable
• Use tools for efficiency and collaboration

How to write effective test cases present.pptx

  • 1.
    How to writeeffective test cases?
  • 2.
    What is testcase? • It is a document which covers all the possible test scenarios for specific requirements. • A test case in software testing is document that consists set of conditions or steps designed to verify if a particular feature/functionality in a software application is working as expected. • It defines the inputs, actions, and expected results for a specific test scenario to ensure the software behaves correctly under various conditions. • A test case typically includes information like the test case ID, description, steps, preconditions, input data, execution steps, expected outcome, and any post-conditions or cleanup required
  • 3.
    When Testcase? Test casesare written in different situations: • Before development: Test cases could be written before the actual coding as that would help to identify the requirement of the product/software and carry out the test later when the product/software gets developed. • After development: Test cases are also written directly after coming up with a product/software or after developing the feature but before the launching of a product/software as needed to test the working of that particular feature. • During development: Test cases are sometimes written during the development time, parallelly. so whenever a part of the module/software gets developed it gets tested as well.
  • 4.
    Why test case? 1.Wewrite test case to have better test coverage a. When the req comes in dev are busy in developing the product, same time TEs are free so they identify all possible scenarios and document it b. When the build comes TE can spend time in executing the scenarios and because of this number of scenarios that you are covering will be more 2.To have consistency in test execution: It means if you have documented the scenarios, you can make sure that you are executing all the scenarios in all test cycles/sprint/release 3.To depend on the process rather than on person 4.It avoids training every new TE on the product or on the requirement 5.Test case is to the only document which acts like a proof for customer, dev team and manager that we have covered all possible test scenarios 6.Test case acts like a base document for writing the automation scripts, if you refer test case and write automation scripts you can ensure that same kind of coverage even in automation scripts 7.If you have documented the test cases, you don’t have to remember the scenarios 8. If you have documented the test cases, test execution happens in a very organized way. 9. If you have documented the test cases, time taken to execute will be very less.
  • 5.
    How to writea test case? • Test design technique • Clear and concise test. • Uniform nomenclature • Fundamental/Atomic Test cases • Leave no scope for ambiguity • No Assumptions • Avoid redundancy • Traceable tests • Ensure to cover the different aspects of the software • Test data
  • 7.
    Test case Attributes •Test Case Id – A unique identifier of the test case..It is a mandatory field that uniquely identifies a test case e.g. TC_01. • Test Summary – One-liner summary of the test case. This is an optional field. Normally the test cases either have the ‘Test Summary’ field or the ‘Description’ field. • Description – Detailed description of the test case. This field defines the purpose of the test case e.g. verify that the user can login with a valid username and valid password. • Prerequisite or pre-condition – A set of prerequisites that must be followed before executing the test steps. For example – while testing the functionality of the application after login, we can have the pre-requisite field as “User should be logged in to the application”. • Test Steps – Detailed steps for performing the test case. This is the most important field of a test case. The tester should aim to have clear and unambiguous steps in the test steps field so that some other person can follow the test steps during test execution. • Test Data – The value of the test data used in the test case. For example – while testing the login functionality, the test data field can have the actual value of the username and password to be used during test execution. • Expected result – The expected result in order to pass the test. Based on the test steps followed and the test data used, we come up with the expected result e.g. the user should successfully login and navigated to home page. • Actual result – The actual result after executing the test steps. This field is filled during test execution only. In this field, we write the actual result observed during the test case execution. • Test Result – Pass/Fail status of the test execution. Based on the expected result and the actual result, the test case is marked as passed or Failed. Apart from Pass/Fail, we can have other values also like-Deferred, when the test case is marked to be executed later, for some reason. Blocked, when the test case execution is blocked due to some other issue in the application). • Automation Status – Identifier of automation – whether the application is automated or not. This is an optional field used only when we have automation in the project • Date – The test execution date. This field helps in keeping track of the different iteration during multiple test execution cycles. • Executed by – Name of the person executing the test case. This field helps when there are multiple team members working on the test execution activity.
  • 8.
    Test case Template TESTCASE NAME REQIREMENT NO TEST DATA PRECONDITION TESTCASE TYPE SEVERITY BRIEF DESCRIPTION TCID DESCRIPTION TEST STEPS INPUT DATA EXPECTED RESULT ACTUAL RESULT STATUS COMMENTS AUTHOR REVIEWER APPROVED BY APPROVED DATE
  • 9.
    EXAMPLE OF TESTCASE TEST CASEID DESCRIPTION PRE COND ITION TEST STEPS TEST DATA EXPECTED RESULT ACTUAL RESULT STATUS TC_01 Verify login with valid credentials User is on the login page 1. Enter valid username 2. Enter valid password 3. Click "Login" USER NAME: yash@ gmail. com PWD:Y ash@1 23 user is redirected to dashboard To be filled after execution Pass/Fail
  • 10.
    Tools to writetest case Manual • Excel • Word • Google sheets
  • 11.
    Summary • Effective testcases improve software quality • They are clear, reusable, and traceable • Use tools for efficiency and collaboration