SlideShare a Scribd company logo
1© 2017 Rogue Wave Software, Inc. All Rights Reserved.
Unit testing for
project managers
Cal Evans
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© 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© 2017 Rogue Wave Software, Inc. All Rights Reserved.
Poll #1
How many developers do you have at your
company?
5© 2017 Rogue Wave Software, Inc. All Rights Reserved.
What
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© 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© 2017 Rogue Wave Software, Inc. All Rights Reserved.
What
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© 2017 Rogue Wave Software, Inc. All Rights Reserved.
What
Development
Working unit
tests
Organized
chaos
The beginnings
of
understanding
Chaos
11© 2017 Rogue Wave Software, Inc. All Rights Reserved.
What
The Payoff
Development
Change
request
Change
complete
12© 2017 Rogue Wave Software, Inc. All Rights Reserved.
What
Mockery
13© 2017 Rogue Wave Software, Inc. All Rights Reserved.
Poll #2
Do you currently do unit testing at your company?
14© 2017 Rogue Wave Software, Inc. All Rights Reserved.
Why
15© 2017 Rogue Wave Software, Inc. All Rights Reserved.
Why
Automated tests help you
get things right the first time,
costing less.
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© 2017 Rogue Wave Software, Inc. All Rights Reserved.
Why
GO $
$$$$
$$$
$$$$
$$
$
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© 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© 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© 2017 Rogue Wave Software, Inc. All Rights Reserved.
Why
That’s a LOT
of reasons
22© 2017 Rogue Wave Software, Inc. All Rights Reserved.
When
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© 2017 Rogue Wave Software, Inc. All Rights Reserved.
How
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© 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© 2017 Rogue Wave Software, Inc. All Rights Reserved.
Start
testing
today!
zend.com/unittest
for more
information
28© 2017 Rogue Wave Software, Inc. All Rights Reserved.
Q&A
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© 2017 Rogue Wave Software, Inc. All Rights Reserved.

More Related Content

PDF
Test Driven Development
PDF
Test Driven Development (TDD) & Continuous Integration (CI)
PPT
Test-Driven Development
PDF
Agile and test driven development
PPTX
Continuous testing the new must have skill of tomorrow's tech leaders
KEY
Testing and DevOps Culture: Lessons Learned
PPT
Trends in Agile Testing by Lisa Crispin
PDF
Behavior Driven Development—A Guide to Agile Practices by Josh Eastman
Test Driven Development
Test Driven Development (TDD) & Continuous Integration (CI)
Test-Driven Development
Agile and test driven development
Continuous testing the new must have skill of tomorrow's tech leaders
Testing and DevOps Culture: Lessons Learned
Trends in Agile Testing by Lisa Crispin
Behavior Driven Development—A Guide to Agile Practices by Josh Eastman

What's hot (20)

PPTX
PHX - Session #2 Test Driven Development: Improving .NET Application Performa...
PDF
Impression from Geecon 2014
PPTX
PHX Session #3 - "It Works on My Machine!" Closing the Loop Between Developme...
PPTX
Continuous business goal validation
PPTX
Continuous delivery test strategies
ODP
Agileee 2012
PDF
TLC2018 Shyam Sunder: Legoizing Testing
PPTX
Agile Testing in Enterprise: Way to transform - SQA Days 2014
PDF
Performance Metrics for your Delivery Pipeline - Wolfgang Gottesheim
PDF
How testers add value to the organization appium conf
PDF
[XPday.vn] Legacy code workshop (at) [XP Day Vietnam 2015]
PDF
Testing: the more you do it, the more you'll like it
PDF
Become Software Tester or Developer
PDF
Tester vs Developer
PPT
Test Driven Development
PDF
Improving the Quality of Incoming Code
PPS
Test Driven Development by Sameer Arora
PPTX
Outside-in Testing in Vue with Cypress
PPTX
Yelp Tech Talks: Mobile Testing 1, 2, 3
PPTX
Agile Testing Agile Ottawa April 2015
PHX - Session #2 Test Driven Development: Improving .NET Application Performa...
Impression from Geecon 2014
PHX Session #3 - "It Works on My Machine!" Closing the Loop Between Developme...
Continuous business goal validation
Continuous delivery test strategies
Agileee 2012
TLC2018 Shyam Sunder: Legoizing Testing
Agile Testing in Enterprise: Way to transform - SQA Days 2014
Performance Metrics for your Delivery Pipeline - Wolfgang Gottesheim
How testers add value to the organization appium conf
[XPday.vn] Legacy code workshop (at) [XP Day Vietnam 2015]
Testing: the more you do it, the more you'll like it
Become Software Tester or Developer
Tester vs Developer
Test Driven Development
Improving the Quality of Incoming Code
Test Driven Development by Sameer Arora
Outside-in Testing in Vue with Cypress
Yelp Tech Talks: Mobile Testing 1, 2, 3
Agile Testing Agile Ottawa April 2015
Ad

