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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Use your framework to run your tests<br />

Invoke the JUnit test runner, org.junit.runner.JUnitCore. The<br />

only information you need to give the runner is which test class to run:<br />

headfirst.sd.chapter7.TestRemoteReader. The framework<br />

handles running each test in that class::<br />

Don’t forget to put junit.jar<br />

in your classpath.<br />

JUnit will print a<br />

dot for each test it<br />

ran. Since this class<br />

has only one test,<br />

you get a single dot.<br />

“OK” is JUnit’s<br />

understated way <strong>of</strong><br />

File Edit Window Help<br />

testing and continuous integration<br />

saying all the tests ran. And here’s what BeatBox Pro<br />

With a framework in place, you can easily add the other tests from page 246.<br />

Just add more test methods and annotate them with @Test. You can then<br />

run your test classes and watch the results.<br />

Don’t forget to start the<br />

MusicServer and a copy <strong>of</strong><br />

the BeatBox Pro. JUnit won’t<br />

take care <strong>of</strong> that for you,<br />

unless you add code for that<br />

into setUp().<br />

hfsd> java -cp junit.jar;. org.junit.runner.JUnitCore<br />

headfirst.sd.chapter7.TestRemoteReader<br />

JUnit version 4.3.1<br />

.<br />

Time: 0.321<br />

OK (1 test)<br />

hfsd><br />

Download at WoweBook.Com<br />

looks like after the test has run.<br />

Checkmarks are where they’re<br />

supposed to be and the test<br />

message is in the log.<br />

you are here 4 251

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

Saved successfully!

Ooh no, something went wrong!