Thursday, April 7, 2016

[WSO2] [QA] [TestLink] How to write a good Test Case ?

Hello Beginners,

So you may be a beginner or someone who are interesting to improve yourself. Great :) Lets begin...

In my case, I am using Test Link to add test cases. How are we going to write a good test case ?

1) First, you must have the overall idea of what you are going to test and write test cases. So read feature or use case and understand it well.

In my case, I will read documentations and relevant scenarios to learn exact feature.

2) Then design the plan or mind map to test. Through that, you will identify many possible scenarios to test.

As we are human, we may miss some points or testing scenarios. So it will be great if you are using a paper of design to sketch the diagram/design.

Ex:

Aggregate Mediator ----> How we implement Aggregate mediator (Can use iterate/clone mediator)
                                          At where? (In sequence /  out sequence)
                                          What can we do with that? (Aggregate messages/aggregate and put in to one element etc.)
       
Note: It will better to design/sketch diagrams rather than note down. Because visual representations easy to grab and easy to follow.

3) Let's write a test case for identified scenario.

Let's take example from Header Mediator (WSO2 ESB). Through Header mediator, it can handle HTTP headers and SOAP headers. Let's consider "Adding new SOAP header ".

So giving the name of the test case as "Adding new SOAP header for incoming messages".

Name of the test case must identify
  • What is the action we do through the test case (Ex: Adding)
  • What will be the result (Ex: New SOAP header)
  • For what we doing/ Where are we going to do that (Ex: For incoming messages)

4) Then it is the summary. As the name indicate it must summarize what you are going to do through the test case.

It may also include things which considered in the "Name". If something to specify more, you can use the summary to do that. But always it may short and sweet as the "Name" given.

Sample Summary:

This test case will cover adding new SOAP header for messages

5) Then it is "Preconditions".

In here, You must include everything which is required to continue test steps without any problem.

For example: I am testing WSO2 ESB header and it is needed to have ESB server up and running. And other requirements also should be included according to the scenario.

Sample Preconditions:
  • User should be login to ESB with proper credentials
  • Deploy the SimpleStockQuoteService on axis2 server and start axis2 server
6) Let's write test steps. Every step is must be meaningful and must have an expected result.

Add sample configurations to test steps and sample results in expected results.

Sample Test Steps:

Step Action

Create a sequence with header mediator which adding header to incoming SOAP message.

Header Mediator configuration:
  • Name:wsa:newHeader
  • Action:Set
  • Value:Accept
  • Scope:Synapse

Note: As a good practice add relevant configuration in a user friendly manner. Rather than saying "Create a Header mediator with this and this", you can give configuration as above example.

Expected Result

Sequence should be created.

Sample configuration:

<sequence name="seq30" xmlns="http://ws.apache.org/ns/synapse">
    <log level="full">
        <property name="Message" value="==========Before Header========="/>
    </log>
    <header name="wsa:newHeader" scope="default" value="Accept" xmlns:wsa="http://www.w3.org/2005/08/addressing"/>
    <log level="full">
        <property name="Message" value="==========After Header========="/>
    </log>
</sequence>



7) Check twice. Every step you write needed to care about.

Keep maintain less number of test steps while having steps which are easy to read.

Highlight words you want to impress.

8) Add correct status of Test case. After finished your test case, change Status to "Ready for review"

In Test Link, there are several status for test cases:

Draft - When you are working on the test case
Ready for review - Finished test case
Review in progress
Rework - This will add by reviewer if something has to change. And reviewer may add some comments under status saying what should have to change.
Obsolete - When this test case not useful anymore.
Future - In future, must add something. This may be used in improving the feature. After development, it has to update.
Final - Test case is done.

So now we are in Final State of the blog post.

Happy QAing :) :) :)

2 comments:

  1. Great Article Dilshani...Thanx a lot (Y)

    ReplyDelete
    Replies
    1. Happy to get comments/reviews which are encourage me :) :)

      Delete