SlideShare ist ein Scribd-Unternehmen logo
1 von 30
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.

Weitere ähnliche Inhalte

Was ist angesagt?

PHX - Session #2 Test Driven Development: Improving .NET Application Performa...
PHX - Session #2 Test Driven Development: Improving .NET Application Performa...PHX - Session #2 Test Driven Development: Improving .NET Application Performa...
PHX - Session #2 Test Driven Development: Improving .NET Application Performa...Steve Lange
 
Impression from Geecon 2014
Impression from Geecon 2014 Impression from Geecon 2014
Impression from Geecon 2014 Adamsus
 
PHX Session #3 - "It Works on My Machine!" Closing the Loop Between Developme...
PHX Session #3 - "It Works on My Machine!" Closing the Loop Between Developme...PHX Session #3 - "It Works on My Machine!" Closing the Loop Between Developme...
PHX Session #3 - "It Works on My Machine!" Closing the Loop Between Developme...Steve Lange
 
Continuous business goal validation
Continuous business goal validationContinuous business goal validation
Continuous business goal validationHylke Stapersma
 
Continuous delivery test strategies
Continuous delivery test strategiesContinuous delivery test strategies
Continuous delivery test strategiesHylke Stapersma
 
TLC2018 Shyam Sunder: Legoizing Testing
TLC2018 Shyam Sunder: Legoizing TestingTLC2018 Shyam Sunder: Legoizing Testing
TLC2018 Shyam Sunder: Legoizing TestingAnna Royzman
 
Agile Testing in Enterprise: Way to transform - SQA Days 2014
Agile Testing in Enterprise: Way to transform - SQA Days 2014Agile Testing in Enterprise: Way to transform - SQA Days 2014
Agile Testing in Enterprise: Way to transform - SQA Days 2014Andrey Rebrov
 
Performance Metrics for your Delivery Pipeline - Wolfgang Gottesheim
Performance Metrics for your Delivery Pipeline - Wolfgang GottesheimPerformance Metrics for your Delivery Pipeline - Wolfgang Gottesheim
Performance Metrics for your Delivery Pipeline - Wolfgang GottesheimJAXLondon2014
 
How testers add value to the organization appium conf
How testers add value to the organization  appium confHow testers add value to the organization  appium conf
How testers add value to the organization appium confCorina Pip
 
[XPday.vn] Legacy code workshop (at) [XP Day Vietnam 2015]
[XPday.vn] Legacy code workshop (at) [XP Day Vietnam 2015][XPday.vn] Legacy code workshop (at) [XP Day Vietnam 2015]
[XPday.vn] Legacy code workshop (at) [XP Day Vietnam 2015]Agile đây Vietnam
 
Testing: the more you do it, the more you'll like it
Testing: the more you do it, the more you'll like itTesting: the more you do it, the more you'll like it
Testing: the more you do it, the more you'll like itJeffrey McGuire
 
Become Software Tester or Developer
Become Software Tester or DeveloperBecome Software Tester or Developer
Become Software Tester or DeveloperKMS Technology
 
Improving the Quality of Incoming Code
Improving the Quality of Incoming CodeImproving the Quality of Incoming Code
Improving the Quality of Incoming CodeNaresh Jain
 
Test Driven Development by Sameer Arora
Test Driven Development by Sameer AroraTest Driven Development by Sameer Arora
Test Driven Development by Sameer AroraXebia IT Architects
 
Outside-in Testing in Vue with Cypress
Outside-in Testing in Vue with CypressOutside-in Testing in Vue with Cypress
Outside-in Testing in Vue with CypressJosh Justice
 
Yelp Tech Talks: Mobile Testing 1, 2, 3
Yelp Tech Talks: Mobile Testing 1, 2, 3Yelp Tech Talks: Mobile Testing 1, 2, 3
Yelp Tech Talks: Mobile Testing 1, 2, 3Yelp Engineering
 
Agile Testing Agile Ottawa April 2015
Agile Testing   Agile Ottawa April 2015Agile Testing   Agile Ottawa April 2015
Agile Testing Agile Ottawa April 2015Dag Rowe
 

Was ist angesagt? (20)

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

Ähnlich wie Unit testing for project managers

