15.11.13

How to write a good test case?

Writing test cases is one of the major and most important activities which any tester performs during the entire testing cycle. The approach for writing good test cases will be to identify, define and analyse the requirements.
When you begin writing the test cases, there are few steps which you need to follow to ensure that you are writing good test cases:


1. Identify the purpose of testing. You need to understand requirements to be tested. The first step is to define testing purpose.
When you start writing test cases for any software module, you must understand the features of the same and user requirements.


2. The second step is  to define how to perform testing. This will include defining Test Scenarios.To write good test scenarios you should be well versed with familiar with the functional requirements. You need to know how software is used covering various operations.


3. Identify Non-funtional requiremts.The third step is  to understand the other aspects of software related to non-functional requirements such as hardware requirements, operating system, security aspects to be considered, and other prerequisites such as data files or test data preparation. Testing of non-functional requirements is very important. For example, if the software requires a user to fill in the form, proper time-out logic should be defined by the developer to ensure that it should not result in time-out while submitting the form once user has filled in all required information. Simultaneously, under the same scenario tester should also ensure that user is getting logged-off after certain defined delay to ensure security of the application is not breached.


4. Fourth step would be to define a framework of test cases. The framework of test cases should cover UI interface, functionality, fault tolerance, compatibility, and performance of several categories. Each category should be defined in accordance with the logic of the software application.


5. Next step would be to become familiar with the modular principle. It is easy to analyze the relevance of the software modules present in the specified application. However, it is very important to understand the coupling between the modules. It is very important to test the "Mutual influence" of modules.
The test cases should be designed to cover influence of any module on other modules of the application. For example, in online shopping software while testing shopping cart and order checkout you need to also consider inventory management and validate if the same quantity of the purchased product is deducted from the stores. Similarly, while testing returns, we need to test its effect on the financial part of application along with store inventory.


Structuring of Test cases
Now you have all the required information to begin writing test cases. We will talk about the structure of a test case. Requirements of the software are mapped with test scenarios, which are further elaborated in test cases. For each test scenario, we define test cases. In each test case, we define Test Steps. Test Step is the smallest entity under any test case. It specifies the action to be performed, Expected result of the test application.


The format of a test case comprises of:
1. Test Case ID ( This is the unique number which helps in identifying a specific test cases)
2. Module to be tested (Usually we provide Requirement ID to maintain traceability between test case and requirements)
3. Test Data ( We provide variable and values based on need of the test case)
4. Test Steps ( Steps to be executed)
5. Expected results ( How application should behave after performing stated test steps)
6. Actual results ( Actual output tester will get after preforming steps)
7. A result ( Pass or fail after comparing expected and actual results)
8. Comments ( We can provide screen shot or any other relevant information to help developer debug the code)
During testing you will mark your results against each step, and the defect report will provide related test case ID, which failed during execution.  This can help a tester to relate back to requirements and understand the business scenario which needs to be fixed in code.
For writing test cases you can use simple xls file or tester can select from a wide variety of tools already available. There are few tools such as Quality Centre, Test Director which tester can avail after paying license cost, or you can avail open source tools such as bugzilla.


The test cases can be written with great details, including a large number of steps, or you can also write relatively simple test cases. I personally do not agree with the approach of a large number of steps to be included in test cases.


