SlideShare a Scribd company logo
0Nicole Cordes, T3DD16 - Unit tests for dummies
Functional tests for dummies
» Introduction
» Basics
» Hands on
1Nicole Cordes, T3DD16 - Unit tests for dummies
Introduction
2Nicole Cordes, T3DD16 - Unit tests for dummies
INTRODUCTION
„Who is that girl?“
» Nicole Cordes
» working at CPS-IT GmbH in Berlin
» community activity since 2011
» Core and Security Team member
» contributing to multiple public extensions
» Slack: @IchHabRecht
» Twitter: @IchHabRecht
» Mail: typo3@cordes.co
3Nicole Cordes, T3DD16 - Unit tests for dummies
Basics
4Nicole Cordes, T3DD16 - Unit tests for dummies
BASICS
„Why do I need functional tests?“
» test a part of your software
» not about testing your functions or classes, but processes
» from a user's point of view
» for quality assurance (QA)
» unit tests don't ensure a correct workflow
» manual testing takes a lot of time
» encapsulated system (database) without site-effects or dependencies
5Nicole Cordes, T3DD16 - Unit tests for dummies
BASICS
„What are you talking about?“
test case
test
test
test
test
assertion
assertion
assertion
6Nicole Cordes, T3DD16 - Unit tests for dummies
BASICS
„What are you talking about?“
Processing of a test case
» find all tests within the class
» call one test after another
» test folder in typo3temp is created
» core is linked into test folder
» test extensions are linked into typo3conf/ext
» paths and files are linked
» LocalConfiguration.php is written
» PackageStates.php is written
» bootstrap is initialized
» database is created
» database scheme is imported
7Nicole Cordes, T3DD16 - Unit tests for dummies
BASICS
„What are you talking about?“
The life cycle of a test
» create an object of the test class
» call `setUp` method (protected!)
» objects and environment can be prepared
» call one test
» call `tearDown` method (protected!)
» objects and environment can be cleaned up
8Nicole Cordes, T3DD16 - Unit tests for dummies
Hands on
9Nicole Cordes, T3DD16 - Unit tests for dummies
USE CASE
„ext_testing aka blog_example“
10Nicole Cordes, T3DD16 - Unit tests for dummies
RUNNING TESTS
„How to run tests from CLI?“
» clone TYPO3 core
» run `composer install`
» use the cloned core for your development
» run `typo3_src/bin/phpunit -c typo3/sysext/core/Build/FunctionalTests.xml typo3conf/ext/ext_testing`
» ! be aware that the functional tests dirty your database
11Nicole Cordes, T3DD16 - Unit tests for dummies
RUNNING TESTS
„How to use an own MySQL instance?“
On Unix
» sudo mkdir /tmp/mysqld-testing
» sudo chmod 700 /tmp/mysqld-testing
» sudo chown mysql:mysql /tmp/mysqld-testing
» sudo mysqld_safe --port=3307 --socket="/var/run/mysqld/mysqld-testing.sock" --user mysql --pid-
file="/var/run/mysqld/mysqld-testing.pid" --datadir="/tmp/mysqld-testing" --skip-grant-tables run
» typo3DatabaseHost="localhost" typo3DatabasePort=3307 typo3DatabaseName=“ext-testing" 
typo3DatabaseUsername=“root" typo3DatabasePassword="" 
typo3_src/bin/phpunit -c typo3/sysext/core/Build/FunctionalTests.xml
12Nicole Cordes, T3DD16 - Unit tests for dummies
RUNNING TESTS
„How to use an own MySQL instance?“
On Windows (preparation)
» copy "C:Program FilesMySQL Servermy.ini“ to "C:Program FilesMySQL Servermy-testing.ini“
» change “port=3306” to “port=3307” in [client] and [mysqld] section
» change datadir=“C:/ProgramData/MySQL/MySQL Server 5.5/data” to
datadir=“C:/ProgramData/MySQL/MySQL Server 5.5/data-testing”
» change innodb_data_home_dir="C:/ProgramData/MySQL InnoDB Datafiles/“ to
innodb_data_home_dir="C:/ProgramData/MySQL InnoDB Datafiles Testing/"
» create folder “C:/ProgramData/MySQL/MySQL Server 5.5/data-testing”
» copy mysql folder, ib_logfile0 and ib_logfile1 from original data folder
» copy "C:/ProgramData/MySQL InnoDB Datafiles/“ to "C:/ProgramData/MySQL InnoDB Datafiles Testing/“
13Nicole Cordes, T3DD16 - Unit tests for dummies
RUNNING TESTS
„How to use an own MySQL instance?“
On Windows (server handling)
» start server with "C:Program FilesMySQL Serverbinmysqld.exe" --defaults-file="C:Program
FilesMySQL Servermy-testing.ini“
» the server starts in the foreground (no new prompt appears until the server exits later)
» stop the server with "C:Program FilesMySQL Serverbinmysqladmin.exe" -u root -p --port=3307
shutdown
» cmd /C “SET typo3DatabaseHost=localhost && SET typo3DatabasePort=3307 && 
SET typo3DatabaseName=ext-testing && SET typo3DatabaseUsername=root && 
SET typo3DatabasePassword= && 
typo3_srcbinphpunit -c typo3/sysext/core/Build/FunctionalTests.xml”
18Nicole Cordes, T3DD16 - Unit tests for dummies
CODING FUNCTIONAL TESTS
„How does functional testing work?“
I
» set up your expectations
» define static requirements
» add a test case for your class
» implement requirements and test (decouple objects as much as you can)
» implement assertion
19Nicole Cordes, T3DD16 - Unit tests for dummies
CODING FUNCTIONAL TESTS
„How does functional testing work?“
II
» move your extension to GitHub
» set up the travis service in your repository settings
» add a composer.json file
» add .travis.yml
20Nicole Cordes, T3DD16 - Unit tests for dummies
Thank you
for your attention!