What if you could eliminate the hidden costs of development?
What if you could eliminate the hidden costs of development?What if you could eliminate the hidden costs of development?
What if you could eliminate the hidden costs of development?Rogue Wave Software
 
How to achieve security, reliability, and productivity in less time
How to achieve security, reliability, and productivity in less timeHow to achieve security, reliability, and productivity in less time
How to achieve security, reliability, and productivity in less timeRogue Wave Software
 
DEV322_Continuous Integration Best Practices for Software Development Teams
DEV322_Continuous Integration Best Practices for Software Development TeamsDEV322_Continuous Integration Best Practices for Software Development Teams
DEV322_Continuous Integration Best Practices for Software Development TeamsAmazon Web Services
 
Test driven development and react js application go hand in hand
Test driven development and react js application go hand in handTest driven development and react js application go hand in hand
Test driven development and react js application go hand in handKaty Slemon
 
D-CAST Real Life TestOps Environment
D-CAST Real Life TestOps EnvironmentD-CAST Real Life TestOps Environment
D-CAST Real Life TestOps EnvironmentAdam Sandman
 
Continuous Deployment
Continuous DeploymentContinuous Deployment
Continuous DeploymentBrian Henerey
 
DevOps 2017 Conf: evolving from automated to continuous
DevOps 2017 Conf: evolving from automated to continuousDevOps 2017 Conf: evolving from automated to continuous
DevOps 2017 Conf: evolving from automated to continuousArthur Hicken
 
DEV206_Life of a Code Change to a Tier 1 Service
DEV206_Life of a Code Change to a Tier 1 ServiceDEV206_Life of a Code Change to a Tier 1 Service
DEV206_Life of a Code Change to a Tier 1 ServiceAmazon Web Services
 
CWIN17 New-York / Drive continuous delivery with continous testing
CWIN17 New-York / Drive continuous delivery with continous testingCWIN17 New-York / Drive continuous delivery with continous testing
CWIN17 New-York / Drive continuous delivery with continous testingCapgemini
 
Jennifer Scandariato: Transform Your Team from QA to Test Engineering
Jennifer Scandariato: Transform Your Team from QA to Test EngineeringJennifer Scandariato: Transform Your Team from QA to Test Engineering
Jennifer Scandariato: Transform Your Team from QA to Test EngineeringAnna Royzman
 
Transformation from QA to Test Engineering
Transformation from QA to Test EngineeringTransformation from QA to Test Engineering
Transformation from QA to Test EngineeringJennifer L. Scandariato
 
Agile & DevOps - It's all about project success
Agile & DevOps - It's all about project successAgile & DevOps - It's all about project success
Agile & DevOps - It's all about project successAdam Stephensen
 
Automate testing with behat, selenium, phantom js and nightwatch.js (5)
Automate testing with behat, selenium, phantom js and nightwatch.js (5)Automate testing with behat, selenium, phantom js and nightwatch.js (5)
Automate testing with behat, selenium, phantom js and nightwatch.js (5)Faichi Solutions
 
Agile Development Ultimate Slides
Agile Development Ultimate SlidesAgile Development Ultimate Slides
Agile Development Ultimate Slidesgilashikwa
 
Continuous Testing - The Final Frontier
Continuous Testing - The Final FrontierContinuous Testing - The Final Frontier
Continuous Testing - The Final FrontierJaco Greyling
 

Ähnlich wie Unit testing for project managers (20)

What if you could eliminate the hidden costs of development?
What if you could eliminate the hidden costs of development?What if you could eliminate the hidden costs of development?
What if you could eliminate the hidden costs of development?
 
How to achieve security, reliability, and productivity in less time
How to achieve security, reliability, and productivity in less timeHow to achieve security, reliability, and productivity in less time
How to achieve security, reliability, and productivity in less time
 
Ongoing management of your PHP 7 application
Ongoing management of your PHP 7 applicationOngoing management of your PHP 7 application
Ongoing management of your PHP 7 application
 
DEV322_Continuous Integration Best Practices for Software Development Teams
DEV322_Continuous Integration Best Practices for Software Development TeamsDEV322_Continuous Integration Best Practices for Software Development Teams
DEV322_Continuous Integration Best Practices for Software Development Teams
 
