Application-Fixture-Test: Building A Robust UI-Testing Architecture
Application-Fixture-Test: Building A Robust UI-Testing Architecture
Phil Quitslund
Dan Rubel
{phil_quitslund, dan_rubel}@instantiations.com
© 2008 Phil Quitslund and Dan Rubel; made available under the EPL v1.0
Phil Quitslund
– Senior Architect for Instantiations
– Eclipse Research Community Member
• Multi-View Project (OGI/PSU)
Dan Rubel
– Chief Technology Officer for Instantiations
– Author “Eclipse: Building Commercial Quality
Plug-ins“
– Developer and architect of VA Assist Enterprise,
CodePro and over a dozen other commercial
software products
1
Instantiations
2
UI Testing in the Wild
Root Causes
3
Proposed Solution
An architecture that partitions UI testing into two
activities.
Application/Fixture/Test
Literate Fluent
Application
Tests Fixture
Test Helper UI
Tester
Test Helper
Developer
BA
… … API
Test Helper
4
Example: Creating a Project (Free)
@Test
public void verifyProjectCreation() {
click(menu("File/New/Other..."));
waitFor(shellShowing("New"));
click(tree("General/Project"));
click(button("Next"));
enter("MyProject");
click(button("Finish"));
waitFor(shellDisposed("New Project"));
assertThat(projectExists("MyProject"));
}
@Test
public void verifyProjectCreation() {
createProject(“MyProject”);
}
VerifyProjectCreation.java
10
5
Payoff: Fixture Reuse
@Test WorkbenchHelper.java
public void verifyFileCreation() {
createProject(“MyProject”);
createFile(“MyProject/myFile.txt”);
}
VerifyFileCreation.java
11
The Rub:
Test infrastructure should not leak!
12
6
Payoff: Test Simplicity
@Test
public void verifyFileCreation() {
createProject(“MyProject”);
createFile(“MyProject/myFile.txt”);
}
VerifyFileCreation.java
14
7
Tests vs. Fixtures
Tests are
literate, declarative, descriptive (DAMP)
A well designed Domain Specific Language will appear as
Descriptive And Meaningful Phrases.
http://blog.jayfields.com/2006/05/dry-code-damp-dsls.html
Fixtures are
intention-revealing, robust, DRY
Don’t Repeat Yourself (DRY, also known as
Once and Only Once or Single Point of Truth (SPOT))
http://en.wikipedia.org/wiki/Don't_repeat_yourself
15
Requires an investment in
change.
http://en.wikipedia.org/wiki/Image:Greatwall_large.jpg
16
8
Process Patterns
1. Fixture as Deliverable
2. Lockstep Delivery
3. Fixture Failure Escalation
17
Fixture as Deliverable
18
9
Lock-step Delivery
19
20
10
Key Points
Fixtures reify a model of the application under test
Fixtures are the only way for testers to access the application
11