testcase code example

Example 1: effective test case

To write effective test case I have few criteria
1- I put myself into customer shoes by writing
test scenarios by end users perspective
2-I am trying to be specific by using clear statements
to make it understandable by everyone
3-And I am aiming %100 test coverage by
planing my test cases to make sure covers each
component and functionality specified in SRS document
4-And also I actively use test case management tool
jiraxray which helps me not only write text effective 
test cases but also helps me in tracking the progress about them
5-Also I try to keep the description small
simple and informative. Nobody likes to read long stories :)
6-And most importantly I try to do things differently
I try to think exceptionally.

Example 2: what does a test case consists of

It is documentation which describes step by step how to perform testing. 

It includes: 
	- test case ID (TC ID)
	- test case name (TC Name)
	- pre-condition
	- step definitions
	- test data
	- expected/actual result
	- pass/fail

Tester creates test cases.

Example 3: how do you write test cases

HOW TO WRITE TEST CASES

I break down the process into small pieces.

1. Requirement Analysis: Process starts with the grooming meeting.
I listen my PO very carefully during the grooming meeting.
Because she knows all the system reqirements and has 
connection with the business side. Even she knows all
expectations about the functionality she might not
reflect all details to the user stories and exceptance
criterias. So, I try to figure out what is the root
cause of any acceptance criteria. If I have some
doubts at first glance, it is high time to raise 
some additional question to her to clarify in and out.
After grooming meeting, I have 3 days to digest
all user stories and acceptance criterias before
sprint planning meeting. I try to find the gaps and bugs
at these phase which is a kind of static testing.
So, I can throw more detailed question on Sprint Planning meeting. 
The output of this phase is going to be RTM (Requirement Tracability Matrix). 

2. Test Planning: The most important deliverable is the test plan.
In this document, we cover the scope of the test, 
the test strategy, testing types and tools to be implemented,
roles and responsibilities. QA Lead prepares the
test plan on Jira and allocates the tasks for all QA team members.
She posts the Test Plan on Jira. 

3. Test case development:
During this phase, I generate test cases for
each and every functionality, covered in RTM.
After writing my test steps I ask related developer 
and PO to review my test steps just to make sure
that I cover all requirements and we are on the same page.
I always choose to start with happy path for each scenario.
Then I try to find out the limitations and boundries of 
the functionality which I can extract from acceptance criteria.
I force the function against all type of limitations
with different scenarios. The last 
I create some negative scenarios. 
If I find any gap during this phase
I go and tell PO to add some additional 
acceptance criterias or clarify them.

Example 4: what test case should contains

What does Test Case consist of?

It is documentation which describes step by step how to perform testing. 

It includes: 
	- test case ID (TC ID)
	- test case name (TC Name)
	- pre-condition
	- step definitions
	- test data
	- expected/actual result
	- pass/fail

Tester creates test cases.