Unit testing for project managers

113 views

Published on

This presentation gives you the evidence as to why unit testing works and a process for how to bring it your team as soon as possible. There's a reason why the growth of unit testing, and automated unit testing in particular, has exploded over the past few years. It not only improves your code, it's faster than releasing code without tests. You'll learn: What, exactly, is a unit test?; The 7 reasons why managers love unit testing; and how to change mindset and processes to start unit testing now.

Published in: Software
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
113
On SlideShare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
3
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • V 1.0.5
  • Ok, you understand why you need to write unit test by now. I’m sure however, that there are a few of you out there that aren’t clear on exactly what unit tests
  • Yes
    No
  • Every time you pass go on this this loop, YOU pay the bank, it doesn’t pay you.
  • As a manager, you see projects as more than just lines of code, you see them as ever shrinking bags of money. The longer it takes to complete the project, the smaller the money bag gets. We get it, your job is to get to the finish line with as much of the money as you can. That is exactly what unit tests help you do.
  • Look, we are well beyond arguing the value of unit tests. Their value has been proven over and over again. We’ve discussed the financial benefits of Unit Tests. But there are others.
  • All that is left, is for you to start testing…TODAY!
  • Unit testing for project managers

    1. 1. 1© 2017 Rogue Wave Software, Inc. All Rights Reserved. Unit testing for project managers Cal Evans
    2. 2. 2© 2017 Rogue Wave Software, Inc. All Rights Reserved. Presenter Cal Evans Technical Manager, Training and Certification Rogue Wave Software cal.evans@roguewave.com
    3. 3. 3© 2017 Rogue Wave Software, Inc. All Rights Reserved. Agenda 1. Exactly what is Unit Testing? 2. Why should my teams bother writing them? 3. Ok, I get it, but now when should my teams start writing unit test? 4. You’ve left out the most important part, how do my teams go about writing Unit Tests? 5. Q&A
    4. 4. 4© 2017 Rogue Wave Software, Inc. All Rights Reserved. Poll #1 How many developers do you have at your company?
    5. 5. 5© 2017 Rogue Wave Software, Inc. All Rights Reserved. What
    6. 6. 6© 2017 Rogue Wave Software, Inc. All Rights Reserved. Unit testing is a software developmentUnit testing is a software development process in which the smallest testable parts of an application, called units, are individually and independently scrutinized for proper operation. What
    7. 7. 7© 2017 Rogue Wave Software, Inc. All Rights Reserved. What public function testCreateMessage() { $account = new Account($this->db,1); $message = new Message($this->db,null,$account); $message->text ="This is a test message."; $message->save(); $this->assertEquals($message->id,1); $this->assertEquals($message->text ,"This is a test message."); $this->assertEquals($message->front_end_account_link_id,1); return; }
    8. 8. 8© 2017 Rogue Wave Software, Inc. All Rights Reserved. What
    9. 9. 9© 2017 Rogue Wave Software, Inc. All Rights Reserved. What The question you are faced with is not WHY, the question you are faced with is: “What will my projects look like when I adopt unit testing as a best practice?”
    10. 10. 10© 2017 Rogue Wave Software, Inc. All Rights Reserved. What Development Working unit tests Organized chaos The beginnings of understanding Chaos
    11. 11. 11© 2017 Rogue Wave Software, Inc. All Rights Reserved. What The Payoff Development Change request Change complete
    12. 12. 12© 2017 Rogue Wave Software, Inc. All Rights Reserved. What Mockery
    13. 13. 13© 2017 Rogue Wave Software, Inc. All Rights Reserved. Poll #2 Do you currently do unit testing at your company?
    14. 14. 14© 2017 Rogue Wave Software, Inc. All Rights Reserved. Why
    15. 15. 15© 2017 Rogue Wave Software, Inc. All Rights Reserved. Why Automated tests help you get things right the first time, costing less.
    16. 16. 16© 2017 Rogue Wave Software, Inc. All Rights Reserved. Why There’s never time to do it right, there’s always time to do it over.
    17. 17. 17© 2017 Rogue Wave Software, Inc. All Rights Reserved. Why GO $ $$$$ $$$ $$$$ $$ $
    18. 18. 18© 2017 Rogue Wave Software, Inc. All Rights Reserved. Why public function respond(ResponseInterface $response) { if (!headers_sent()) { header(sprintf( 'HTTP/%s %s %s', $response->getProtocolVersion(), $response->getStatusCode(), $response->getReasonPhrase() )); } if (!$this->isEmptyResponse($response)) { $body = $response->getBody(); if ($body->isSeekable()) { $body->rewind(); } $settings = $this->container->get('settings'); $chunkSize = $settings['responseChunkSize']; $contentLength = $response->getHeaderLine('Content-Length'); if (!$contentLength) { $contentLength = $body->getSize(); } if (isset($contentLength)) { $amountToRead = $contentLength; while ($amountToRead > 0 && !$body->eof()) { $data = $body->read(min($chunkSize, $amountToRead)); echo $data; $amountToRead -= strlen($data); if (connection_status() != CONNECTION_NORMAL) { break; } } } else { while (!$body->eof()) { echo $body->read($chunkSize); if (connection_status() != CONNECTION_NORMAL) { break; } } } } } =
    19. 19. 19© 2017 Rogue Wave Software, Inc. All Rights Reserved. Why If your current project management style does not allow for time to create unit tests, change your style.
    20. 20. 20© 2017 Rogue Wave Software, Inc. All Rights Reserved. Why 7 reasons why writing unit tests is important to managers (From Tim King) Unit tests prove that your code actually works You can improve the design without breaking it They demonstrate concrete progress Test-first forces you to plan before you code Test-first reduces the cost of bugs Unit tests make better designs It’s faster than writing code without tests
    21. 21. 21© 2017 Rogue Wave Software, Inc. All Rights Reserved. Why That’s a LOT of reasons
    22. 22. 22© 2017 Rogue Wave Software, Inc. All Rights Reserved. When
    23. 23. 23© 2017 Rogue Wave Software, Inc. All Rights Reserved. When “The best time to plant a tree was 20 years ago. The second best time is now.” – Chinese proverb
    24. 24. 24© 2017 Rogue Wave Software, Inc. All Rights Reserved. How
    25. 25. 25© 2017 Rogue Wave Software, Inc. All Rights Reserved. How • Train your developers • Pick a project to begin with • Think it through • Write your tests • Write your code It all starts with training.
    26. 26. 26© 2017 Rogue Wave Software, Inc. All Rights Reserved. How PHP Unit Testing JumpStart • What is test driven development? • Modularizing code • Assertions • Doubles and dummies • Mocking and stubs • Data providers • Code Katas
    27. 27. 27© 2017 Rogue Wave Software, Inc. All Rights Reserved. Start testing today! zend.com/unittest for more information
    28. 28. 28© 2017 Rogue Wave Software, Inc. All Rights Reserved. Q&A
    29. 29. 29© 2017 Rogue Wave Software, Inc. All Rights Reserved. Follow up Twelve Benefits of Writing Unit Tests First (Tim King) – sd.jtimothyking.com/2006/07/11/twelve-benefits-of-writing-unit-tests-first/ I Pity The Fool Who Doesn’t Write Unit Tests (Coding Horror) – blog.codinghorror.com/i-pity-the-fool-who-doesnt-write-unit-tests/ Top 12 Reasons to Write Unit Tests (O’Reilly on Java) – onjava.com/pub/a/onjava/2003/04/02/javaxpckbk.html 10 Best Automated Testing Frameworks for PHP (HONGKIAT) – hongkiat.com/blog/automated-php-test/
    30. 30. 30© 2017 Rogue Wave Software, Inc. All Rights Reserved.

    ×