SlideShare a Scribd company logo
SmokeTests
The what, why and how
Who am I?
Sebastian Thoss
Chapter Lead Backend
Founder & MD
01 02 03 04 05
Agenda
Types of Tests
SmokeTests

What and Why
How do
SmokeTest
work
Recommended
Server
Architecture
SmokeTests 

as a Service
Types Of Tests
Test Pyramid
Am
ountofTests
Perform
anceofTests
Few
Many
Slow
Fast
Test Pyramid
UNIT TESTS
Class 3
Class 2
Unit Tests
Class 1
Class 4
Mock
Mock
Test Pyramid
INTEGRATION TESTS
UNIT TESTS
Class 4Class 3
Integration Tests
Class 1 Class 2
Mock Mock
Test Pyramid
ACCEPTANCE TESTS
INTEGRATION TESTS
UNIT TESTS
Acceptance Tests
Class 1 Class 2
Class 3 Class 4
Test Pyramid
ACCEPTANCE TESTS
INTEGRATION TESTS
UNIT TESTS
?
SmokeTests
What & Why
What are SmokeTests?
By Brandonrush: https://commons.wikimedia.org/wiki/File:Smoke_Testing,_726_Emma_Ave,_Springdale,_AR.jpg
What are SmokeTests?
In computer programming and
software testing, smoke testing
is preliminary testing to reveal
simple failures severe enough to
reject a prospective software
release.



Source: https://en.wikipedia.org/wiki/Smoke_testing
SmokeTests
What to test
What are SmokeTests?
1. … be simple
2. … be fast
3. … test URLs and optional parameters too
4. … cover at least all URLs in google index
5. … be extended by every new URL
6. … never forget a URL
7. … use a (manual) maintained list of URLs
SmokeTests should…
What are SmokeTests?
1. Status code
2. Time to first byte
3. If body is provided
4. Correct server
What SmokeTests validate?
What are SmokeTests?
SmokeTest

Client
HTTP 1.1/200 OK

<html>

<head>

<title>Foo</title>

<body>

<div id="bar"><span>foobar</span></div>

</body>

</html>
SmokeTests are NOT Acceptance Tests!
SmokeTests
How it works
How do SmokeTests work?
https://2019.phpsrbija.rs
<html><body>…</body></html>
TTFB: 65ms
HTTP 1.1/200 OK
SmokeTest

Client
CI Server
Application 

to test
Production Server
How do SmokeTests work?
https://2019.phpsrbija.rs/foo
<html><body>…</body></html>
TTFB: 3ms
HTTP 1.1/404 Not Found
SmokeTest

Client
CI Server Production Server
Application 

to test
class SmokeTest extends TestCase