Here are my thoughts on how a tester can write effective test cases:
1. Self-explanatory and specific – test cases should have sufficient details so that even a new tester can execute the same without any help. All the pre-requisite which are required to execute a specific test should be mentioned in the tests itself. Further, it should clearly specify the purpose and scope of their steps.
2. Valid and concise – test cases should have all designated steps to test based on expectations of the testing. It should not have unnecessary steps. If there are too many test steps in a single test case to be performed the tester may lose focus and aim.
3. Traceable – test cases should cover all the requirements of the software, and every test case should be mapped with “Requirement ID." This helps in ensuring that testing is providing 100% coverage to complete requirements and tester is performing testing for all requirements. Further, it also helps in impact analysis.
4. Maintainable – with the changes in requirement, tester should be able to easily maintain the test suite of test cases. It should reflect the changes in software and accordingly steps should be modified.
5. Positive and negative coverage– test cases should test for boundary values, equivalence classes, normal and abnormal conditions.  Apart from testing for expected results, the negative coverage can help in testing failure conditions and error-handling.
6. Coverage for Usability aspect – Test cases  should include testing for UI interface from the aspect of ease of use. The overall layout and color should be tested against a style guide, if any defined for the software application under testing or should be tested against the signed off mock- up designs. Basic English punctuations, spellings, drop-down list categorizations such as depended pick lists should be covered.
7. Test Data – there should be the diversity of the data which should be used in test cases such as -   Valid data, Legitimate invalid data (to test boundary value), Illegal and abnormal data ( to test error handling and recovery).
8. Non-Functional aspect – the test cases should cover scenarios for basic performance testing of the application such as Multi-user operation, capacity test.  It should cover security aspects such as user permissions, logging mechanism. Test cases for Browser support  in case of  web application.


To summarize, the test cases should first be able to cover all the functional requirements, and then we should also include the test cases which are related to non- functional requirements as they are equally important for the proper functioning of the software.

