01.02.2013 Views

Software Development Cross Solution - Index of - Free

Software Development Cross Solution - Index of - Free

Software Development Cross Solution - Index of - Free

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Q: So how <strong>of</strong>ten should we run our entire test<br />

suite?<br />

A: This is really up to you and your team. If you’re<br />

happy with running your full test suite once a day, and<br />

know that any regression bugs will only be caught<br />

once a day, then that’s fine. However, we’d still<br />

recommend you have a set <strong>of</strong> tests that can be run<br />

much more frequently.<br />

Hmm, won’t testing everything every time make<br />

testing take a long time? Isn’t there a way <strong>of</strong> tuning<br />

things so that developers can regression-test everything<br />

when they need to, and just fit testing in manually<br />

Tailor your test suites to suit the occasion<br />

testing and continuous integration<br />

It’s unfortunately true that large unit test suites become ungainly and,<br />

therefore, tend to get used less. One technique is to break out fast and<br />

slow tests so that a developer can run all the fast tests <strong>of</strong>ten while they are<br />

changing and adding code, but only run the full suite when they think they<br />

need to.<br />

What tests fall into the fast or slow categories is really up to your particular<br />

project, and which category specific tests fall into can change depending on<br />

the development work that you are doing. For example, if you have barelyever-changes<br />

code that takes a long time to test, then that would be a good<br />

candidate for the slow test suite. However if you were working on code that<br />

might well impact the barely-ever-changes code, then you might consider<br />

moving its tests into the fast test suite while you are working those changes.<br />

Let’s try it out with a popular free testing framework for Java, called JUnit.<br />

To download the JUnit framework,<br />

go to http://www.junit.org<br />

Download at WoweBook.Com<br />

You can also speed<br />

up slow tests using<br />

mocks; see Chapter 8<br />

for more on those.<br />

Keep the time it takes to<br />

run your tests as short as<br />

possible. The longer a test<br />

suite takes to run, the less<br />

<strong>of</strong>ten it is likely to be run!<br />

you are here 4 249

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!