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.

Use a coverage report to see what’s covered<br />

Most coverage tools—especially ones like CruiseControl that integrate<br />

with other CI and version control tools—can generate a report telling<br />

you how much <strong>of</strong> your code is covered.<br />

Here’s a report for testing the ComplexCode class on the last page, and<br />

providing a valid username and password:<br />

Each class is listed individually<br />

(broken up by package) One measure <strong>of</strong> testing<br />

coverage is line coverage-what<br />

percentage <strong>of</strong> the total lines<br />

<strong>of</strong> code are we executing<br />

through our tests?<br />

So the above test manages to test 62% <strong>of</strong> the User class, 71% <strong>of</strong> the<br />

ComplexCode class, and 75% <strong>of</strong> UserCredentials. Things get a lot<br />

better if you add in all the failure cases described on page 264.<br />

Download at WoweBook.Com<br />

testing and continuous integration<br />

Code complexity basically tells us<br />

how many different paths there<br />

are through a given class’s code.<br />

If there are lots <strong>of</strong> conditionals<br />

(more complicated code), this<br />

number will be high.<br />

Another measure is<br />

branch coveragewhat<br />

percentage <strong>of</strong><br />

the alternate flows<br />

(ifs, elses, etc.) are<br />

we executing?<br />

Add in the failure cases and we’re<br />

in much better shape with the<br />

ComplexCode class. Still need work on<br />

the User class though...<br />

you are here 4 265

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

Saved successfully!

Ooh no, something went wrong!