Unit Test With GoogleTest Activity

From Foss2Serve
(Difference between revisions)
Jump to: navigation, search
(Additional Information:)
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
{| border="1"
+
 
|-
+
{{Learning Activity Overview
|'''Title''' || 
+
|title=
Unit Test with GoogleTest Activity
+
Unit Test with Google Test Activity
|-   
+
|overview=
|'''Overview''' || 
+
Participants install the [[:Category:Google Test|Google Test]] library and run an existing C++ project to see individual test results and confirm successful installation.
Participants install the Google Test library and run an existing C++ project to see individual test results and confirm successful installation.
+
|prerequisites=
|-
+
|'''Prerequisite Knowledge''' ||
+
 
Have set up a development environment that will compile C++. Configurations differ slightly from one operating system to another, but should work on most.
 
Have set up a development environment that will compile C++. Configurations differ slightly from one operating system to another, but should work on most.
|-
+
|objectives=
|'''Learning Objectives''' ||
+
* Configure a unit testing framework and read and interpret unit test results.
Participant should be able to learn how to configure a unit testing framework and read and interpret unit test results.
+
|process skills=
|}
+
}}
  
=== Directions: ===
+
=== Directions ===
  
==== Students: ====
+
==== Students ====
  
* First, you will need to install Google Test on your machine. The code is provided on [https://github.com/google/googletest GitHub.com/google/googletest]
+
* First, you will need to install Google Test on your machine. The code is provided on https://github.com/google/googletest
 
* I suggest placing Google Test in a location where other source libraries are placed, such as <code>/usr/local/include</code>
 
* I suggest placing Google Test in a location where other source libraries are placed, such as <code>/usr/local/include</code>
 
* Next, go to a different directory (such as one you use to organize your files for this course, or a folder where you store your own code). Clone this [https://github.com/ChicoState/cpp-gtest cpp-gtest repository].
 
* Next, go to a different directory (such as one you use to organize your files for this course, or a folder where you store your own code). Clone this [https://github.com/ChicoState/cpp-gtest cpp-gtest repository].
Line 28: Line 26:
 
* Take a screenshot of this output and submit the image for this assignment
 
* Take a screenshot of this output and submit the image for this assignment
  
=== Deliverables: ===
+
=== Deliverables ===
  
 
A screen shot of the automated test results.
 
A screen shot of the automated test results.
  
=== Assessment: ===
 
  
Students should have a screen shot of GoogleTest results that show that a test has been run and passed in command line output.
+
== Notes for Instructors ==
  
=== Comments: ===
+
 
 +
=== Assessment ===
 +
 
 +
Students should have a screen shot of Google Test results that show that a test has been run and passed in command line output.
 +
 
 +
=== Comments ===
 +
N/A
  
 
=== Additional Information: ===
 
=== Additional Information: ===
{| border="1"
+
 
|-
+
{{Learning Activity Info
|'''ACM Knowledge Area/Knowledge Unit''' || 
+
|acm unit=
[https://www.acm.org/education/CS2013-final-report.pdf#page=175 Software Engineering / SE Software Verification Validation]
+
Software Engineering / SE Software Verification Validation
|-
+
|acm topic=
|'''ACM Topic''' || 
+
 
Unit Testing
 
Unit Testing
|-
+
|difficulty=
|'''Level of Difficulty''' || 
+
Configuring the development environment with the Google Test library takes intermediate expertise of operating system command-line navigation
Configuring the development environment with the GoogleTest library takes intermediate expertise of operating system command-line navigation
+
|time=
|-
+
|'''Estimated Time to Completion''' ||
+
 
Download and configuration may take 5 to 20 minutes, depending on the students' operating systems and existing development environment.
 
Download and configuration may take 5 to 20 minutes, depending on the students' operating systems and existing development environment.
|-
+
|environment=
|'''Materials/Environment''' ||
+
 
Need a development environment with support for Makefile and C++ compilation (g++ recommended)
 
Need a development environment with support for Makefile and C++ compilation (g++ recommended)
|-
+
|author=
|'''Author''' || 
+
 
Kevin Buffardi
 
Kevin Buffardi
|-
+
|source=
|'''Source''' ||
+
 
Kevin Buffardi
 
Kevin Buffardi
|-
+
|license=
|'''License''' ||
+
{{License CC BY SA}}
Licensed CC BY-SA 4.0
+
}}
|}
+
 
+
 
+
--------------------
+
This work is licensed under a
+
[http://creativecommons.org/licenses/by-sa/4.0/ Creative Commons Attribution-ShareAlike 4.0 International License]
+
 
+
[[File:CC_license.png]]
+
  
[[Category: Learning_Activity]]
+
[[Category:Learning Activity]]
[[Category: Quality_and_Testing]]
+
[[Category:Quality and Testing]]
 +
[[Category:Google Test]]
 +
[[Category:Good Draft]]

Latest revision as of 13:31, 8 September 2018


Title

Unit Test with Google Test Activity

Overview

Participants install the Google Test library and run an existing C++ project to see individual test results and confirm successful installation.

Prerequisites

Have set up a development environment that will compile C++. Configurations differ slightly from one operating system to another, but should work on most.

Learning
Objectives
After successfully completing this activity, the learner should be able to:
  • Configure a unit testing framework and read and interpret unit test results.
Process Skills
Practiced


Directions

Students

  • First, you will need to install Google Test on your machine. The code is provided on https://github.com/google/googletest
  • I suggest placing Google Test in a location where other source libraries are placed, such as /usr/local/include
  • Next, go to a different directory (such as one you use to organize your files for this course, or a folder where you store your own code). Clone this cpp-gtest repository.
  • Once cloned, edit Makefile find this line: GTEST_DIR = /usr/local/include/gtest and change it to the directory you placed Google Test. Provide the entire path to the directory in Google Test that has the following folders/files:
    internal
    gtest.h
    gtest-typed-test.h
    gtest-test-part.h
    (and more .h files...)
  • Once you've edited the file, save it and run the command Make
  • Next, run the command ./RandoTest
  • The output should show that one test has been run (and passed).
  • Take a screenshot of this output and submit the image for this assignment

Deliverables

A screen shot of the automated test results.


Notes for Instructors

Assessment

Students should have a screen shot of Google Test results that show that a test has been run and passed in command line output.

Comments

N/A

Additional Information:

ACM BoK
Area & Unit(s)

Software Engineering / SE Software Verification Validation

ACM BoK
Topic(s)

Unit Testing

Difficulty

Configuring the development environment with the Google Test library takes intermediate expertise of operating system command-line navigation

Estimated Time
to Complete

Download and configuration may take 5 to 20 minutes, depending on the students' operating systems and existing development environment.

Environment /
Materials

Need a development environment with support for Makefile and C++ compilation (g++ recommended)

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