More Related Content

What's hot

Java Libraries You Can’t Afford to Miss
Java Libraries You Can’t Afford to MissJava Libraries You Can’t Afford to Miss
Java Libraries You Can’t Afford to Miss
Andres Almiray
 
ReactJS for Programmers
ReactJS for ProgrammersReactJS for Programmers
ReactJS for Programmers
David Rodenas
 
Contract-driven development with OpenAPI 3 and Vert.x | DevNation Tech Talk
Contract-driven development with OpenAPI 3 and Vert.x | DevNation Tech TalkContract-driven development with OpenAPI 3 and Vert.x | DevNation Tech Talk
Contract-driven development with OpenAPI 3 and Vert.x | DevNation Tech Talk
Red Hat Developers
 
Java Bytecode for Discriminating Developers - JavaZone 2011
Java Bytecode for Discriminating Developers - JavaZone 2011Java Bytecode for Discriminating Developers - JavaZone 2011
Java Bytecode for Discriminating Developers - JavaZone 2011Anton Arhipov
 
Making the Most of Your Gradle Build
Making the Most of Your Gradle BuildMaking the Most of Your Gradle Build
Making the Most of Your Gradle Build
Andres Almiray
 
Everything as a code
Everything as a codeEverything as a code
Everything as a code
Aleksandr Tarasov
 
Testing with PostgreSQL
Testing with PostgreSQLTesting with PostgreSQL
Testing with PostgreSQL
Shawn Sorichetti
 
Advanced VCL: how to use restart
Advanced VCL: how to use restartAdvanced VCL: how to use restart
Advanced VCL: how to use restart
Fastly
 
Test Driven Documentation with Spring Rest Docs JEEConf2017
Test Driven Documentation with Spring Rest Docs JEEConf2017Test Driven Documentation with Spring Rest Docs JEEConf2017
Test Driven Documentation with Spring Rest Docs JEEConf2017
Roman Tsypuk
 
TDD CrashCourse Part5: Testing Techniques
TDD CrashCourse Part5: Testing TechniquesTDD CrashCourse Part5: Testing Techniques
TDD CrashCourse Part5: Testing Techniques
David Rodenas
 
Springを用いた社内ライブラリ開発
Springを用いた社内ライブラリ開発Springを用いた社内ライブラリ開発
Springを用いた社内ライブラリ開発
Recruit Lifestyle Co., Ltd.
 