Similar to Unit testing for project managers (20)

PPTX
What if you could eliminate the hidden costs of development?
PPTX
How to achieve security, reliability, and productivity in less time
PPTX
Ongoing management of your PHP 7 application
PDF
Test driven development and react js application go hand in hand
PPTX
D-CAST Real Life TestOps Environment
PPT
Continuous Deployment
PPTX
Speed and security for your PHP application
PDF
DevOps 2017 Conf: evolving from automated to continuous
PDF
CWIN17 New-York / Drive continuous delivery with continous testing
PDF
Jennifer Scandariato: Transform Your Team from QA to Test Engineering
PPTX
Transformation from QA to Test Engineering
PPTX
Agile & DevOps - It's all about project success
PPTX
Automate testing with behat, selenium, phantom js and nightwatch.js (5)
PPT
Agile Development Ultimate Slides
PPTX
Continuous Testing - The Final Frontier
PPTX
Automated tests
PDF
DOES14: Scott Prugh, CSG - DevOps and Lean in Legacy Environments
PDF
Most Advanced Software Testing Solution Providers of 2022.pdf
PPT
Quality Software Development
PPT
How to run an Enterprise PHP Shop
What if you could eliminate the hidden costs of development?
How to achieve security, reliability, and productivity in less time
Ongoing management of your PHP 7 application
Test driven development and react js application go hand in hand
D-CAST Real Life TestOps Environment
Continuous Deployment
Speed and security for your PHP application
DevOps 2017 Conf: evolving from automated to continuous
CWIN17 New-York / Drive continuous delivery with continous testing
Jennifer Scandariato: Transform Your Team from QA to Test Engineering
Transformation from QA to Test Engineering
Agile & DevOps - It's all about project success
Automate testing with behat, selenium, phantom js and nightwatch.js (5)
Agile Development Ultimate Slides
Continuous Testing - The Final Frontier
Automated tests
DOES14: Scott Prugh, CSG - DevOps and Lean in Legacy Environments
Most Advanced Software Testing Solution Providers of 2022.pdf
Quality Software Development
How to run an Enterprise PHP Shop
Ad

More from Zend by Rogue Wave Software (20)

PDF
Develop microservices in php
PPTX
Building and managing applications fast for IBM i
PDF
Building web APIs in PHP with Zend Expressive
PPTX
To PHP 7 and beyond
PDF
Speed up web APIs with Expressive and Swoole (PHP Day 2018)
PDF
The Sodium crypto library of PHP 7.2 (PHP Day 2018)
PDF
Develop web APIs in PHP using middleware with Expressive (Code Europe)
PDF
Middleware web APIs in PHP 7.x
PDF
Developing web APIs using middleware in PHP 7
PDF
The Docker development template for PHP
PDF
The most exciting features of PHP 7.1
PDF
The new features of PHP 7
PPTX
Deploying PHP apps on the cloud
PPTX
Data is dead. Long live data!
PPTX
Optimizing performance
PPTX
Resolving problems & high availability
PPTX
Developing apps faster
PPTX
Keeping up with PHP
PPTX
Fundamentals of performance tuning PHP on IBM i
PPTX
Getting started with PHP on IBM i
Develop microservices in php
Building and managing applications fast for IBM i
Building web APIs in PHP with Zend Expressive
To PHP 7 and beyond
Speed up web APIs with Expressive and Swoole (PHP Day 2018)
The Sodium crypto library of PHP 7.2 (PHP Day 2018)
Develop web APIs in PHP using middleware with Expressive (Code Europe)
Middleware web APIs in PHP 7.x
Developing web APIs using middleware in PHP 7
The Docker development template for PHP
The most exciting features of PHP 7.1
The new features of PHP 7
Deploying PHP apps on the cloud
Data is dead. Long live data!
Optimizing performance
Resolving problems & high availability
Developing apps faster
Keeping up with PHP
Fundamentals of performance tuning PHP on IBM i
Getting started with PHP on IBM i

