Increase testability with code seams
- 5. Why is Testing Hard?
1. Setup
2. Lot’s of paths
3. Global state
4. Lot’s of clutter
5. Environment
6. Uncontrollable
Variables
7. UI
8. Money
9. Dates
10.Mobile
11.Database
12.Integration
13.Wait Times
14.XPath
15.Finding
Elements
16.Timing
17.Failure cases
- 6. Automated checking is a tactic of testing, and can have considerable value...
…Checking through an API beneath the GUI level can be particularly useful.
In designing such low-level checks, programmers and testers can profitably work
together.
We are more doubtful of automated checking at the GUI level. GUIs are notoriously
fussy.
- 7. CASE #3: Automated checking.
We wanted to demonstrate full-on automated checking, while at the same time
staying with the FocusWriter example. FocusWriter does not provide an API for
testing, which required us to automate through the GUI, and so the
headaches began.
- 16. DarkFunction Editor Test
1. Open df editor
2. Find File -> Find New -> Find Animation set
3. Navigate to github -> dark function editor ->
Testing Resources -> StarWarsImages -> SWAII.sprites
4. Open
5. Add animation
6. Add animation (1)
7. Add animation (2)
8. Rename animation 1 -> animation a
9. add animation
10 . find animation 3 confirm exists.
- 19. DarkFunction Editor Test
1. Open df editor
2. Find File -> Find New -> Find Animation
set
3. Navigate to github -> dark function editor
->
Testing Resources -> StarWarsImages ->
SWAII.sprites
4. Open
5. Add animation
6. Add animation (1)
7. Add animation (2)
8. Rename animation 1 -> animation a
9. add animation
10 . find animation 3 confirm exists.
- 22. NON-Functional
Get inputs as needed (global state, file,
database…)
Result vary (dates, random, environment)
Store results (global, disk, database, transient)
- 23. public double calculate(double amount)
{
int step1 = (int) (amount * 2);
double step2 = step1 * 1.5;
return step2;
}
All results out
All inputs in
Deterministic
- 28. WHY FUNCTIONAL IS EASIER FOR TESTS
Unit Test
Production Code
Do
Verify
Functional Harness
- 35. Why is Testing Hard?
1. XPath
2. Finding
Elements
3. Global state
4. Dates
5. Failure cases
6. Wait Times
7. Mobile
8. Setup
9. Lot’s of paths
10.Environment
11.Uncontrollable
Variables
12.UI
13.Money
14.Dates
15.Database
16.Integration
17.Finding
Elements
18.Timing
Editor's Notes
- git checkout 8918da8
- Both
- Both