Chapter 6 - Testing Flashcards
Name types of testing
Verification: have we built the software right? Validation: have we built the right software?
What kind of testing levels are there?
Unit tests: testing of classes or components (whitebox tests), Integration tests: testing the interaction of components, System test: end-to-end and use-case testing, functional tests: along use cases (black box test)
what kind of “test procedures” are there?
regression testing (menge an unit tests durchführen um zu sehen ob system funktioniert) / production testing (fkt. software im produktiven umfeld?) / performance testing / acceptance testing
Testing in practice?
testing is not taken seriously, testing of code that has been written days/weeks/months ago is difficult / manual testing is expensive
How can testing be improved?
write production code and test code together, run test every day, practice test-driven-development (test is written prior to implementing a class)
What is JUnit?
environment for writing test cases
What are the fixture keywords in JUnit?
@Before and @After are called before/after each test, @BeforeClass and @AfterClass are called one for each test class (e.g. initiate components)
How should the Code Layout for Testing look like?
either put test code in separate packages (problem: no access to package private variables and methods) or put test code in same package (problem: no clear separation)
How can Testability be improved?
class interface must support testing, isolate classes which are to be tested, write small and focused methods, avoid global mutable states, avoid deep inheritance, information hiding and encapusulation (spagat zwischen hiding und testing: unit tests möchten vieles internes wissen)
What are Mocks?
mocks are objects pre-programmed with expectations which form a specification of the calls they are expected to receive, verify correct method calls (number and order of calls)
What is a Stub?
simulates and verifies a state
How can user interfaces be tested?
functional tests - test cases are based on use cases
What are Automated Tests and their impacts?
short-term: code quality, confidence in code and productivity (less debugging) / long-term: system is viable and its possible to do radical changes / refactorings