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.

test, red, code, green<br />

A day in the life <strong>of</strong> a<br />

test-driven developer...<br />

Once you have your tests passing, you know you built what you<br />

set out to. You’re done. Check the code in, knowing that your<br />

version control tool will ping your CI tool, which will diligently<br />

check out your new code, build it, and run your tests. All night.<br />

All the next day. Even when Bob checks in some code that<br />

breaks yours...*<br />

Then the automated mail starts....<br />

5<br />

312 Chapter 8<br />

Write code to get your test to pass, refactor,<br />

add another test, and get it to pass. Repeat<br />

until you run out <strong>of</strong> tests to add.<br />

public void<br />

testGetOrderHistory()<br />

{ public void<br />

testGetOrderHistory2()<br />

public // Test void happy case<br />

testGetOrderHistory3()<br />

{<br />

}<br />

{ // Test null username<br />

// } Test ““ username<br />

}<br />

All your tests should be passing<br />

(and your CI tool should make<br />

sure they stay passing).<br />

Real implementation<br />

code<br />

1<br />

public void<br />

testGetOrderHistory()<br />

public { void<br />

testGetOrderHistory2()<br />

public // Test void happy case<br />

{ testGetOrderHistory3()<br />

}<br />

// { Test null username<br />

} // Test ““ username<br />

}<br />

Download at WoweBook.Com<br />

Start with the task you’re<br />

going to work on.<br />

Once your code is passing, it’s time<br />

to check it into your repository<br />

and move onto the next task.<br />

* but in fact, with TDD, Bob will know instantly<br />

because the tests will fail and he will know exactly<br />

what code he broke.<br />

*

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

Saved successfully!

Ooh no, something went wrong!