130 likes | 251 Views
Using Fit on an Agile J2EE Project John Tyler Houston Java Users Group January 30, 2008. Contents. Intro & background Excel vs. HTML vs. FitNesse Performance and maintenance Test data Users writing tests? Things that would've made our lives a lot easier Q&A. Intro & Background.
E N D
Using Fit on an Agile J2EE ProjectJohn TylerHouston Java Users GroupJanuary 30, 2008
Contents • Intro & background • Excel vs. HTML vs. FitNesse • Performance and maintenance • Test data • Users writing tests? • Things that would've made our lives a lot easier • Q&A
Intro & Background • Rewrite of public content-based website • 6mm page views per day • 500k+ registered users • ATG Dynamo → Spring MVC + Hibernate • Heavy emphasis on automated testing (JUnit, Fit, Selenium) • Maven + Continuum
Why Fit? • Fit: Framework for Integrated Test • Encourage communication and transparency • ”Executable requirements” • Keep unit tests pure and fast • Fit: Ward Cunningham, Jim Shore • FitNesse: Ward Cunningham • FitLibrary: Rick Mugridge
Excel / HTML / FitNesse ? • Product Managers (PMs) to maintain tests • Subversion • Maven + Continuum • Easily accessible by PMs and developers • Easy to edit & run
Why We Chose Excel • PMs didn't like wiki-style of FitNesse • Thought Excel formulas & fill-down would be helpful • Everybody was comfortable with Excel • Easily versioned and organized files • Can edit directly in Eclipse
Fit Refresher • Test defined in Excel file • reference fully-qualified name of fixture • must be formatted correctly • Fixture defined in Java • extend one of many provided fixtures in Fit and FitLibrary (e.g. ColumnFixture, DoFixture) • translate test data/sequence into calls on underlying ”system under test” • Output in color-coded HTML + summary
Challenges with Excel • Excel Dates != Java Dates • Keeping up with borders is annoying • No support for multiple sheets • Limited support for running individual files • Excel is a heavyweight editor
Performance & Maintenance • Test parsing was slow, and Maven made it worse • reportIndex.html was helpful, especially with continuous integration • Fixtures were refactoring-safe, but tests would break • Entire suite of 90+ test files would take ~10 minutes to run
Test Data • Full-stack integration tests would hit dev database • Tests must clean up after themselves • Define setup data inside the test • Try not to depend on existing test records
Users Writing Tests? • Typical scenario: • Developer creates fixture and basic test • PM looks at test to see if it makes sense • Developer maintains test, adding scenarios as they think of new cases • Occasionally PM would add new test cases • A few times PM would define new test from scratch
I'd Give My Right Arm For... • JUnit-style IDE integration • Faster test parsing • Spreadsheet runner that supported multple worksheets • Console / log output • More flexible formatting
Q & A • ???