Test driven development and react js application go hand in hand
Test driven development and react js application go hand in handTest driven development and react js application go hand in hand
Test driven development and react js application go hand in hand
 
D-CAST Real Life TestOps Environment
D-CAST Real Life TestOps EnvironmentD-CAST Real Life TestOps Environment
D-CAST Real Life TestOps Environment
 
Continuous Deployment
Continuous DeploymentContinuous Deployment
Continuous Deployment
 
Speed and security for your PHP application
Speed and security for your PHP applicationSpeed and security for your PHP application
Speed and security for your PHP application
 
DevOps 2017 Conf: evolving from automated to continuous
DevOps 2017 Conf: evolving from automated to continuousDevOps 2017 Conf: evolving from automated to continuous
DevOps 2017 Conf: evolving from automated to continuous
 
DEV206_Life of a Code Change to a Tier 1 Service
DEV206_Life of a Code Change to a Tier 1 ServiceDEV206_Life of a Code Change to a Tier 1 Service
DEV206_Life of a Code Change to a Tier 1 Service
 
CWIN17 New-York / Drive continuous delivery with continous testing
CWIN17 New-York / Drive continuous delivery with continous testingCWIN17 New-York / Drive continuous delivery with continous testing
CWIN17 New-York / Drive continuous delivery with continous testing
 
Jennifer Scandariato: Transform Your Team from QA to Test Engineering
Jennifer Scandariato: Transform Your Team from QA to Test EngineeringJennifer Scandariato: Transform Your Team from QA to Test Engineering
Jennifer Scandariato: Transform Your Team from QA to Test Engineering
 
Transformation from QA to Test Engineering
Transformation from QA to Test EngineeringTransformation from QA to Test Engineering
Transformation from QA to Test Engineering
 
Agile & DevOps - It's all about project success
Agile & DevOps - It's all about project successAgile & DevOps - It's all about project success
Agile & DevOps - It's all about project success
 
Automate testing with behat, selenium, phantom js and nightwatch.js (5)
Automate testing with behat, selenium, phantom js and nightwatch.js (5)Automate testing with behat, selenium, phantom js and nightwatch.js (5)
Automate testing with behat, selenium, phantom js and nightwatch.js (5)
 
DevOps on AWS
DevOps on AWSDevOps on AWS
DevOps on AWS
 
DevOps on AWS
DevOps on AWSDevOps on AWS
DevOps on AWS
 
Agile Development Ultimate Slides
Agile Development Ultimate SlidesAgile Development Ultimate Slides
Agile Development Ultimate Slides
 
Continuous Testing - The Final Frontier
Continuous Testing - The Final FrontierContinuous Testing - The Final Frontier
Continuous Testing - The Final Frontier
 
Automated tests
Automated testsAutomated tests
Automated tests
 

Mehr von Zend by Rogue Wave Software

Building and managing applications fast for IBM i
Building and managing applications fast for IBM iBuilding and managing applications fast for IBM i
Building and managing applications fast for IBM iZend by Rogue Wave Software
 
Speed up web APIs with Expressive and Swoole (PHP Day 2018)
Speed up web APIs with Expressive and Swoole (PHP Day 2018) Speed up web APIs with Expressive and Swoole (PHP Day 2018)
Speed up web APIs with Expressive and Swoole (PHP Day 2018) Zend by Rogue Wave Software
 
The Sodium crypto library of PHP 7.2 (PHP Day 2018)
The Sodium crypto library of PHP 7.2 (PHP Day 2018)The Sodium crypto library of PHP 7.2 (PHP Day 2018)
The Sodium crypto library of PHP 7.2 (PHP Day 2018)Zend by Rogue Wave Software
 
Develop web APIs in PHP using middleware with Expressive (Code Europe)
Develop web APIs in PHP using middleware with Expressive (Code Europe)Develop web APIs in PHP using middleware with Expressive (Code Europe)
Develop web APIs in PHP using middleware with Expressive (Code Europe)Zend by Rogue Wave Software
 
Fundamentals of performance tuning PHP on IBM i
Fundamentals of performance tuning PHP on IBM i  Fundamentals of performance tuning PHP on IBM i
Fundamentals of performance tuning PHP on IBM i Zend by Rogue Wave Software
 

Mehr von Zend by Rogue Wave Software (20)