EclipseMAT
EclipseMATEclipseMAT
EclipseMATAli Bahu
 
iOS Behavior-Driven Development
iOS Behavior-Driven DevelopmentiOS Behavior-Driven Development
iOS Behavior-Driven Development
Brian Gesiak
 
Unit testing with Spock Framework
Unit testing with Spock FrameworkUnit testing with Spock Framework
Unit testing with Spock Framework
Eugene Dvorkin
 
Java Libraries You Can’t Afford to Miss
Java Libraries You Can’t Afford to Miss Java Libraries You Can’t Afford to Miss
Java Libraries You Can’t Afford to Miss
Andres Almiray
 
Monitor your CentOS stack with Prometheus
Monitor your CentOS stack with PrometheusMonitor your CentOS stack with Prometheus
Monitor your CentOS stack with Prometheus
Julien Pivotto
 
Corruptbkp
CorruptbkpCorruptbkp
Corruptbkp
oracle documents
 
Groovy Ecosystem - JFokus 2011 - Guillaume Laforge
Groovy Ecosystem - JFokus 2011 - Guillaume LaforgeGroovy Ecosystem - JFokus 2011 - Guillaume Laforge
Groovy Ecosystem - JFokus 2011 - Guillaume Laforge
Guillaume Laforge
 
201913046 wahyu septiansyah network programing
201913046 wahyu septiansyah network programing201913046 wahyu septiansyah network programing
201913046 wahyu septiansyah network programing
wahyuseptiansyah
 
Spock Framework
Spock FrameworkSpock Framework

What's hot (20)

Java Libraries You Can’t Afford to Miss
Java Libraries You Can’t Afford to MissJava Libraries You Can’t Afford to Miss
Java Libraries You Can’t Afford to Miss
 
ReactJS for Programmers
ReactJS for ProgrammersReactJS for Programmers
ReactJS for Programmers
 
Contract-driven development with OpenAPI 3 and Vert.x | DevNation Tech Talk
Contract-driven development with OpenAPI 3 and Vert.x | DevNation Tech TalkContract-driven development with OpenAPI 3 and Vert.x | DevNation Tech Talk
Contract-driven development with OpenAPI 3 and Vert.x | DevNation Tech Talk
 
Java Bytecode for Discriminating Developers - JavaZone 2011
Java Bytecode for Discriminating Developers - JavaZone 2011Java Bytecode for Discriminating Developers - JavaZone 2011
Java Bytecode for Discriminating Developers - JavaZone 2011
 
Making the Most of Your Gradle Build
Making the Most of Your Gradle BuildMaking the Most of Your Gradle Build
Making the Most of Your Gradle Build
 
Everything as a code
Everything as a codeEverything as a code
Everything as a code
 
Testing with PostgreSQL
Testing with PostgreSQLTesting with PostgreSQL
Testing with PostgreSQL
 
Advanced VCL: how to use restart
Advanced VCL: how to use restartAdvanced VCL: how to use restart
Advanced VCL: how to use restart
 
Test Driven Documentation with Spring Rest Docs JEEConf2017
Test Driven Documentation with Spring Rest Docs JEEConf2017Test Driven Documentation with Spring Rest Docs JEEConf2017
Test Driven Documentation with Spring Rest Docs JEEConf2017
 
TDD CrashCourse Part5: Testing Techniques
TDD CrashCourse Part5: Testing TechniquesTDD CrashCourse Part5: Testing Techniques
TDD CrashCourse Part5: Testing Techniques
 
Springを用いた社内ライブラリ開発
Springを用いた社内ライブラリ開発Springを用いた社内ライブラリ開発
Springを用いた社内ライブラリ開発
 
EclipseMAT
EclipseMATEclipseMAT
EclipseMAT
 
iOS Behavior-Driven Development
iOS Behavior-Driven DevelopmentiOS Behavior-Driven Development
iOS Behavior-Driven Development
 
Unit testing with Spock Framework
Unit testing with Spock FrameworkUnit testing with Spock Framework
Unit testing with Spock Framework
 
