Skip to content
Skip to breadcrumbs
Skip to header menu
Skip to action menu
Skip to quick search
Quick Search
Browse
Pages
Blog
Labels
Attachments
Mail
Advanced
What’s New
Space Directory
Feed Builder
Keyboard Shortcuts
Confluence Gadgets
Log In
Sign Up
Dashboard
Ashcroft
Copy Page
You are not logged in. Any changes you make will be marked as
anonymous
. You may want to
Log In
if you already have an account. You can also
Sign Up
for a new account.
This page is being edited by
.
Paragraph
Paragraph
Heading 1
Heading 2
Heading 3
Heading 4
Heading 5
Heading 6
Preformatted
Quote
Bold
Italic
Underline
More colours
Strikethrough
Subscript
Superscript
Monospace
Clear Formatting
Bullet list
Numbered list
Outdent
Indent
Align left
Align center
Align right
Link
Table
Insert
Insert Content
Image
Link
Attachment
Symbol
Emoticon
Wiki Markup
Horizontal rule
tinymce.confluence.insert_menu.macro_desc
Info
JIRA Issue
Status
Gallery
Tasklist
Table of Contents
Other Macros
Page Layout
No Layout
Two column (simple)
Two column (simple, left sidebar)
Two column (simple, right sidebar)
Three column (simple)
Two column
Two column (left sidebar)
Two column (right sidebar)
Three column
Three column (left and right sidebars)
Undo
Redo
Find/Replace
Keyboard Shortcuts Help
<p>Aslak and I were brought on to a project with the task of refactoring a legacy codebase. A complex application with approximately 30 thousands lines of code, written over a 2 year timeframe by many programmers. The code worked as intended and was actually a success compared to all previous efforts to accomplish the same sort of functionality. The team is <em>somewhat</em> agile and uses CruiseControl for automated builds.</p> <h3>The Goals</h3> <p>We had some clear directives from the client:</p> <ol> <li>Disentangle the GUI portion of this codebase (AWT stuff) from the domain layer</li> <li>Rewrite the GUI as a remote client</li> <li>Expose the domain layer as a clean and reusable public API</li> </ol> <p>At first glance, the code didn't look too badly written and Clover was reporting over 60% coverage from approximately 1100 Junit tests. Hmm... Diving into the test suite usually seems like a good starting point to figure out where to start.</p> <h3>Problematic Unit Tests</h3> <p>To my dismay, there were some serious issues with the way that the unit tests were written. I should say <em>so-called</em> unit tests, cause there were some major problems to address:</p> <ul> <li>First of all, the test suite was taking about 10-15 minutes to execute.</li> <li>As a result, nobody in the team was running the suite on a regular basis except cruise control.</li> <li>Suite only passing in forked JVM mode, because of excessive use of statics requiring a pristine runtime. Executing the suit in-process reveals almost all clobber each other in non-deterministic ways.</li> <li>Unable to run suite in IntelliJ, because of the aformentioned issue with in-process execution, and because of hundreds of dependencies on test files (xml, db, properties, etc.) to be in the right place on the filesystem.</li> <li>About 20 singletons (oh cursed pattern!) and a lot of static utility classes</li> <li>Hundreds of mock, dummy, and faux subclasses. Tons of duplication and very confusing.</li> </ul> <p>The majority of those tests weren't actually unit tests at all. Sure, they all extended JUnit TestCase, but most of them did some sort of file I/O, many included calls to Thread.sleep(), and during their execution there would be about 20-30 AWT windows popping up and flashing stuff in my face. As a matter of fact, they were <em>system tests</em> masquerading as unit test.</p>
Please type the word appearing in the picture.
Attachments
Labels
Location
Watch this page
< Edit
Preview >
Loading…
Save
Cancel
Next hint
search
attachments
weblink
advanced