Testing And Coverage Assignment

From Foss2Serve
Jump to: navigation, search


Title

Testing and Coverage Assignment

Overview

Participants write unit tests (in Google Test) to identify bugs in a C++ class

Prerequisites

Students need to:

  • Have installed and programmed unit tests with Google Test.
  • Know how to run a coverage analyzer and interpret its results.
  • Have intermediate knowledge of Git version control.
Learning
Objectives
After successfully completing this activity, the learner should be able to:
  • Write unit tests.
  • Use a coverage analysis tool to identify test cases they may be missing and to reflect over possible errors in the code.
Process Skills
Practiced


Directions

Students

  1. You were just hired by GameTastic. They outsourced the work to start development of ConnectX, a variation of the board game "Connect Four." However, when they discovered that their outsourced workers were not following Test-Driven Development, they decided to hire new developers including you. They have tasked you to test the code already written and identify any bugs that already exist. Before going any further, they want to be confident in the code.
  2. Use your knowledge of how to write unit tests and assessing the quality of testing to write sufficient tests so the team can be confident that your tests will identify any problems.
  3. Fork the ConnectX repo into your own GitHub space
  4. Clone the fork onto your computer. For this test, you should commit changes to your computer locally, but do not push any of your commits to the fork until instructed to do so by the instructor.
  5. Keep your local repo clean -- only staging and committing the files relevant to the project tests: ConnectXTest.cpp and README.md. Do NOT commit changes to any other files.
  6. In README.md, put your name and in bullet-list form, note any bugs you discover. Describe the bugs with enough detail that another developer can start fixing them.
  7. Do not actually fix the bugs, you will only send your bug report to another developer on the team
  8. Have your work completed and committed locally on your computer (and ready to push, but not yet pushed) by (deadline)

Deliverables

A fork of the ConnectX repository, with added tests and documentation of found bugs

Assessment

Grades will be based on the following specifications:

 50% Unit tests are written correctly and logically
 30% Testing thoroughly assesses the code
 10% At least one bug in the code is discovered (there are two related intentional bugs in the existing code)
 10% Instructions followed precisely
 EXTRA CREDIT: Bugs are identified correctly and described clearly
Criteria Level 1 (poor) Level 2 (fair) Level 3 (excellent)
Unit tests (50%) Tests not adequately set up nor separated into individual test functions that each check one specific case Unit tests generally follow the correct format but do not follow all conventions such as poorly-named functions or a test function really checking multiple cases Unit tests are organized in a collection of test functions which each test specific cases and each test has appropriate input, output, and assertions
Testing thoroughness (30%) The unit tests does not exercise each function of the program The unit tests execute each function but does not check each condition of control statements (if, else, etc) The unit tests exercise each line of code and follow each branch of control statements
Bug discovery (10%) No bugs are identified At least one bug has been identified but are not described accurately and precisely both by failing tests and in the documentation Failing tests indicate where the code does not operate as described and documentation accurately describes the bugs
Instructions (10%) The submission did not follow the instructions correctly to fork the repository and pull request made only when instructed by the teacher The student followed the general instructions but made minor mistakes, such as copying the repo locally rather than forking it Instructions were followed accurately and precisely


Additional Information

ACM BoK
Area & Unit(s)

Software Engineering / SE Software Verification Validation

ACM BoK
Topic(s)

Unit Testing, Test Coverage, Bug Reporting

Difficulty

Writing thorough unit tests will take intermediate knowledge of object oriented programming and discovering the existing bugs will take advanced debugging skills

Estimated Time
to Complete

The assignment should take from 1-3 hours of work and is recommended as an equivalent to a relatively small programming assignment.

Environment /
Materials

Need to have a working C++ development environment with Google Test and gcov installed

Author(s)

Kevin Buffardi

Source

Kevin Buffardi

License

This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License

CC license.png

Personal tools
Namespaces
Variants
Actions
Events
Learning Resources
HFOSS Projects
Evaluation
Navigation
Toolbox