Java Libraries You Can’t Afford to Miss
Java Libraries You Can’t Afford to Miss Java Libraries You Can’t Afford to Miss
Java Libraries You Can’t Afford to Miss
 
Monitor your CentOS stack with Prometheus
Monitor your CentOS stack with PrometheusMonitor your CentOS stack with Prometheus
Monitor your CentOS stack with Prometheus
 
Corruptbkp
CorruptbkpCorruptbkp
Corruptbkp
 
Groovy Ecosystem - JFokus 2011 - Guillaume Laforge
Groovy Ecosystem - JFokus 2011 - Guillaume LaforgeGroovy Ecosystem - JFokus 2011 - Guillaume Laforge
Groovy Ecosystem - JFokus 2011 - Guillaume Laforge
 
201913046 wahyu septiansyah network programing
201913046 wahyu septiansyah network programing201913046 wahyu septiansyah network programing
201913046 wahyu septiansyah network programing
 
Spock Framework
Spock FrameworkSpock Framework
Spock Framework
 

Similar to Functional tests for dummies

Practical Chaos Engineering
Practical Chaos EngineeringPractical Chaos Engineering
Practical Chaos Engineering
SIGHUP
 
Effective Benchmarks
Effective BenchmarksEffective Benchmarks
Effective Benchmarks
Workhorse Computing
 
Developers Testing - Girl Code at bloomon
Developers Testing - Girl Code at bloomonDevelopers Testing - Girl Code at bloomon
Developers Testing - Girl Code at bloomon
Ineke Scheffers
 
Performance Analysis of Idle Programs
Performance Analysis of Idle ProgramsPerformance Analysis of Idle Programs
Performance Analysis of Idle Programs
greenwop
 
Python and test
Python and testPython and test
Python and test
Micron Technology
 
Iac d.damyanov 4.pptx
Iac d.damyanov 4.pptxIac d.damyanov 4.pptx
Iac d.damyanov 4.pptx
Dimitar Damyanov
 
CBDW2014 - MockBox, get ready to mock your socks off!
CBDW2014 - MockBox, get ready to mock your socks off!CBDW2014 - MockBox, get ready to mock your socks off!
CBDW2014 - MockBox, get ready to mock your socks off!
Ortus Solutions, Corp
 
How to Test Asynchronous Code (v2)
How to Test Asynchronous Code (v2)How to Test Asynchronous Code (v2)
How to Test Asynchronous Code (v2)
Felix Geisendörfer
 
How and what to unit test
How and what to unit testHow and what to unit test
How and what to unit test
Eugenio Lentini
 
TDD super mondays-june-2014
TDD super mondays-june-2014TDD super mondays-june-2014
TDD super mondays-june-2014
Alex Kavanagh
 
Into The Box 2018 | Assert control over your legacy applications
Into The Box 2018 | Assert control over your legacy applicationsInto The Box 2018 | Assert control over your legacy applications
Into The Box 2018 | Assert control over your legacy applications
Ortus Solutions, Corp
 
Testing Zen
Testing ZenTesting Zen
Testing Zenday
 
Creating Realistic Unit Tests with Testcontainers
Creating Realistic Unit Tests with TestcontainersCreating Realistic Unit Tests with Testcontainers
Creating Realistic Unit Tests with Testcontainers
Paul Balogh
 
Mon application web en 20 minutes
Mon application web en 20 minutesMon application web en 20 minutes
Mon application web en 20 minutes
Open Source Experience
 
My web application in 20 minutes with Telosys
My web application in 20 minutes with Telosys My web application in 20 minutes with Telosys
My web application in 20 minutes with Telosys
Laurent Guérin
 
Seven deadly sins of ElasticSearch Benchmarking
Seven deadly sins of ElasticSearch BenchmarkingSeven deadly sins of ElasticSearch Benchmarking
Seven deadly sins of ElasticSearch Benchmarking
Fan Robbin
 
how-to-bypass-AM-PPL
how-to-bypass-AM-PPLhow-to-bypass-AM-PPL
how-to-bypass-AM-PPL
nitinscribd
 
