-
Types of testing
- Black box testing
- Gray box testing
- White box testing
- Unit testing
- Integration testing
- System testing
- Acceptance testing
-
What is black box testing
- Testing of a system without understanding it's implementation
- Testing based on requirements
-
Black box testing techniques
- Robustness testing
- Ad hoc/exploratory testing
- Equivalence partitioning
- Boundary value analysis
-
Black box: Equivalence partitioning
Reduces number of test cases by selecting the right test cases for all possible scenarios
-
Black box: Boundary value analysis
- Choose test cases as boundaries of equivalence partitions
- Handles one-off errors
-
Black box: Robustness testing
Test values outside of domain
-
How are boundary testing and equivalence classes related
- Equivalence class are the valid sets of input data
- Boundary testing tests the boundaries of equivalence classes
-
Most common use for gray box testing
Web applications due to their distributed nature
-
Gray box testing
Testing of functionality, but also looking at how it is done to make sure that is correct also
-
Examples of gray box testing
- Application cleans up temporary files
- Network or database connections are closed
- Memory usage is steady (no leaks)
- Very that transitions are properly logged
- Data formats are correct
-
What is unit testing
Validating each individual unit of source code is working properly
-
Goal of unit testing
Show that individual units are correct
-
What is a "unit" in unit testing?
Smallest possible testable item
-
Types of programming that can be used with unit testing
- Procedural
- Object oriented
-
How can procedural programs be tested?
Test functions, procedures and subroutines
-
How can object oriented programs be tested?
Test methods (usually public)
-
Test fixture
- Class containing one or more test methods
- Used in xunit and gtest
-
Test method
Method that executes a specific test
-
Test runner (xunit)
Application that finds and executes test methods
-
Assertion
Boolean expressions that describe what must be true when an action executes
-
Common GTest macros
- RUN_ALL_TEST()
- TEST(Suite, Test)
- TEST_F(Suit, Test) <- If an object is used
Various assertions
-
GTest assertions
- ASSERT_TRUE(expected, actual)
- ASSERT_EQ(expected, actual)
- ASSERT_LT(expected, actual) <- Less than
- ASSERT_THROW(method, exception)
- ASSERT_DOUBLE_EQ(expected, actual)
- Replace assert for EXPECT if continued testing is desired
-
How is TEST different from TEST_F in GTest?
- TEST is run independent of other tests
- TEST_F uses a common data object
-
(GTest) What is the macro to initiate testing? Where is it called?
- RUN_ALL_TESTS() Include gtest library
- Call macro in test main
-
GTest main file declaration (only show one line)
int main (int argc, char **argv) {
|
|