Unit Testing Flashcards
Software Testing
Manual
Automated
Manual
Done by humans
Creativity
Subjectivity
Automated
Done by computer automation Speed / Efficiency Lower cost per execution Repeatability / Dependability Accuracy
Exploratory Testing
explores the functionality of the system looking for defects, missing features, usability, or other opportunities for improvement. Almost always manual.
Regression Testing
validates that existing functionality continues to operate as expected, as new functionality is added and defects are resolved. Usually automated.
Acceptance Testing
is performed from the perspective of a user of a system in order to verify the requirements have been satisfied
Integration Testing
is a broad category of tests that validate integration between units of code or code and outside dependencies such as a database, network resource, or file
Functional Testing
validates that the functional design has been satisfied
Unit Testing
is low level testing performed by the programmer to validate that individual units of code function as expected by the programmer
Some Other Types of Testing
Performance Scalability Usability Accessibility Portability Smoke / Sanity Alpha Beta Stress Security
Unit Tests
Rules
Rules: No external dependencies On logical assertion per test Test code should be the same quality as product code Test early, test often Don’t save them for the end
JUnit
JUnit is a Java Framework for writing and running Unit Tests.
Package: org.junit
The life cycle (order of operation) of JUnit tests are controlled
by annotations on public methods in the class.
@Before
@Test
@After
- runs before each test, to do setup
- runs as the test
- runs after each test to cleanup
@Before
public void setup() { }
@Test
public void test_something() { }
@After
public void cleanup() { }