Techniques for Preserving Scientific Software Executions: Preserve the Mess o...
Techniques for Preserving Scientific Software Executions: Preserve the Mess o...Techniques for Preserving Scientific Software Executions: Preserve the Mess o...
Techniques for Preserving Scientific Software Executions: Preserve the Mess o...
12th International Conference on Digital Preservation (iPRES 2015)
 
.NET Debugging Workshop
.NET Debugging Workshop.NET Debugging Workshop
.NET Debugging Workshop
Sasha Goldshtein
 

Similar to Functional tests for dummies (20)

Gallio Crafting A Toolchain
Gallio Crafting A ToolchainGallio Crafting A Toolchain
Gallio Crafting A Toolchain
 
Practical Chaos Engineering
Practical Chaos EngineeringPractical Chaos Engineering
Practical Chaos Engineering
 
Effective Benchmarks
Effective BenchmarksEffective Benchmarks
Effective Benchmarks
 
Developers Testing - Girl Code at bloomon
Developers Testing - Girl Code at bloomonDevelopers Testing - Girl Code at bloomon
Developers Testing - Girl Code at bloomon
 
Performance Analysis of Idle Programs
Performance Analysis of Idle ProgramsPerformance Analysis of Idle Programs
Performance Analysis of Idle Programs
 
Python and test
Python and testPython and test
Python and test
 
Iac d.damyanov 4.pptx
Iac d.damyanov 4.pptxIac d.damyanov 4.pptx
Iac d.damyanov 4.pptx
 
CBDW2014 - MockBox, get ready to mock your socks off!
CBDW2014 - MockBox, get ready to mock your socks off!CBDW2014 - MockBox, get ready to mock your socks off!
CBDW2014 - MockBox, get ready to mock your socks off!
 
How to Test Asynchronous Code (v2)
How to Test Asynchronous Code (v2)How to Test Asynchronous Code (v2)
How to Test Asynchronous Code (v2)
 
How and what to unit test
How and what to unit testHow and what to unit test
How and what to unit test
 
TDD super mondays-june-2014
TDD super mondays-june-2014TDD super mondays-june-2014
TDD super mondays-june-2014
 
Into The Box 2018 | Assert control over your legacy applications
Into The Box 2018 | Assert control over your legacy applicationsInto The Box 2018 | Assert control over your legacy applications
Into The Box 2018 | Assert control over your legacy applications
 
Testing Zen
Testing ZenTesting Zen
Testing Zen
 
Creating Realistic Unit Tests with Testcontainers
Creating Realistic Unit Tests with TestcontainersCreating Realistic Unit Tests with Testcontainers
Creating Realistic Unit Tests with Testcontainers
 
Mon application web en 20 minutes
Mon application web en 20 minutesMon application web en 20 minutes
Mon application web en 20 minutes
 
My web application in 20 minutes with Telosys
My web application in 20 minutes with Telosys My web application in 20 minutes with Telosys
My web application in 20 minutes with Telosys
 
Seven deadly sins of ElasticSearch Benchmarking
Seven deadly sins of ElasticSearch BenchmarkingSeven deadly sins of ElasticSearch Benchmarking
Seven deadly sins of ElasticSearch Benchmarking
 
how-to-bypass-AM-PPL
how-to-bypass-AM-PPLhow-to-bypass-AM-PPL
how-to-bypass-AM-PPL
 
Techniques for Preserving Scientific Software Executions: Preserve the Mess o...
Techniques for Preserving Scientific Software Executions: Preserve the Mess o...Techniques for Preserving Scientific Software Executions: Preserve the Mess o...
Techniques for Preserving Scientific Software Executions: Preserve the Mess o...
 
.NET Debugging Workshop
.NET Debugging Workshop.NET Debugging Workshop
.NET Debugging Workshop
 

Recently uploaded

This 7-second Brain Wave Ritual Attracts Money To You.!
This 7-second Brain Wave Ritual Attracts Money To You.!This 7-second Brain Wave Ritual Attracts Money To You.!
This 7-second Brain Wave Ritual Attracts Money To You.!
nirahealhty
 