Recently uploaded (20)

PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PDF
AI in Product Development-omnex systems
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PPTX
CHAPTER 2 - PM Management and IT Context
PDF
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
PDF
PTS Company Brochure 2025 (1).pdf.......
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PPTX
history of c programming in notes for students .pptx
PPTX
ISO 45001 Occupational Health and Safety Management System
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PPTX
Operating system designcfffgfgggggggvggggggggg
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
2025 Textile ERP Trends: SAP, Odoo & Oracle
AI in Product Development-omnex systems
Wondershare Filmora 15 Crack With Activation Key [2025
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
How to Choose the Right IT Partner for Your Business in Malaysia
CHAPTER 2 - PM Management and IT Context
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
PTS Company Brochure 2025 (1).pdf.......
Design an Analysis of Algorithms I-SECS-1021-03
Upgrade and Innovation Strategies for SAP ERP Customers
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
Navsoft: AI-Powered Business Solutions & Custom Software Development
history of c programming in notes for students .pptx
ISO 45001 Occupational Health and Safety Management System
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
Operating system designcfffgfgggggggvggggggggg
Which alternative to Crystal Reports is best for small or large businesses.pdf
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)

Unit testing for project managers

  • 1. 1© 2017 Rogue Wave Software, Inc. All Rights Reserved. Unit testing for project managers Cal Evans
  • 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© 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© 2017 Rogue Wave Software, Inc. All Rights Reserved. Poll #1 How many developers do you have at your company?
  • 5. 5© 2017 Rogue Wave Software, Inc. All Rights Reserved. What
  • 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© 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© 2017 Rogue Wave Software, Inc. All Rights Reserved. What
  • 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© 2017 Rogue Wave Software, Inc. All Rights Reserved. What Development Working unit tests Organized chaos The beginnings of understanding Chaos
  • 11. 11© 2017 Rogue Wave Software, Inc. All Rights Reserved. What The Payoff Development Change request Change complete
  • 12. 12© 2017 Rogue Wave Software, Inc. All Rights Reserved. What Mockery
  • 13. 13© 2017 Rogue Wave Software, Inc. All Rights Reserved. Poll #2 Do you currently do unit testing at your company?
  • 14. 14© 2017 Rogue Wave Software, Inc. All Rights Reserved. Why
  • 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© 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© 2017 Rogue Wave Software, Inc. All Rights Reserved. Why GO $ $$$$ $$$ $$$$ $$ $
  • 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© 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© 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© 2017 Rogue Wave Software, Inc. All Rights Reserved. Why That’s a LOT of reasons
  • 22. 22© 2017 Rogue Wave Software, Inc. All Rights Reserved. When
  • 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© 2017 Rogue Wave Software, Inc. All Rights Reserved. How
  • 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© 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© 2017 Rogue Wave Software, Inc. All Rights Reserved. Start testing today! zend.com/unittest for more information
  • 28. 28© 2017 Rogue Wave Software, Inc. All Rights Reserved. Q&A
  • 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© 2017 Rogue Wave Software, Inc. All Rights Reserved.

Editor's Notes

  • #2: V 1.0.5
  • #6: 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
  • #14: Yes No
  • #18: Every time you pass go on this this loop, YOU pay the bank, it doesn’t pay you.
  • #19: 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.
  • #20: 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.
  • #28: All that is left, is for you to start testing
TODAY!