{

/**

* @dataProvider urlProvider

*/

public function testWebsiteUrl(Url $url)

{

$result = $this->sendGetRequest($url);

$this->assertSame(200, $result->getStatusCode());

$this->assertNotEmpty($result->getBody());

$this->assertLessThanOrEqual(100, $result->getTimeToFirstByteInMilliseconds());

}

public function urlProvider()

{

$urls = [‘http://www.kartenmacherei.de’, …];

$urlCollection = UrlCollection::fromStrings($urls);

return $urlCollection->asDataProviderArray($urlCollection);

}

…
Logic is in here
Kinda slow,
Mate!
https://pixabay.com/photos/worm-snail-conch-slowly-garden-1949678/
Concurrent SmokeTests
How do SmokeTests work?
SmokeTest

Client
CI Server
Application

to test
Production Server
https://2019.phpsrbija.rs/news
https://2019.phpsrbija.rs/talks
https://2019.phpsrbija.rs
How do SmokeTests work?
https://2019.phpsrbija.rs/news
https://2019.phpsrbija.rs/talks
https://2019.phpsrbija.rs
TTFB: 34ms
SmokeTest

Client
CI Server
Application

to test
Production Server
How do SmokeTests work?
https://2019.phpsrbija.rs/schedule
https://2019.phpsrbija.rs/talks
https://2019.phpsrbija.rs
SmokeTest

Client
CI Server
Application

to test
Production Server
How do SmokeTests work?
TTFB: 65ms
https://2019.phpsrbija.rs/schedule
https://2019.phpsrbija.rs/talks
https://2019.phpsrbija.rs
SmokeTest

Client
CI Server
Application

to test
Production Server
How do SmokeTests work?
https://2019.phpsrbija.rs/speakers
https://2019.phpsrbija.rs/schedule
https://2019.phpsrbija.rs/talks
SmokeTest

Client
CI Server
Application

to test
Production Server
How do SmokeTests work?
TTFB: 620ms
https://2019.phpsrbija.rs/speakers
https://2019.phpsrbija.rs/schedule
https://2019.phpsrbija.rs/talks
SmokeTest

Client
CI Server
Application

to test
Production Server
Source: http://www.ve7kfm.com/fcc-server.jpg
How do SmokeTests work?
BUT
BUT
There is a library for it
DjThossi/smoke-testing-php
How do SmokeTests work?
DataProvider
Single Test
Application
HTTP Requests
HTTP Responses
PHPUnit
Calls
Result[ ]
Result
class SmokeTest extends TestCase

{

/**

* @dataProvider myDataProvider

*/

public function testExample(Result $result): void

{

...

}

public function myDataProvider(): array

{

…

}

}
public function myDataProvider(): array

{

$urls = ['http://www.kartenmacherei.de', …];

$options = new SmokeTestOptions(

UrlCollection::fromStrings($urls),

new RequestTimeout(2),

new FollowRedirects(true),

new Concurrency(3),

new BodyLength(500)

);

return $this->runSmokeTests($options);

}
public function myDataProvider(): array

{

$urls = ['http://www.kartenmacherei.de', …];
$options = new SmokeTestOptions(

UrlCollection::fromStrings($urls),
new RequestTimeout(2),

new FollowRedirects(true),

new Concurrency(3),

new BodyLength(500)

);

return $this->runSmokeTests($options);

}
public function myDataProvider(): array

{

$urls = ['http://www.kartenmacherei.de', …];

$options = new SmokeTestOptions(
UrlCollection::fromStrings($urls),
new RequestTimeout(2),
new FollowRedirects(true),
new Concurrency(3),
new BodyLength(500)
);
return $this->runSmokeTests($options);

}
class SmokeTest extends TestCase

{

use SmokeTestTrait;
public function myDataProvider(): array

{

$urls = ['http://www.kartenmacherei.de', …];

$options = new SmokeTestOptions(

UrlCollection::fromStrings($urls),

new RequestTimeout(2),

new FollowRedirects(true),

new Concurrency(3),

new BodyLength(500)

);

return $this->runSmokeTests($options);

}

…
class SmokeTest extends TestCase

{

use SmokeTestTrait;
/**

* @dataProvider myDataProvider

*/

public function testExample(Result $result): void

{



…

}

…
class SmokeTest extends TestCase

{

use SmokeTestTrait;
/**

* @dataProvider myDataProvider

*/

public function testExample(Result $result): void

{

$this->assertSuccess($result);

$this->assertTimeToFirstByte(new TimeToFirstByte(100), $result);

$this->assertBodyNotEmpty($result);

$this->assertHeaderExists(

Header::fromPrimitives(‘App-Server', ‘Fury’), 

$result

);

}

…
class SmokeTest extends TestCase

{

use SmokeTestTrait;

/**

* @dataProvider myDataProvider

*/

public function testExample(Result $result): void

{

$this->assertSuccess($result);

$this->assertTimeToFirstByte(new TimeToFirstByte(100), $result);

$this->assertBodyNotEmpty($result);

$this->assertHeaderExists(

Header::fromPrimitives(‘App-Server', ‘Fury’), 

$result
);

}

…
class SmokeTest extends TestCase

{

use SmokeTestTrait;

/**

* @dataProvider myDataProvider

*/

public function testExample(Result $result): void

{

$this->assertSuccess($result);

$this->assertTimeToFirstByte(new TimeToFirstByte(100), $result);

$this->assertBodyNotEmpty($result);

$this->assertHeaderExists(Header::fromPrimitives(‘App-Server', ‘Fury’), $result);

}

public function myDataProvider()

{

$urls = ['http://www.kartenmacherei.de', …];

$options = new SmokeTestOptions(

UrlCollection::fromStrings($urls),

new RequestTimeout(2),

new FollowRedirects(true),

new Concurrency(3),

new BodyLength(500)

);

return $this->runSmokeTests($options);

}
How do SmokeTests work?
Recommended

Server Architecture
Webserver (Router)
Webserver
Application
Box A
K/V
Store
DB
Webserver
Application
Box B
K/V
Store
DB
Webserver (Router)
Webserver
Application
Box A
K/V
Store
DB
Webserver
Application
Box B
K/V
Store
DB
active = A
Webserver (Router)
Webserver
Application
Box A
K/V
Store
DB
Webserver
Application
Box B
K/V
Store
DB
active = B
Webserver (Router)
Webserver
Application
Box A
K/V
Store
DB
active = B
Webserver
Application
Box A
K/V
Store
DB
Build Server
Deploy Code
active = B Webserver (Router)
Webserver
Application
Box A
K/V
Store
DB
Webserver (Router)
Build Server
Deploy Code
Configure
active = B
Webserver
Application
Box A
K/V
Store
DB
Build Server
Deploy Code
Configure
Smoke Tests
active = B Webserver (Router)
Webserver
Application
Box A
K/V
Store
DB
Webserver (Router)
Build Server
Deploy Code
Configure
Smoke Tests
active = B
Webserver
Application
Box A
K/V
Store
DB
Build Server
Deploy Code
Configure
Smoke Tests
Switch to A
active = B Webserver (Router)
active = A
Box A Build Server
Deploy Code
Configure
Smoke Tests
Switch to A
Webserver
Application
K/V
Store
DB
Webserver (Router)
Webserver
Application
Box A
K/V
Store
DB
Webserver (Router)
Build Server
Deploy Code
Configure
Smoke Tests
active = B
SmokeTesting

as a Service
Smest.it
Smoke Test It
Smest.it
Smest.it
Smest.it
Smest.it
Smest.it
Smest.it
DjThossi/smoke-testing-php
better__groupbetter.ventures.group
better.group/jobs

More Related Content

What's hot

香港六合彩 &raquo; SlideShare
香港六合彩 &raquo; SlideShare香港六合彩 &raquo; SlideShare
香港六合彩 &raquo; SlideShare
yayao
 

What's hot (13)

Cursus phpunit
Cursus phpunitCursus phpunit
Cursus phpunit
 
(automatic) Testing: from business to university and back
(automatic) Testing: from business to university and back(automatic) Testing: from business to university and back
(automatic) Testing: from business to university and back
 
Qtp Interview Questions
Qtp Interview QuestionsQtp Interview Questions
Qtp Interview Questions
 
StdAfx.h for Novices
StdAfx.h for NovicesStdAfx.h for Novices
StdAfx.h for Novices
 
Testing, Learning and Professionalism — 20171214
Testing, Learning and Professionalism — 20171214Testing, Learning and Professionalism — 20171214
Testing, Learning and Professionalism — 20171214
 
Getting Started with Test-Driven Development at Midwest PHP 2021
Getting Started with Test-Driven Development at Midwest PHP 2021Getting Started with Test-Driven Development at Midwest PHP 2021
Getting Started with Test-Driven Development at Midwest PHP 2021
 
TDD CrashCourse Part1: Testing
TDD CrashCourse Part1: TestingTDD CrashCourse Part1: Testing
TDD CrashCourse Part1: Testing
 
Unit testing on embedded target with C++Test
Unit testing on embedded  target with C++TestUnit testing on embedded  target with C++Test
Unit testing on embedded target with C++Test
 
ES3-2020-05 Testing
ES3-2020-05 TestingES3-2020-05 Testing
ES3-2020-05 Testing
 
Google test training
Google test trainingGoogle test training
Google test training
 
PVS-Studio Has Finally Got to Boost
PVS-Studio Has Finally Got to BoostPVS-Studio Has Finally Got to Boost
PVS-Studio Has Finally Got to Boost
 
香港六合彩 &raquo; SlideShare
香港六合彩 &raquo; SlideShare香港六合彩 &raquo; SlideShare
香港六合彩 &raquo; SlideShare
 
Go testunderthehood
Go testunderthehoodGo testunderthehood
Go testunderthehood
 

Similar to Smoke tests - what why how - PHP Srbija

ACM-SAC-2016-Keynote (1)
ACM-SAC-2016-Keynote (1)ACM-SAC-2016-Keynote (1)
ACM-SAC-2016-Keynote (1)
Libero Maesano
 
Testing for infra code using test-kitchen,docker,chef
Testing for infra code using  test-kitchen,docker,chefTesting for infra code using  test-kitchen,docker,chef
Testing for infra code using test-kitchen,docker,chef
kamalikamj
 

Similar to Smoke tests - what why how - PHP Srbija (20)

SmokeTests - What, Why & How - ConFoo 2019
SmokeTests - What, Why & How - ConFoo 2019SmokeTests - What, Why & How - ConFoo 2019
SmokeTests - What, Why & How - ConFoo 2019
 
Smoke Tests @ DevOps-Hamburg 06.02.2017
Smoke Tests @ DevOps-Hamburg 06.02.2017Smoke Tests @ DevOps-Hamburg 06.02.2017
Smoke Tests @ DevOps-Hamburg 06.02.2017
 
JMeter & ColdFusion
JMeter & ColdFusion JMeter & ColdFusion
JMeter & ColdFusion
 
Justmeans power point
Justmeans power pointJustmeans power point
Justmeans power point
 
SmokeTests
SmokeTestsSmokeTests
SmokeTests
 
Python and test
Python and testPython and test
Python and test
 
Server Side Template Injection by Mandeep Jadon
Server Side Template Injection by Mandeep JadonServer Side Template Injection by Mandeep Jadon
Server Side Template Injection by Mandeep Jadon
 
Unit testing - A&BP CC
Unit testing - A&BP CCUnit testing - A&BP CC
Unit testing - A&BP CC
 
ACM-SAC-2016-Keynote (1)
ACM-SAC-2016-Keynote (1)ACM-SAC-2016-Keynote (1)
ACM-SAC-2016-Keynote (1)
 
Testing for infra code using test-kitchen,docker,chef
Testing for infra code using  test-kitchen,docker,chefTesting for infra code using  test-kitchen,docker,chef
Testing for infra code using test-kitchen,docker,chef
 
Testes? Mas isso não aumenta o tempo de projecto? Não quero...
Testes? Mas isso não aumenta o tempo de projecto? Não quero...Testes? Mas isso não aumenta o tempo de projecto? Não quero...
Testes? Mas isso não aumenta o tempo de projecto? Não quero...
 
The Automation Firehose: Be Strategic and Tactical by Thomas Haver
The Automation Firehose: Be Strategic and Tactical by Thomas HaverThe Automation Firehose: Be Strategic and Tactical by Thomas Haver
The Automation Firehose: Be Strategic and Tactical by Thomas Haver
 
2014 Joker - Integration Testing from the Trenches
2014 Joker - Integration Testing from the Trenches2014 Joker - Integration Testing from the Trenches
2014 Joker - Integration Testing from the Trenches
 
Pragmatic Parallels: Java and JavaScript
Pragmatic Parallels: Java and JavaScriptPragmatic Parallels: Java and JavaScript
Pragmatic Parallels: Java and JavaScript
 
Performance testing and j meter
Performance testing and j meterPerformance testing and j meter
Performance testing and j meter
 
Monitor your Java application with Prometheus Stack
Monitor your Java application with Prometheus StackMonitor your Java application with Prometheus Stack
Monitor your Java application with Prometheus Stack
 
Web and load testing with Visual Studio 2010 Ultimate
Web and load testing with Visual Studio 2010 UltimateWeb and load testing with Visual Studio 2010 Ultimate
Web and load testing with Visual Studio 2010 Ultimate
 
open sta testing Certification
open sta testing Certificationopen sta testing Certification
open sta testing Certification
 
Systematic Load Testing of Web Applications
Systematic Load Testing of Web ApplicationsSystematic Load Testing of Web Applications
Systematic Load Testing of Web Applications
 
the grinder testing certification
the grinder testing certificationthe grinder testing certification
the grinder testing certification
 

More from tech.kartenmacherei

More from tech.kartenmacherei (7)

PHPUnit in 4 parts - ConFoo 2019
PHPUnit in 4 parts - ConFoo 2019PHPUnit in 4 parts - ConFoo 2019
PHPUnit in 4 parts - ConFoo 2019
 
An Ode To Boring Technology
An Ode To Boring TechnologyAn Ode To Boring Technology
An Ode To Boring Technology
 
Learning to Drive - A story about app development
Learning to Drive - A story about app developmentLearning to Drive - A story about app development
Learning to Drive - A story about app development
 
Api Versioning with Docker and Nginx
Api Versioning with Docker and NginxApi Versioning with Docker and Nginx
Api Versioning with Docker and Nginx
 
Don't fear the Walking Dead @ IPC 2016
Don't fear the Walking Dead @ IPC 2016Don't fear the Walking Dead @ IPC 2016
Don't fear the Walking Dead @ IPC 2016
 
99% is not enough
99% is not enough99% is not enough
99% is not enough
 
Don't Fear the Walking Dead @ PHPUGHH
Don't Fear the Walking Dead @ PHPUGHHDon't Fear the Walking Dead @ PHPUGHH
Don't Fear the Walking Dead @ PHPUGHH
 

Recently uploaded

一比一原版UTS毕业证悉尼科技大学毕业证成绩单如何办理
一比一原版UTS毕业证悉尼科技大学毕业证成绩单如何办理一比一原版UTS毕业证悉尼科技大学毕业证成绩单如何办理
一比一原版UTS毕业证悉尼科技大学毕业证成绩单如何办理
aagad
 
audience research (emma) 1.pptxkkkkkkkkkkkkkkkkk
audience research (emma) 1.pptxkkkkkkkkkkkkkkkkkaudience research (emma) 1.pptxkkkkkkkkkkkkkkkkk
audience research (emma) 1.pptxkkkkkkkkkkkkkkkkk
lolsDocherty
 
Article writing on excessive use of internet.pptx
Article writing on excessive use of internet.pptxArticle writing on excessive use of internet.pptx
Article writing on excessive use of internet.pptx
abhinandnam9997
 
Production 2024 sunderland culture final - Copy.pptx
Production 2024 sunderland culture final - Copy.pptxProduction 2024 sunderland culture final - Copy.pptx
Production 2024 sunderland culture final - Copy.pptx
ChloeMeadows1
 

Recently uploaded (14)

Premier Mobile App Development Agency in USA.pdf
Premier Mobile App Development Agency in USA.pdfPremier Mobile App Development Agency in USA.pdf
Premier Mobile App Development Agency in USA.pdf
 
Statistical Analysis of DNS Latencies.pdf
Statistical Analysis of DNS Latencies.pdfStatistical Analysis of DNS Latencies.pdf
Statistical Analysis of DNS Latencies.pdf
 
ER(Entity Relationship) Diagram for online shopping - TAE
ER(Entity Relationship) Diagram for online shopping - TAEER(Entity Relationship) Diagram for online shopping - TAE
ER(Entity Relationship) Diagram for online shopping - TAE
 
一比一原版UTS毕业证悉尼科技大学毕业证成绩单如何办理
一比一原版UTS毕业证悉尼科技大学毕业证成绩单如何办理一比一原版UTS毕业证悉尼科技大学毕业证成绩单如何办理
一比一原版UTS毕业证悉尼科技大学毕业证成绩单如何办理
 
audience research (emma) 1.pptxkkkkkkkkkkkkkkkkk
audience research (emma) 1.pptxkkkkkkkkkkkkkkkkkaudience research (emma) 1.pptxkkkkkkkkkkkkkkkkk
audience research (emma) 1.pptxkkkkkkkkkkkkkkkkk
 
How Do I Begin the Linksys Velop Setup Process?
How Do I Begin the Linksys Velop Setup Process?How Do I Begin the Linksys Velop Setup Process?
How Do I Begin the Linksys Velop Setup Process?
 
The Use of AI in Indonesia Election 2024: A Case Study
The Use of AI in Indonesia Election 2024: A Case StudyThe Use of AI in Indonesia Election 2024: A Case Study
The Use of AI in Indonesia Election 2024: A Case Study
 
Cyber Security Services Unveiled: Strategies to Secure Your Digital Presence
Cyber Security Services Unveiled: Strategies to Secure Your Digital PresenceCyber Security Services Unveiled: Strategies to Secure Your Digital Presence
Cyber Security Services Unveiled: Strategies to Secure Your Digital Presence
 
Pvtaan Social media marketing proposal.pdf
Pvtaan Social media marketing proposal.pdfPvtaan Social media marketing proposal.pdf
Pvtaan Social media marketing proposal.pdf
 
Article writing on excessive use of internet.pptx
Article writing on excessive use of internet.pptxArticle writing on excessive use of internet.pptx
Article writing on excessive use of internet.pptx
 
Case study on merger of Vodafone and Idea (VI).pptx
Case study on merger of Vodafone and Idea (VI).pptxCase study on merger of Vodafone and Idea (VI).pptx
Case study on merger of Vodafone and Idea (VI).pptx
 
Production 2024 sunderland culture final - Copy.pptx
Production 2024 sunderland culture final - Copy.pptxProduction 2024 sunderland culture final - Copy.pptx
Production 2024 sunderland culture final - Copy.pptx
 
Bug Bounty Blueprint : A Beginner's Guide
Bug Bounty Blueprint : A Beginner's GuideBug Bounty Blueprint : A Beginner's Guide
Bug Bounty Blueprint : A Beginner's Guide
 
Multi-cluster Kubernetes Networking- Patterns, Projects and Guidelines
Multi-cluster Kubernetes Networking- Patterns, Projects and GuidelinesMulti-cluster Kubernetes Networking- Patterns, Projects and Guidelines
Multi-cluster Kubernetes Networking- Patterns, Projects and Guidelines
 

Smoke tests - what why how - PHP Srbija