Latest trends in computer networking.pptx
Latest trends in computer networking.pptxLatest trends in computer networking.pptx
Latest trends in computer networking.pptx
JungkooksNonexistent
 
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
ufdana
 
guildmasters guide to ravnica Dungeons & Dragons 5...
guildmasters guide to ravnica Dungeons & Dragons 5...guildmasters guide to ravnica Dungeons & Dragons 5...
guildmasters guide to ravnica Dungeons & Dragons 5...
Rogerio Filho
 
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
3ipehhoa
 
BASIC C++ lecture NOTE C++ lecture 3.pptx
BASIC C++ lecture NOTE C++ lecture 3.pptxBASIC C++ lecture NOTE C++ lecture 3.pptx
BASIC C++ lecture NOTE C++ lecture 3.pptx
natyesu
 
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
APNIC
 
JAVIER LASA-EXPERIENCIA digital 1986-2024.pdf
JAVIER LASA-EXPERIENCIA digital 1986-2024.pdfJAVIER LASA-EXPERIENCIA digital 1986-2024.pdf
JAVIER LASA-EXPERIENCIA digital 1986-2024.pdf
Javier Lasa
 
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptxBridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
Brad Spiegel Macon GA
 
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
3ipehhoa
 
Internet-Security-Safeguarding-Your-Digital-World (1).pptx
Internet-Security-Safeguarding-Your-Digital-World (1).pptxInternet-Security-Safeguarding-Your-Digital-World (1).pptx
Internet-Security-Safeguarding-Your-Digital-World (1).pptx
VivekSinghShekhawat2
 
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
3ipehhoa
 
The+Prospects+of+E-Commerce+in+China.pptx
The+Prospects+of+E-Commerce+in+China.pptxThe+Prospects+of+E-Commerce+in+China.pptx
The+Prospects+of+E-Commerce+in+China.pptx
laozhuseo02
 
History+of+E-commerce+Development+in+China-www.cfye-commerce.shop
History+of+E-commerce+Development+in+China-www.cfye-commerce.shopHistory+of+E-commerce+Development+in+China-www.cfye-commerce.shop
History+of+E-commerce+Development+in+China-www.cfye-commerce.shop
laozhuseo02
 
Comptia N+ Standard Networking lesson guide
Comptia N+ Standard Networking lesson guideComptia N+ Standard Networking lesson guide
Comptia N+ Standard Networking lesson guide
GTProductions1
 
1.Wireless Communication System_Wireless communication is a broad term that i...
1.Wireless Communication System_Wireless communication is a broad term that i...1.Wireless Communication System_Wireless communication is a broad term that i...
1.Wireless Communication System_Wireless communication is a broad term that i...
JeyaPerumal1
 
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
keoku
 
test test test test testtest test testtest test testtest test testtest test ...
test test  test test testtest test testtest test testtest test testtest test ...test test  test test testtest test testtest test testtest test testtest test ...
test test test test testtest test testtest test testtest test testtest test ...
Arif0071
 
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
Sanjeev Rampal
 
How to Use Contact Form 7 Like a Pro.pptx
How to Use Contact Form 7 Like a Pro.pptxHow to Use Contact Form 7 Like a Pro.pptx
How to Use Contact Form 7 Like a Pro.pptx
Gal Baras
 

Recently uploaded (20)

This 7-second Brain Wave Ritual Attracts Money To You.!
This 7-second Brain Wave Ritual Attracts Money To You.!This 7-second Brain Wave Ritual Attracts Money To You.!
This 7-second Brain Wave Ritual Attracts Money To You.!
 
Latest trends in computer networking.pptx
Latest trends in computer networking.pptxLatest trends in computer networking.pptx
Latest trends in computer networking.pptx
 
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
 
guildmasters guide to ravnica Dungeons & Dragons 5...
guildmasters guide to ravnica Dungeons & Dragons 5...guildmasters guide to ravnica Dungeons & Dragons 5...
guildmasters guide to ravnica Dungeons & Dragons 5...
 
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
 