Develop microservices in php
Develop microservices in phpDevelop microservices in php
Develop microservices in php
 
Building and managing applications fast for IBM i
Building and managing applications fast for IBM iBuilding and managing applications fast for IBM i
Building and managing applications fast for IBM i
 
Building web APIs in PHP with Zend Expressive
Building web APIs in PHP with Zend ExpressiveBuilding web APIs in PHP with Zend Expressive
Building web APIs in PHP with Zend Expressive
 
To PHP 7 and beyond
To PHP 7 and beyondTo PHP 7 and beyond
To PHP 7 and beyond
 
Speed up web APIs with Expressive and Swoole (PHP Day 2018)
Speed up web APIs with Expressive and Swoole (PHP Day 2018) Speed up web APIs with Expressive and Swoole (PHP Day 2018)
Speed up web APIs with Expressive and Swoole (PHP Day 2018)
 
The Sodium crypto library of PHP 7.2 (PHP Day 2018)
The Sodium crypto library of PHP 7.2 (PHP Day 2018)The Sodium crypto library of PHP 7.2 (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)
Develop web APIs in PHP using middleware with Expressive (Code Europe)Develop web APIs in PHP using middleware with Expressive (Code Europe)
Develop web APIs in PHP using middleware with Expressive (Code Europe)
 
Middleware web APIs in PHP 7.x
Middleware web APIs in PHP 7.xMiddleware web APIs in PHP 7.x
Middleware web APIs in PHP 7.x
 
Developing web APIs using middleware in PHP 7
Developing web APIs using middleware in PHP 7Developing web APIs using middleware in PHP 7
Developing web APIs using middleware in PHP 7
 
The Docker development template for PHP
The Docker development template for PHPThe Docker development template for PHP
The Docker development template for PHP
 
The most exciting features of PHP 7.1
The most exciting features of PHP 7.1The most exciting features of PHP 7.1
The most exciting features of PHP 7.1
 
The new features of PHP 7
The new features of PHP 7The new features of PHP 7
The new features of PHP 7
 
Deploying PHP apps on the cloud
Deploying PHP apps on the cloudDeploying PHP apps on the cloud
Deploying PHP apps on the cloud
 
Data is dead. Long live data!
Data is dead. Long live data! Data is dead. Long live data!
Data is dead. Long live data!
 
Optimizing performance
Optimizing performanceOptimizing performance
Optimizing performance
 
Resolving problems & high availability
Resolving problems & high availabilityResolving problems & high availability
Resolving problems & high availability
 
Developing apps faster
Developing apps fasterDeveloping apps faster
Developing apps faster
 
Keeping up with PHP
Keeping up with PHPKeeping up with PHP
Keeping up with PHP
 
Fundamentals of performance tuning PHP on IBM i
Fundamentals of performance tuning PHP on IBM i  Fundamentals of performance tuning PHP on IBM i
Fundamentals of performance tuning PHP on IBM i
 
Getting started with PHP on IBM i
Getting started with PHP on IBM iGetting started with PHP on IBM i
Getting started with PHP on IBM i
 

Kürzlich hochgeladen

Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Natan Silnitsky
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作qr0udbr0
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Velvetech LLC
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Mater
 
What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....kzayra69
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationBradBedford3
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfFerryKemperman
 
Best Web Development Agency- Idiosys USA.pdf
Best Web Development Agency- Idiosys USA.pdfBest Web Development Agency- Idiosys USA.pdf
Best Web Development Agency- Idiosys USA.pdfIdiosysTechnologies1
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtimeandrehoraa
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...OnePlan Solutions
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceBrainSell Technologies
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...OnePlan Solutions
 

Kürzlich hochgeladen (20)

2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)
 
What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion Application
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdf
 
Best Web Development Agency- Idiosys USA.pdf
Best Web Development Agency- Idiosys USA.pdfBest Web Development Agency- Idiosys USA.pdf
Best Web Development Agency- Idiosys USA.pdf
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtime
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. Salesforce
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
 

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.

Hinweis der Redaktion

  1. V 1.0.5
  2. 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
  3. Yes No
  4. Every time you pass go on this this loop, YOU pay the bank, it doesn’t pay you.
  5. 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.
  6. 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.
  7. All that is left, is for you to start testing…TODAY!