63 comments:

  1. Your information about software is really interesting. Also I want to know the latest new techniques which are implemented in software. Can you update it in your website?
    LoadRunner training in Chennai

    ReplyDelete
  2. The test cases are really good. Nice informative article on software testing.
    mobile application development services

    ReplyDelete
  3. I gathered a lot of information through this article.Every example is easy to undestandable and explaining the logic easily.Thanks!
    Phonegap Training in chennai | Phonegap Training chennai | Phonegap course in chennai | Phonegap course chennai

    ReplyDelete
  4. It’s actually an excellent and useful item of information. Check Writing Software | Cheque Printing in Dubai

    ReplyDelete
  5. Really an awesome post. I wondered by reading this blog post. Thanks a lot for posting this unique post which you have shared with us. Keep on posting like this exclusive post with us.

    Seo Training in Chennai

    ReplyDelete
  6. I cant wait to check out some of these blogs! I’ve really wanted to start learning more about cars and auto repairs lately and I think this will help a lot. I think it can save my family some money if we knew how to do some repairs at home.! Thanks again for all the options.

    bike spa services in mumbai
    house cleaning services in mumbai
    car wash services in mumbai

    ReplyDelete
  7. Thank you to all of you who found the blog interesting and appreciate it!

    ReplyDelete
  8. blog was nice,very excellent software information for me,really good one thanks for sharing.
    Back to original

    ReplyDelete
  9. Thanks for the post, It is very helpful. High appreciate the efforts for sharing all the in-details and browser configurations for testing Selenium Grid.
    Check out one of the post related to selenium concepts

    Practical Oriented Selenium Training in Chennai

    ReplyDelete
  10. I do accept that we share our all ideas you post this blog is very presented. It's a really reasonable certainly work post.
    Digital Marketing Training in Chennai
    Digital Marketing Course in Chennai

    ReplyDelete


  11. Thank you for this great article which conveyed a good information.keep more updates.
    SEO Company in India
    SEO Services in India
    SEO Companies in India
    SEO Company India
    SEO Services India

    ReplyDelete
  12. I have read your blog and I gathered some needful information from your blog. Keep update your blog. Awaiting for your next update.



    QTP Training Videos

    ReplyDelete
  13. Really Thanks For Posting Such an useful information......

    Bala Guntipalli

    ReplyDelete
  14. Excellent article, Cool, Looking ahead to reading a lot. Sensible article USMLE Thanks for posting.

    ReplyDelete
  15. Thanks for Providing such an useful and informative article on Salesforce Certification Training

    ReplyDelete
  16. Really Thanks For Posting Such an Useful and informative article. Mulesoft Certification Training

    ReplyDelete
  17. Really Thanks For Providing Such an Useful Information.....

    Plots for Sale in Vizag

    ReplyDelete
  18. I have gone through your blog, it was very much useful for me and because of your blog, and also I gained much unknown information, the way you have clearly explained is really fantastic. Kindly post more like this, Thank You.
    airport ground staff training courses in chennai
    airport ground staff training in chennai
    ground staff training in chennai

    ReplyDelete

  19. This information is impressive. I am inspired with your post writing style & how continuously you describe this topic. Eagerly waiting for your new blog keep doing more.
    Android Training in Bangalore
    Android App Development Training in Bangalore
    Android Training Center in Bangalore
    Angularjs Institute in Bangalore
    Best Angularjs Training in Bangalore

    ReplyDelete
  20. TecSmash is your ultimate source of Technology news and Make Money Online product reviews. We research and review all Tech, MMO, Biz Opp and IM products. Tecsmash

    ReplyDelete
  21. Supplements For Fitness eating foods fortified with friendly bacteria, it is likely that the preference for probiotic supplements will be more popular in 2010. A key sales driver is to create more public awareness about specific strains of probiotics and its relation to health.

    https://www.supplementsforfitness.com/

    ReplyDelete
  22. This comment has been removed by the author.

    ReplyDelete
  23. This comment has been removed by the author.

    ReplyDelete
  24. Quit 9 To 5 Academy Review is an amazing website where you get to work and learn with the professionals and then start your business in the platform of Facebook.

    ReplyDelete
  25. Trim Fit Keto the book, but felt the difficulty of the eating regimen made it less famous. On this creator's opinion Ducahine's e book is a must read for all of us inquisitive about vitamins.Ketogenic Diets have been used for years to treat specific situations along with obesity and childhodd epilepsy. The results of Visit for more info : - https://360nutra.org/trim-fit-keto/

    ReplyDelete
  26. Tevida were in use for thousands of years. After comprehensive laboratory testing, scientific research and research, natural male enhancers are determined to be as powerful as the opposite varieties of natural enhancement products the use of chemical substances as their major additives in addressing the Visit for more Info :- https://360nutra.org/tevida/

    ReplyDelete
  27. InMotion Body Keto Flex back it up, is the country wide Weight manage Registry. For you to join the Registry, a person has to have misplaced pounds and have saved it off for a 12 months. Currently such as over 4500 people, the Registry became based in 1993 as a longitudinal potential examine. Presently, Visit for more info :- https://360nutra.org/inmotion-body-keto-flex/

    ReplyDelete
  28. InMotion Body Keto Flex period. The Range of kcalories eaten, and the food picks and their Quantities, should be reevaluated on a normal foundation... Possibly as soon as every 1-2 months to determine this system's Effectiveness.17. Regular exercise is not encouraged as a part of the Plan for proper weight Visit for more info :- https://360nutra.org/inmotion-body-keto-flex/

    ReplyDelete
  29. AlkaTone Keto a recent look at, groups were monitored. Both corporations ate up 30% in their each day calorie consumption in fats. The simplest great dietary difference changed into that one group fed on handiest 12% in their calories from protein (58% carbohydrates), while the other group consumed 25% Visit for more info :- https://timesnutrition.com/alkatone-keto/

    ReplyDelete
  30. InMotionBodyKetoFlex21 higher.So what are you willing to give up to reach your goal in your preferred time frame?For some people they want to lose weight as speedy as possible. So they're ok with making some sacrifices here or there.Other humans price a sluggish and .For More Info : https://360nutra.org/inmotion-body-keto-flex/
    InMotion Body Keto Flex

    ReplyDelete
  31. Good blog
    Apponix Technologies
    https://www.apponix.com/Software-Testing/Software-Testing-Training-in-Bangalore.html

    ReplyDelete
  32. Keto Flex don't run out and purchase a protein powder at your nearby grocer!Your dinner should be large protein and slow carbs. This may be really yummy and does not must be uninteresting and stupid or unsightly. Have a Visit for more info :- https://360nutra.org/inmotion-body-keto-flex/

    ReplyDelete
  33. Tevida this could also imply that you are buying a reasonably-priced high-quality male enhancement supplement.Loads of men were discussing about the pleasant male enhancement pills that can treat their dysfunctions and one way or the other help to Visit for more Info :- https://360nutra.org/tevida/

    ReplyDelete
  34. Keto BHB 800 is a revolutionary supplement for weight loss. It is specially designed with natural ingredients to burn belly fat and extra fat from your body. The supplement converts your excess fat into energy instead of carbs. Keto BHB 800 supplement has ingredients that are all natural. It’s composed of BHB and many others. Kindly Visit on http://www.rushyourtrial.com/coupon/keto-bhb-800-natural-weight-loss-diet-supplement/

    ReplyDelete
  35. Call Now at 7634078909 to grab a Free SEO consultation from the certified SEO consultant at Elite SEO

    Agency.

    Boost your online website promotion & convert your coaching institute business into a steady recurring

    online income!

    +91-7634078909
    info@eliteseo.agency

    https://www.eliteseo.agency/gwalior-seo/

    ReplyDelete

  36. Pure Life Keto is a homogenous mixture of all the natural and effective ingredients. These ingredients are safe and proved to be helpful in the burning of fats easily. It burns the extra body fats from the abdominal regions, thighs, buttock region and from arm muscles. But it does not harm the mass of muscles. Your muscle masses are conserved in their original shape and size. Only the extra fats are expelled out. You are not alone every third person in the US is tending to lose weight. Visit On http://www.theapexhealth.com/pure-life-keto-reviews-shark-tank-diet-pills-for-eliminate-extra-fat/

    ReplyDelete
  37. Insta Keto claims to be a natural supplement that suppresses the appetite, making an impact towards healthy weight loss process. The consistent use of the pills allows individuals to go with less snacking habits at night due to reduced food cravings or hunger cravings. It controls the formation of bad cholesterols and maintains a healthy blood sugar level promoting better health condition. The metabolic rate gets elevated with an improved ketosis process allowing carbs to get utilized as energy resources. VISIT on http://www.theapexhealth.com/true-burn-keto-reviews-true-burn-keto-ketogenic-diet-pills/

    ReplyDelete
  38. Crypto Mojo blog by Fred Haris is the one-stop destination for crypto news, basics, trading tips for bitcoin and other cryptocurrencies, price prediction, and reviews.

    ReplyDelete
  39. Here are some health and fitness tips for those who want to get started yet not sure how to do so. These simple tips can aid you in losing fat, gaining muscle mass, and maintaining healthy eating habits as well.

    ReplyDelete
  40. Here are some health and fitness tips for those who want to get started yet not sure how to do so. These simple tips can aid you in losing fat, gaining muscle mass, and maintaining healthy eating habits as well.

    ReplyDelete
  41. Nice blog and absolutely outstanding. You can do something much better but i still say this perfect.Keep trying for the best.Lepto Connect Review

    ReplyDelete
  42. Not many writers can persuade me to their way of thinking. You've done a great job of doing that on many of your views here.
    SAP training in Kolkata
    SAP training Kolkata
    Best SAP training in Kolkata
    SAP course in Kolkata

    ReplyDelete
  43. A good blog always comes-up with new and exciting information and while reading I have feel that this blog is really have all those quality that qualify a blog to be a one.I wanted to leave a little comment to support you and wish you a good continuation. Wishing you the best of luck for all your blogging efforts read this.
    DevOps Training in Chennai

    DevOps Course in Chennai

    ReplyDelete
  44. Thanks for the nice blog. It was very useful for me. I'm happy I found this blog. Thank you for sharing with us,I too always learn something new from your post. catchy business names

    ReplyDelete
  45. This post is so interactive and informative.keep update more information...
    ccna Training in Velachery
    ccna course in Chennai

    ReplyDelete
  46. Thanks for an interesting blog. What else may I get that sort of info written in such a perfect approach? I have an undertaking that I am just now operating on, and I have been on the lookout for such info. short business names

    ReplyDelete
  47. Thank you for such informative knowledge. This is really useful for software testers. Keep sharing like these blogs. software training institute in lucknow is the right place, where you can start your career.

    ReplyDelete