BASIC C++ lecture NOTE C++ lecture 3.pptx
BASIC C++ lecture NOTE C++ lecture 3.pptxBASIC C++ lecture NOTE C++ lecture 3.pptx
BASIC C++ lecture NOTE C++ lecture 3.pptx
 
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
 
JAVIER LASA-EXPERIENCIA digital 1986-2024.pdf
JAVIER LASA-EXPERIENCIA digital 1986-2024.pdfJAVIER LASA-EXPERIENCIA digital 1986-2024.pdf
JAVIER LASA-EXPERIENCIA digital 1986-2024.pdf
 
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptxBridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
 
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
 
Internet-Security-Safeguarding-Your-Digital-World (1).pptx
Internet-Security-Safeguarding-Your-Digital-World (1).pptxInternet-Security-Safeguarding-Your-Digital-World (1).pptx
Internet-Security-Safeguarding-Your-Digital-World (1).pptx
 
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
 
The+Prospects+of+E-Commerce+in+China.pptx
The+Prospects+of+E-Commerce+in+China.pptxThe+Prospects+of+E-Commerce+in+China.pptx
The+Prospects+of+E-Commerce+in+China.pptx
 
History+of+E-commerce+Development+in+China-www.cfye-commerce.shop
History+of+E-commerce+Development+in+China-www.cfye-commerce.shopHistory+of+E-commerce+Development+in+China-www.cfye-commerce.shop
History+of+E-commerce+Development+in+China-www.cfye-commerce.shop
 
Comptia N+ Standard Networking lesson guide
Comptia N+ Standard Networking lesson guideComptia N+ Standard Networking lesson guide
Comptia N+ Standard Networking lesson guide
 
1.Wireless Communication System_Wireless communication is a broad term that i...
1.Wireless Communication System_Wireless communication is a broad term that i...1.Wireless Communication System_Wireless communication is a broad term that i...
1.Wireless Communication System_Wireless communication is a broad term that i...
 
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
 
test test test test testtest test testtest test testtest test testtest test ...
test test  test test testtest test testtest test testtest test testtest test ...test test  test test testtest test testtest test testtest test testtest test ...
test test test test testtest test testtest test testtest test testtest test ...
 
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
 
How to Use Contact Form 7 Like a Pro.pptx
How to Use Contact Form 7 Like a Pro.pptxHow to Use Contact Form 7 Like a Pro.pptx
How to Use Contact Form 7 Like a Pro.pptx
 

Functional tests for dummies

  • 1. 0Nicole Cordes, T3DD16 - Unit tests for dummies Functional tests for dummies » Introduction » Basics » Hands on
  • 2. 1Nicole Cordes, T3DD16 - Unit tests for dummies Introduction
  • 3. 2Nicole Cordes, T3DD16 - Unit tests for dummies INTRODUCTION „Who is that girl?“ » Nicole Cordes » working at CPS-IT GmbH in Berlin » community activity since 2011 » Core and Security Team member » contributing to multiple public extensions » Slack: @IchHabRecht » Twitter: @IchHabRecht » Mail: typo3@cordes.co
  • 4. 3Nicole Cordes, T3DD16 - Unit tests for dummies Basics
  • 5. 4Nicole Cordes, T3DD16 - Unit tests for dummies BASICS „Why do I need functional tests?“ » test a part of your software » not about testing your functions or classes, but processes » from a user's point of view » for quality assurance (QA) » unit tests don't ensure a correct workflow » manual testing takes a lot of time » encapsulated system (database) without site-effects or dependencies
  • 6. 5Nicole Cordes, T3DD16 - Unit tests for dummies BASICS „What are you talking about?“ test case test test test test assertion assertion assertion
  • 7. 6Nicole Cordes, T3DD16 - Unit tests for dummies BASICS „What are you talking about?“ Processing of a test case » find all tests within the class » call one test after another » test folder in typo3temp is created » core is linked into test folder » test extensions are linked into typo3conf/ext » paths and files are linked » LocalConfiguration.php is written » PackageStates.php is written » bootstrap is initialized » database is created » database scheme is imported
  • 8. 7Nicole Cordes, T3DD16 - Unit tests for dummies BASICS „What are you talking about?“ The life cycle of a test » create an object of the test class » call `setUp` method (protected!) » objects and environment can be prepared » call one test » call `tearDown` method (protected!) » objects and environment can be cleaned up
  • 9. 8Nicole Cordes, T3DD16 - Unit tests for dummies Hands on
  • 10. 9Nicole Cordes, T3DD16 - Unit tests for dummies USE CASE „ext_testing aka blog_example“
  • 11. 10Nicole Cordes, T3DD16 - Unit tests for dummies RUNNING TESTS „How to run tests from CLI?“ » clone TYPO3 core » run `composer install` » use the cloned core for your development » run `typo3_src/bin/phpunit -c typo3/sysext/core/Build/FunctionalTests.xml typo3conf/ext/ext_testing` » ! be aware that the functional tests dirty your database
  • 12. 11Nicole Cordes, T3DD16 - Unit tests for dummies RUNNING TESTS „How to use an own MySQL instance?“ On Unix » sudo mkdir /tmp/mysqld-testing » sudo chmod 700 /tmp/mysqld-testing » sudo chown mysql:mysql /tmp/mysqld-testing » sudo mysqld_safe --port=3307 --socket="/var/run/mysqld/mysqld-testing.sock" --user mysql --pid- file="/var/run/mysqld/mysqld-testing.pid" --datadir="/tmp/mysqld-testing" --skip-grant-tables run » typo3DatabaseHost="localhost" typo3DatabasePort=3307 typo3DatabaseName=“ext-testing" typo3DatabaseUsername=“root" typo3DatabasePassword="" typo3_src/bin/phpunit -c typo3/sysext/core/Build/FunctionalTests.xml
  • 13. 12Nicole Cordes, T3DD16 - Unit tests for dummies RUNNING TESTS „How to use an own MySQL instance?“ On Windows (preparation) » copy "C:Program FilesMySQL Servermy.ini“ to "C:Program FilesMySQL Servermy-testing.ini“ » change “port=3306” to “port=3307” in [client] and [mysqld] section » change datadir=“C:/ProgramData/MySQL/MySQL Server 5.5/data” to datadir=“C:/ProgramData/MySQL/MySQL Server 5.5/data-testing” » change innodb_data_home_dir="C:/ProgramData/MySQL InnoDB Datafiles/“ to innodb_data_home_dir="C:/ProgramData/MySQL InnoDB Datafiles Testing/" » create folder “C:/ProgramData/MySQL/MySQL Server 5.5/data-testing” » copy mysql folder, ib_logfile0 and ib_logfile1 from original data folder » copy "C:/ProgramData/MySQL InnoDB Datafiles/“ to "C:/ProgramData/MySQL InnoDB Datafiles Testing/“
  • 14. 13Nicole Cordes, T3DD16 - Unit tests for dummies RUNNING TESTS „How to use an own MySQL instance?“ On Windows (server handling) » start server with "C:Program FilesMySQL Serverbinmysqld.exe" --defaults-file="C:Program FilesMySQL Servermy-testing.ini“ » the server starts in the foreground (no new prompt appears until the server exits later) » stop the server with "C:Program FilesMySQL Serverbinmysqladmin.exe" -u root -p --port=3307 shutdown » cmd /C “SET typo3DatabaseHost=localhost && SET typo3DatabasePort=3307 && SET typo3DatabaseName=ext-testing && SET typo3DatabaseUsername=root && SET typo3DatabasePassword= && typo3_srcbinphpunit -c typo3/sysext/core/Build/FunctionalTests.xml”
  • 15. 18Nicole Cordes, T3DD16 - Unit tests for dummies CODING FUNCTIONAL TESTS „How does functional testing work?“ I » set up your expectations » define static requirements » add a test case for your class » implement requirements and test (decouple objects as much as you can) » implement assertion
  • 16. 19Nicole Cordes, T3DD16 - Unit tests for dummies CODING FUNCTIONAL TESTS „How does functional testing work?“ II » move your extension to GitHub » set up the travis service in your repository settings » add a composer.json file » add .travis.yml
  • 17. 20Nicole Cordes, T3DD16 - Unit tests for dummies Thank you for your attention!