SlideShare a Scribd company logo
0Nicole Cordes, T3DD15, CPS-IT Mehr Wert im Netz
Functional tests with TYPO3
» Introduction
» How to start
» Running functional tests
1Nicole Cordes, T3DD15, CPS-IT Mehr Wert im Netz
INTRODUCTION
„What is (functional) testing about?“
» 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)
„Why do I need functional tests?“
» Unit Tests don't ensure a correct workflow
» manual tests take a lot of time
» encapsulated system (database) without site-effects or dependencies
2Nicole Cordes, T3DD15, CPS-IT Mehr Wert im Netz
HOW TO START
„First you need a test case!“
<?php
namespace IchHabRechtExampleExtensionTestsFunctional;
class FirstFunctionalTest extends TYPO3CMSCoreTestsFunctionalTestCase {
}
3Nicole Cordes, T3DD15, CPS-IT Mehr Wert im Netz
HOW TO START
„Ensure your extension is loaded!“
/**
* @var array
*/
protected $testExtensionsToLoad = array(
'typo3conf/ext/example_extension',
'typo3conf/ext/example_extension/Tests/Functional/Fixtures/Extensions/test_extension',
);
/**
* @var array
*/
protected $coreExtensionsToLoad = array(
'workspaces',
);
4Nicole Cordes, T3DD15, CPS-IT Mehr Wert im Netz
HOW TO START
„Add additional files!“
/**
* @var array
*/
protected $pathsToLinkInTestInstance = array(
'typo3conf/ext/example_extension/Tests/Functional/Fixtures/AdditionalConfiguration.php' =>
'typo3conf/AdditionalConfiguration.php',
);
5Nicole Cordes, T3DD15, CPS-IT Mehr Wert im Netz
HOW TO START
„Overwrite LocalConfiguration settings!“
/**
* @var array
*/
protected $configurationToUseInTestInstance = array(
'BE' => array(
'debug' => TRUE,
),
'FE' => array(
'debug' => TRUE,
),
);
6Nicole Cordes, T3DD15, CPS-IT Mehr Wert im Netz
HOW TO START
„Initialize your infrastructure!“
protected function setUp() {
parent::setUp();
}
 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, T3DD15, CPS-IT Mehr Wert im Netz
HOW TO START
„If you need a backend user!“
protected function setUp() {
parent::setUp();
$this->setUpBackendUserFromFixture(1); // Import and log-in a default backend user
}
8Nicole Cordes, T3DD15, CPS-IT Mehr Wert im Netz
HOW TO START
„Import your data set!“
protected function setUp() {
parent::setUp();
$this->importDataSet(ORIGINAL_ROOT . 'typo3/sysext/core/Tests/Functional/Fixtures/pages.xml');
// Import own fixtures
$fixturePath = ORIGINAL_ROOT . 'typo3conf/ext/example_extension/Tests/Functional/Fixtures';
$this->importDataSet($fixturePath . 'pages.xml'); // Import database records from the xml file
}
Fixtures, shipped by the core:
 be_users.xml
 pages.xml
 pages_language_overlay.xml
 sys_file_storage.xml
 sys_language.xml
 tt_content.xml
9Nicole Cordes, T3DD15, CPS-IT Mehr Wert im Netz
HOW TO START
„Import your data set!“
typo3/sysext/core/Tests/Functional/Fixtures/pages.xml
<?xml version="1.0" encoding="utf-8"?>
<dataset>
<pages>
<uid>1</uid>
<pid>0</pid>
<title>Root</title>
<deleted>0</deleted>
<perms_everybody>15</perms_everybody>
</pages>
<pages>
<uid>2</uid>
<pid>1</pid>
<title>Dummy 1-2</title>
<deleted>0</deleted>
<perms_everybody>15</perms_everybody>
</pages>
…
</dataset>
10Nicole Cordes, T3DD15, CPS-IT Mehr Wert im Netz
HOW TO START
„Set up the frontend!“
protected function setUp() {
parent::setUp();
$this->setUpFrontendRootPage(
1, // page id
array( // array of TypoScript files which should be included
'typo3/sysext/core/Tests/Functional/Fixtures/Frontend/JsonRenderer.ts'
)
);
}
11Nicole Cordes, T3DD15, CPS-IT Mehr Wert im Netz
HOW TO START
„Set up the frontend!“
JsonRenderer.ts
config {
…
}
page = PAGE
page {
…
}
[globalVar = GP:L = 1]
config.sys_language_uid = 1
[end]
12Nicole Cordes, T3DD15, CPS-IT Mehr Wert im Netz
HOW TO START
„Set up the frontend!“
JsonRenderer.ts – config.watcher
 Defines tables and fields which should be collected to be returned
config.watcher {
tableFields {
pages = uid,_ORIG_uid,pid,sorting,title
sys_category = uid,_ORIG_uid,_LOCALIZED_UID,pid,sys_language_uid,title,parent,items,sys_language_uid
sys_file = uid,_ORIG_uid,_LOCALIZED_UID,pid,title,sys_language_uid
sys_file_reference = uid,_ORIG_uid,_LOCALIZED_UID,title,description,alternative,link,downloadname,
missing,identifier,file,pid,sys_language_uid,title,parent,items,sys_language_uid,uid_local,
uid_foreign,tablenames,fieldname,table_local
tt_content = uid,_ORIG_uid,_LOCALIZED_UID,pid,sorting,sys_language_uid,header,categories
}
}
13Nicole Cordes, T3DD15, CPS-IT Mehr Wert im Netz
HOW TO START
„Set up the frontend!“
JsonRenderer.ts – page
page = PAGE
page {
10 = COA
10 {
 Store current page in register
1 = LOAD_REGISTER
1.watcher.dataWrap = pages:{field:uid} // pages:1
 Add current page data to records and structure array
2 = USER
2.userFunc = TYPO3CMSCoreTestsFunctionalFrameworkFrontendCollector->addRecordData
14Nicole Cordes, T3DD15, CPS-IT Mehr Wert im Netz
HOW TO START
„Set up the frontend!“
JsonRenderer.ts – lib.watcherDataObject
lib.watcherDataObject = COA
lib.watcherDataObject {
1 = LOAD_REGISTER
1.watcher.dataWrap = |
2 = USER
2.userFunc = TYPO3CMSCoreTestsFunctionalFrameworkFrontendCollector->addRecordData
99 = RESTORE_REGISTER
}
15Nicole Cordes, T3DD15, CPS-IT Mehr Wert im Netz
HOW TO START
„Set up the frontend!“
JsonRenderer.ts – page.10
 Get page sub tree
10 = CONTENT
10 {
stdWrap.required = 1
table = pages
select {
orderBy = sorting
pidInList = this
# prevent sys_language_uid lookup
languageField = 0
}
renderObj < lib.watcherDataObject
renderObj.1.watcher.dataWrap = {register:watcher}|.__pages/pages:{field:uid} // pages:1.__pages/pages:2
}
16Nicole Cordes, T3DD15, CPS-IT Mehr Wert im Netz
HOW TO START
„Set up the frontend!“
JsonRenderer.ts – page.10
 Get content records
20 = CONTENT
20 {
table = tt_content
select {
orderBy = sorting
where = colPos=0
}
renderObj < lib.watcherDataObject
renderObj.1.watcher.dataWrap = {register:watcher}|.__contents/tt_content:{field:uid} // pages:1.__contents/tt_content:1
17Nicole Cordes, T3DD15, CPS-IT Mehr Wert im Netz
HOW TO START
„Set up the frontend!“
JsonRenderer.ts – page.10.20
 get additional information (sys_category, sys_file_reference)
renderObj.10 = CONTENT
if.isTrue.field = categories
table = sys_category
select {
pidInList = root,-1
selectFields = sys_category.*
join = sys_category_record_mm ON sys_category_record_mm.uid_local = sys_category.uid
where.data = field:_ORIG_uid // field:uid
where.intval = 1
where.wrap = sys_category_record_mm.uid_foreign=|
orderBy = sys_category_record_mm.sorting_foreign
languageField = sys_category.sys_language_uid
}
renderObj < lib.watcherDataObject
renderObj.1.watcher.dataWrap = {register:watcher}|.categories/sys_category:{field:uid}
// pages:1.__contents/tt_content:1.categories/sys_category:1
18Nicole Cordes, T3DD15, CPS-IT Mehr Wert im Netz
HOW TO START
„Set up the frontend!“
JsonRenderer.ts – page.10
 store collected data for output in a section “Default”
stdWrap.postUserFunc = TYPO3CMSCoreTestsFunctionalFrameworkFrontendCollector->attachSection
stdWrap.postUserFunc.as = Default
19Nicole Cordes, T3DD15, CPS-IT Mehr Wert im Netz
HOW TO START
„Set up the frontend!“
JsonRenderer.ts – page
 return collected sections as json
stdWrap.postUserFunc = TYPO3CMSCoreTestsFunctionalFrameworkFrontendRenderer->renderSections
20Nicole Cordes, T3DD15, CPS-IT Mehr Wert im Netz
HOW TO START
„Write your test!“
/**
* @test
*/
public function contentIsShown() {
$expectedRecords = array(
…,
);
$response = $this->getFrontendResponse(
1, // page id
0, // language id
0, // backend user id
0, // workspace id
TRUE, // fail on failure
0 // frontend user id
);
$responseContent = json_decode($response->getContent() , TRUE);
$this->assertEquals($expectedRecords, $responseContent['Default']['records']);
$this->assertInRecords($expectedRecords[0], $responseContent['Default']['records']);
}
21Nicole Cordes, T3DD15, CPS-IT Mehr Wert im Netz
RUNNING FUNCTIONAL TESTS
„What you need!“
 global PHP >= 5.5.0
 composer installation of PHPUnit
{
"require-dev": {
"phpunit/phpunit": “~4.7.0",
"mikey179/vfsStream": “1.4.*@dev“
}
}
 TYPO3 core source
22Nicole Cordes, T3DD15, CPS-IT Mehr Wert im Netz
RUNNING FUNCTIONAL TESTS
„FINALLY RUN!“
 go to your TYPO3 root directory
bin/phpunit -c typo3/sysext/core/Build/FunctionalTests.xml typo3conf/ext/example_extension/Tests/Functional
 use TYPO3 source (or change the used database)
typo3DatabaseName="yourDatabase" typo3DatabaseUsername="yourUser" 
typo3DatabasePassword="yourPassword" typo3DatabaseHost="localhost" 
TYPO3_PATH_WEB=“/path/to/typo3_root” 
bin/phpunit -c /path/to/typo3_root/typo3/sysext/core/Build/FunctionalTests.xml 
/path/to/typo3_root/typo3conf/ext/example_extension/Tests/Functional
23Nicole Cordes, T3DD15, CPS-IT Mehr Wert im Netz
RUNNING FUNCTIONAL TESTS
„PARTY!“
24Nicole Cordes, T3DD15, CPS-IT Mehr Wert im Netz
Thank you
for your attention!

More Related Content

What's hot

Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
Pascal Larocque
 
Deep dive into React Portals
Deep dive into React PortalsDeep dive into React Portals
Deep dive into React Portals
Souvik Basu
 
Collection v3
Collection v3Collection v3
Collection v3
Sunil OS
 
Reactjs workshop
Reactjs workshop Reactjs workshop
Reactjs workshop
Ahmed rebai
 
Angular routing
Angular routingAngular routing
Angular routing
Sultan Ahmed
 
JDBC Java Database Connectivity
JDBC Java Database ConnectivityJDBC Java Database Connectivity
JDBC Java Database Connectivity
Ranjan Kumar
 
Access modifiers in Python
Access modifiers in PythonAccess modifiers in Python
Access modifiers in Python
Santosh Verma
 
ESTEM_ReactJS_S1.pptx
ESTEM_ReactJS_S1.pptxESTEM_ReactJS_S1.pptx
ESTEM_ReactJS_S1.pptx
aissamjadli
 
Mysql Crud, Php Mysql, php, sql
Mysql Crud, Php Mysql, php, sqlMysql Crud, Php Mysql, php, sql
Mysql Crud, Php Mysql, php, sql
Aimal Miakhel
 
Workshop Spring - Session 5 - Spring Integration
Workshop Spring - Session 5 - Spring IntegrationWorkshop Spring - Session 5 - Spring Integration
Workshop Spring - Session 5 - Spring Integration
Antoine Rey
 
Java Basics V3
Java Basics V3Java Basics V3
Java Basics V3
Sunil OS
 
Angular Advanced Routing
Angular Advanced RoutingAngular Advanced Routing
Angular Advanced Routing
Laurent Duveau
 
Spring data
Spring dataSpring data
Spring data
AdilTAGGUINE
 
Java Basics
Java BasicsJava Basics
Java Basics
shivamgarg_nitj
 
Java exception-handling
Java exception-handlingJava exception-handling
Java exception-handling
Suresh Kumar Reddy V
 
LinkedList vs Arraylist- an in depth look at java.util.LinkedList
LinkedList vs Arraylist- an in depth look at java.util.LinkedListLinkedList vs Arraylist- an in depth look at java.util.LinkedList
LinkedList vs Arraylist- an in depth look at java.util.LinkedList
Marcus Biel
 
Java persistence api 2.1
Java persistence api 2.1Java persistence api 2.1
Java persistence api 2.1
Rakesh K. Cherukuri
 
Clean backends with NestJs
Clean backends with NestJsClean backends with NestJs
Clean backends with NestJs
Aymene Bennour
 
Angular
AngularAngular
Angular
LearningTech
 
Type Driven Development with TypeScript
Type Driven Development with TypeScriptType Driven Development with TypeScript
Type Driven Development with TypeScript
Garth Gilmour
 

What's hot (20)

Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
 
Deep dive into React Portals
Deep dive into React PortalsDeep dive into React Portals
Deep dive into React Portals
 
Collection v3
Collection v3Collection v3
Collection v3
 
Reactjs workshop
Reactjs workshop Reactjs workshop
Reactjs workshop
 
Angular routing
Angular routingAngular routing
Angular routing
 
JDBC Java Database Connectivity
JDBC Java Database ConnectivityJDBC Java Database Connectivity
JDBC Java Database Connectivity
 
Access modifiers in Python
Access modifiers in PythonAccess modifiers in Python
Access modifiers in Python
 
ESTEM_ReactJS_S1.pptx
ESTEM_ReactJS_S1.pptxESTEM_ReactJS_S1.pptx
ESTEM_ReactJS_S1.pptx
 
Mysql Crud, Php Mysql, php, sql
Mysql Crud, Php Mysql, php, sqlMysql Crud, Php Mysql, php, sql
Mysql Crud, Php Mysql, php, sql
 
Workshop Spring - Session 5 - Spring Integration
Workshop Spring - Session 5 - Spring IntegrationWorkshop Spring - Session 5 - Spring Integration
Workshop Spring - Session 5 - Spring Integration
 
Java Basics V3
Java Basics V3Java Basics V3
Java Basics V3
 
Angular Advanced Routing
Angular Advanced RoutingAngular Advanced Routing
Angular Advanced Routing
 
Spring data
Spring dataSpring data
Spring data
 
Java Basics
Java BasicsJava Basics
Java Basics
 
Java exception-handling
Java exception-handlingJava exception-handling
Java exception-handling
 
LinkedList vs Arraylist- an in depth look at java.util.LinkedList
LinkedList vs Arraylist- an in depth look at java.util.LinkedListLinkedList vs Arraylist- an in depth look at java.util.LinkedList
LinkedList vs Arraylist- an in depth look at java.util.LinkedList
 
Java persistence api 2.1
Java persistence api 2.1Java persistence api 2.1
Java persistence api 2.1
 
Clean backends with NestJs
Clean backends with NestJsClean backends with NestJs
Clean backends with NestJs
 
Angular
AngularAngular
Angular
 
Type Driven Development with TypeScript
Type Driven Development with TypeScriptType Driven Development with TypeScript
Type Driven Development with TypeScript
 

Viewers also liked

Fluid Security
Fluid SecurityFluid Security
Fluid Security
cpsitgmbh
 
Unit tests for dummies
Unit tests for dummiesUnit tests for dummies
Unit tests for dummies
cpsitgmbh
 
Functional tests for dummies
Functional tests for dummiesFunctional tests for dummies
Functional tests for dummies
cpsitgmbh
 
Hooks
HooksHooks
Hooks
cpsitgmbh
 
TYPO3 Caching
TYPO3 CachingTYPO3 Caching
TYPO3 Caching
cpsitgmbh
 
TYPO3 Contribution Bootup Day
TYPO3 Contribution Bootup DayTYPO3 Contribution Bootup Day
TYPO3 Contribution Bootup Day
cpsitgmbh
 
SymfonyCon Berlin 2016 Jenkins Deployment Pipelines
SymfonyCon Berlin 2016 Jenkins Deployment PipelinesSymfonyCon Berlin 2016 Jenkins Deployment Pipelines
SymfonyCon Berlin 2016 Jenkins Deployment Pipelines
cpsitgmbh
 
Präsentation zu EXT:form by TRITUM
Präsentation zu EXT:form by TRITUMPräsentation zu EXT:form by TRITUM
Präsentation zu EXT:form by TRITUM
TRITUM
 

Viewers also liked (8)

Fluid Security
Fluid SecurityFluid Security
Fluid Security
 
Unit tests for dummies
Unit tests for dummiesUnit tests for dummies
Unit tests for dummies
 
Functional tests for dummies
Functional tests for dummiesFunctional tests for dummies
Functional tests for dummies
 
Hooks
HooksHooks
Hooks
 
TYPO3 Caching
TYPO3 CachingTYPO3 Caching
TYPO3 Caching
 
TYPO3 Contribution Bootup Day
TYPO3 Contribution Bootup DayTYPO3 Contribution Bootup Day
TYPO3 Contribution Bootup Day
 
SymfonyCon Berlin 2016 Jenkins Deployment Pipelines
SymfonyCon Berlin 2016 Jenkins Deployment PipelinesSymfonyCon Berlin 2016 Jenkins Deployment Pipelines
SymfonyCon Berlin 2016 Jenkins Deployment Pipelines
 
Präsentation zu EXT:form by TRITUM
Präsentation zu EXT:form by TRITUMPräsentation zu EXT:form by TRITUM
Präsentation zu EXT:form by TRITUM
 

Similar to Functional tests with TYPO3

How to configure with Spring an api not based on Spring
How to configure with Spring an api not based on SpringHow to configure with Spring an api not based on Spring
How to configure with Spring an api not based on Spring
Jose María Arranz
 
Threads, Queues, and More: Async Programming in iOS
Threads, Queues, and More: Async Programming in iOSThreads, Queues, and More: Async Programming in iOS
Threads, Queues, and More: Async Programming in iOS
TechWell
 
SQLite with UWP
SQLite with UWPSQLite with UWP
SQLite with UWP
Cheah Eng Soon
 
Library Project
Library ProjectLibrary Project
Library Project
Holly Sanders
 
Chapter 3 stored procedures
Chapter 3 stored proceduresChapter 3 stored procedures
How to Bring Common UI Patterns to ADF
How to Bring Common UI Patterns to ADF How to Bring Common UI Patterns to ADF
How to Bring Common UI Patterns to ADF
Luc Bors
 
Apollo ecosystem
Apollo ecosystemApollo ecosystem
Apollo ecosystem
James Akwuh
 
Introduction to SQLite in Adobe AIR
Introduction to SQLite in Adobe AIRIntroduction to SQLite in Adobe AIR
Introduction to SQLite in Adobe AIR
Peter Elst
 
How te bring common UI patterns to ADF
How te bring common UI patterns to ADFHow te bring common UI patterns to ADF
How te bring common UI patterns to ADF
Getting value from IoT, Integration and Data Analytics
 
Sql storeprocedure
Sql storeprocedureSql storeprocedure
Sql storeprocedure
ftz 420
 
Lewis Chiu Portfolio
Lewis Chiu PortfolioLewis Chiu Portfolio
Lewis Chiu Portfolio
LewisChiu
 
Practical Google App Engine Applications In Py
Practical Google App Engine Applications In PyPractical Google App Engine Applications In Py
Practical Google App Engine Applications In Py
Eric ShangKuan
 
Apache Calcite Tutorial - BOSS 21
Apache Calcite Tutorial - BOSS 21Apache Calcite Tutorial - BOSS 21
Apache Calcite Tutorial - BOSS 21
Stamatis Zampetakis
 
Jdbc Java Programming
Jdbc Java ProgrammingJdbc Java Programming
Jdbc Java Programming
chhaichivon
 
Best Practices with ODI : Flexibility
Best Practices with ODI : FlexibilityBest Practices with ODI : Flexibility
Best Practices with ODI : Flexibility
Gurcan Orhan
 
Triggers and Stored Procedures
Triggers and Stored ProceduresTriggers and Stored Procedures
Triggers and Stored Procedures
Tharindu Weerasinghe
 
Does Your IBM i Security Meet the Bar for GDPR?
Does Your IBM i Security Meet the Bar for GDPR?Does Your IBM i Security Meet the Bar for GDPR?
Does Your IBM i Security Meet the Bar for GDPR?
Precisely
 
Google cloud Dataflow & Apache Flink
Google cloud Dataflow & Apache FlinkGoogle cloud Dataflow & Apache Flink
Google cloud Dataflow & Apache Flink
Iván Fernández Perea
 
Jdbc oracle
Jdbc oracleJdbc oracle
Jdbc oracle
yazidds2
 

Similar to Functional tests with TYPO3 (20)

How to configure with Spring an api not based on Spring
How to configure with Spring an api not based on SpringHow to configure with Spring an api not based on Spring
How to configure with Spring an api not based on Spring
 
Threads, Queues, and More: Async Programming in iOS
Threads, Queues, and More: Async Programming in iOSThreads, Queues, and More: Async Programming in iOS
Threads, Queues, and More: Async Programming in iOS
 
SQLite with UWP
SQLite with UWPSQLite with UWP
SQLite with UWP
 
Library Project
Library ProjectLibrary Project
Library Project
 
Chapter 3 stored procedures
Chapter 3 stored proceduresChapter 3 stored procedures
Chapter 3 stored procedures
 
How to Bring Common UI Patterns to ADF
How to Bring Common UI Patterns to ADF How to Bring Common UI Patterns to ADF
How to Bring Common UI Patterns to ADF
 
Apollo ecosystem
Apollo ecosystemApollo ecosystem
Apollo ecosystem
 
Introduction to SQLite in Adobe AIR
Introduction to SQLite in Adobe AIRIntroduction to SQLite in Adobe AIR
Introduction to SQLite in Adobe AIR
 
How te bring common UI patterns to ADF
How te bring common UI patterns to ADFHow te bring common UI patterns to ADF
How te bring common UI patterns to ADF
 
Sql storeprocedure
Sql storeprocedureSql storeprocedure
Sql storeprocedure
 
Lewis Chiu Portfolio
Lewis Chiu PortfolioLewis Chiu Portfolio
Lewis Chiu Portfolio
 
Practical Google App Engine Applications In Py
Practical Google App Engine Applications In PyPractical Google App Engine Applications In Py
Practical Google App Engine Applications In Py
 
Apache Calcite Tutorial - BOSS 21
Apache Calcite Tutorial - BOSS 21Apache Calcite Tutorial - BOSS 21
Apache Calcite Tutorial - BOSS 21
 
Jdbc Java Programming
Jdbc Java ProgrammingJdbc Java Programming
Jdbc Java Programming
 
Best Practices with ODI : Flexibility
Best Practices with ODI : FlexibilityBest Practices with ODI : Flexibility
Best Practices with ODI : Flexibility
 
Triggers and Stored Procedures
Triggers and Stored ProceduresTriggers and Stored Procedures
Triggers and Stored Procedures
 
Does Your IBM i Security Meet the Bar for GDPR?
Does Your IBM i Security Meet the Bar for GDPR?Does Your IBM i Security Meet the Bar for GDPR?
Does Your IBM i Security Meet the Bar for GDPR?
 
Google cloud Dataflow & Apache Flink
Google cloud Dataflow & Apache FlinkGoogle cloud Dataflow & Apache Flink
Google cloud Dataflow & Apache Flink
 
Jdbc oracle
Jdbc oracleJdbc oracle
Jdbc oracle
 
Struts2 - 101
Struts2 - 101Struts2 - 101
Struts2 - 101
 

Recently uploaded

Internet of Things in Manufacturing: Revolutionizing Efficiency & Quality | C...
Internet of Things in Manufacturing: Revolutionizing Efficiency & Quality | C...Internet of Things in Manufacturing: Revolutionizing Efficiency & Quality | C...
Internet of Things in Manufacturing: Revolutionizing Efficiency & Quality | C...
CIOWomenMagazine
 
可查真实(Monash毕业证)西澳大学毕业证成绩单退学买
可查真实(Monash毕业证)西澳大学毕业证成绩单退学买可查真实(Monash毕业证)西澳大学毕业证成绩单退学买
可查真实(Monash毕业证)西澳大学毕业证成绩单退学买
cuobya
 
假文凭国外(Adelaide毕业证)澳大利亚国立大学毕业证成绩单办理
假文凭国外(Adelaide毕业证)澳大利亚国立大学毕业证成绩单办理假文凭国外(Adelaide毕业证)澳大利亚国立大学毕业证成绩单办理
假文凭国外(Adelaide毕业证)澳大利亚国立大学毕业证成绩单办理
cuobya
 
一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理
一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理
一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理
eutxy
 
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
 
Bài tập unit 1 English in the world.docx
Bài tập unit 1 English in the world.docxBài tập unit 1 English in the world.docx
Bài tập unit 1 English in the world.docx
nhiyenphan2005
 
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
 
Meet up Milano 14 _ Axpo Italia_ Migration from Mule3 (On-prem) to.pdf
Meet up Milano 14 _ Axpo Italia_ Migration from Mule3 (On-prem) to.pdfMeet up Milano 14 _ Axpo Italia_ Migration from Mule3 (On-prem) to.pdf
Meet up Milano 14 _ Axpo Italia_ Migration from Mule3 (On-prem) to.pdf
Florence Consulting
 
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
ufdana
 
学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作
学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作
学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作
zyfovom
 
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
3ipehhoa
 
Explore-Insanony: Watch Instagram Stories Secretly
Explore-Insanony: Watch Instagram Stories SecretlyExplore-Insanony: Watch Instagram Stories Secretly
Explore-Insanony: Watch Instagram Stories Secretly
Trending Blogers
 
重新申请毕业证书(RMIT毕业证)皇家墨尔本理工大学毕业证成绩单精仿办理
重新申请毕业证书(RMIT毕业证)皇家墨尔本理工大学毕业证成绩单精仿办理重新申请毕业证书(RMIT毕业证)皇家墨尔本理工大学毕业证成绩单精仿办理
重新申请毕业证书(RMIT毕业证)皇家墨尔本理工大学毕业证成绩单精仿办理
vmemo1
 
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
 
Search Result Showing My Post is Now Buried
Search Result Showing My Post is Now BuriedSearch Result Showing My Post is Now Buried
Search Result Showing My Post is Now Buried
Trish Parr
 
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
 
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
3ipehhoa
 
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
 
Understanding User Behavior with Google Analytics.pdf
Understanding User Behavior with Google Analytics.pdfUnderstanding User Behavior with Google Analytics.pdf
Understanding User Behavior with Google Analytics.pdf
SEO Article Boost
 
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
3ipehhoa
 

Recently uploaded (20)

Internet of Things in Manufacturing: Revolutionizing Efficiency & Quality | C...
Internet of Things in Manufacturing: Revolutionizing Efficiency & Quality | C...Internet of Things in Manufacturing: Revolutionizing Efficiency & Quality | C...
Internet of Things in Manufacturing: Revolutionizing Efficiency & Quality | C...
 
可查真实(Monash毕业证)西澳大学毕业证成绩单退学买
可查真实(Monash毕业证)西澳大学毕业证成绩单退学买可查真实(Monash毕业证)西澳大学毕业证成绩单退学买
可查真实(Monash毕业证)西澳大学毕业证成绩单退学买
 
假文凭国外(Adelaide毕业证)澳大利亚国立大学毕业证成绩单办理
假文凭国外(Adelaide毕业证)澳大利亚国立大学毕业证成绩单办理假文凭国外(Adelaide毕业证)澳大利亚国立大学毕业证成绩单办理
假文凭国外(Adelaide毕业证)澳大利亚国立大学毕业证成绩单办理
 
一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理
一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理
一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理
 
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
 
Bài tập unit 1 English in the world.docx
Bài tập unit 1 English in the world.docxBài tập unit 1 English in the world.docx
Bài tập unit 1 English in the world.docx
 
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...
 
Meet up Milano 14 _ Axpo Italia_ Migration from Mule3 (On-prem) to.pdf
Meet up Milano 14 _ Axpo Italia_ Migration from Mule3 (On-prem) to.pdfMeet up Milano 14 _ Axpo Italia_ Migration from Mule3 (On-prem) to.pdf
Meet up Milano 14 _ Axpo Italia_ Migration from Mule3 (On-prem) to.pdf
 
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
 
学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作
学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作
学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作
 
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
 
Explore-Insanony: Watch Instagram Stories Secretly
Explore-Insanony: Watch Instagram Stories SecretlyExplore-Insanony: Watch Instagram Stories Secretly
Explore-Insanony: Watch Instagram Stories Secretly
 
重新申请毕业证书(RMIT毕业证)皇家墨尔本理工大学毕业证成绩单精仿办理
重新申请毕业证书(RMIT毕业证)皇家墨尔本理工大学毕业证成绩单精仿办理重新申请毕业证书(RMIT毕业证)皇家墨尔本理工大学毕业证成绩单精仿办理
重新申请毕业证书(RMIT毕业证)皇家墨尔本理工大学毕业证成绩单精仿办理
 
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...
 
Search Result Showing My Post is Now Buried
Search Result Showing My Post is Now BuriedSearch Result Showing My Post is Now Buried
Search Result Showing My Post is Now Buried
 
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 ...
 
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
 
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
 
Understanding User Behavior with Google Analytics.pdf
Understanding User Behavior with Google Analytics.pdfUnderstanding User Behavior with Google Analytics.pdf
Understanding User Behavior with Google Analytics.pdf
 
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
 

Functional tests with TYPO3

  • 1. 0Nicole Cordes, T3DD15, CPS-IT Mehr Wert im Netz Functional tests with TYPO3 » Introduction » How to start » Running functional tests
  • 2. 1Nicole Cordes, T3DD15, CPS-IT Mehr Wert im Netz INTRODUCTION „What is (functional) testing about?“ » 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) „Why do I need functional tests?“ » Unit Tests don't ensure a correct workflow » manual tests take a lot of time » encapsulated system (database) without site-effects or dependencies
  • 3. 2Nicole Cordes, T3DD15, CPS-IT Mehr Wert im Netz HOW TO START „First you need a test case!“ <?php namespace IchHabRechtExampleExtensionTestsFunctional; class FirstFunctionalTest extends TYPO3CMSCoreTestsFunctionalTestCase { }
  • 4. 3Nicole Cordes, T3DD15, CPS-IT Mehr Wert im Netz HOW TO START „Ensure your extension is loaded!“ /** * @var array */ protected $testExtensionsToLoad = array( 'typo3conf/ext/example_extension', 'typo3conf/ext/example_extension/Tests/Functional/Fixtures/Extensions/test_extension', ); /** * @var array */ protected $coreExtensionsToLoad = array( 'workspaces', );
  • 5. 4Nicole Cordes, T3DD15, CPS-IT Mehr Wert im Netz HOW TO START „Add additional files!“ /** * @var array */ protected $pathsToLinkInTestInstance = array( 'typo3conf/ext/example_extension/Tests/Functional/Fixtures/AdditionalConfiguration.php' => 'typo3conf/AdditionalConfiguration.php', );
  • 6. 5Nicole Cordes, T3DD15, CPS-IT Mehr Wert im Netz HOW TO START „Overwrite LocalConfiguration settings!“ /** * @var array */ protected $configurationToUseInTestInstance = array( 'BE' => array( 'debug' => TRUE, ), 'FE' => array( 'debug' => TRUE, ), );
  • 7. 6Nicole Cordes, T3DD15, CPS-IT Mehr Wert im Netz HOW TO START „Initialize your infrastructure!“ protected function setUp() { parent::setUp(); }  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, T3DD15, CPS-IT Mehr Wert im Netz HOW TO START „If you need a backend user!“ protected function setUp() { parent::setUp(); $this->setUpBackendUserFromFixture(1); // Import and log-in a default backend user }
  • 9. 8Nicole Cordes, T3DD15, CPS-IT Mehr Wert im Netz HOW TO START „Import your data set!“ protected function setUp() { parent::setUp(); $this->importDataSet(ORIGINAL_ROOT . 'typo3/sysext/core/Tests/Functional/Fixtures/pages.xml'); // Import own fixtures $fixturePath = ORIGINAL_ROOT . 'typo3conf/ext/example_extension/Tests/Functional/Fixtures'; $this->importDataSet($fixturePath . 'pages.xml'); // Import database records from the xml file } Fixtures, shipped by the core:  be_users.xml  pages.xml  pages_language_overlay.xml  sys_file_storage.xml  sys_language.xml  tt_content.xml
  • 10. 9Nicole Cordes, T3DD15, CPS-IT Mehr Wert im Netz HOW TO START „Import your data set!“ typo3/sysext/core/Tests/Functional/Fixtures/pages.xml <?xml version="1.0" encoding="utf-8"?> <dataset> <pages> <uid>1</uid> <pid>0</pid> <title>Root</title> <deleted>0</deleted> <perms_everybody>15</perms_everybody> </pages> <pages> <uid>2</uid> <pid>1</pid> <title>Dummy 1-2</title> <deleted>0</deleted> <perms_everybody>15</perms_everybody> </pages> … </dataset>
  • 11. 10Nicole Cordes, T3DD15, CPS-IT Mehr Wert im Netz HOW TO START „Set up the frontend!“ protected function setUp() { parent::setUp(); $this->setUpFrontendRootPage( 1, // page id array( // array of TypoScript files which should be included 'typo3/sysext/core/Tests/Functional/Fixtures/Frontend/JsonRenderer.ts' ) ); }
  • 12. 11Nicole Cordes, T3DD15, CPS-IT Mehr Wert im Netz HOW TO START „Set up the frontend!“ JsonRenderer.ts config { … } page = PAGE page { … } [globalVar = GP:L = 1] config.sys_language_uid = 1 [end]
  • 13. 12Nicole Cordes, T3DD15, CPS-IT Mehr Wert im Netz HOW TO START „Set up the frontend!“ JsonRenderer.ts – config.watcher  Defines tables and fields which should be collected to be returned config.watcher { tableFields { pages = uid,_ORIG_uid,pid,sorting,title sys_category = uid,_ORIG_uid,_LOCALIZED_UID,pid,sys_language_uid,title,parent,items,sys_language_uid sys_file = uid,_ORIG_uid,_LOCALIZED_UID,pid,title,sys_language_uid sys_file_reference = uid,_ORIG_uid,_LOCALIZED_UID,title,description,alternative,link,downloadname, missing,identifier,file,pid,sys_language_uid,title,parent,items,sys_language_uid,uid_local, uid_foreign,tablenames,fieldname,table_local tt_content = uid,_ORIG_uid,_LOCALIZED_UID,pid,sorting,sys_language_uid,header,categories } }
  • 14. 13Nicole Cordes, T3DD15, CPS-IT Mehr Wert im Netz HOW TO START „Set up the frontend!“ JsonRenderer.ts – page page = PAGE page { 10 = COA 10 {  Store current page in register 1 = LOAD_REGISTER 1.watcher.dataWrap = pages:{field:uid} // pages:1  Add current page data to records and structure array 2 = USER 2.userFunc = TYPO3CMSCoreTestsFunctionalFrameworkFrontendCollector->addRecordData
  • 15. 14Nicole Cordes, T3DD15, CPS-IT Mehr Wert im Netz HOW TO START „Set up the frontend!“ JsonRenderer.ts – lib.watcherDataObject lib.watcherDataObject = COA lib.watcherDataObject { 1 = LOAD_REGISTER 1.watcher.dataWrap = | 2 = USER 2.userFunc = TYPO3CMSCoreTestsFunctionalFrameworkFrontendCollector->addRecordData 99 = RESTORE_REGISTER }
  • 16. 15Nicole Cordes, T3DD15, CPS-IT Mehr Wert im Netz HOW TO START „Set up the frontend!“ JsonRenderer.ts – page.10  Get page sub tree 10 = CONTENT 10 { stdWrap.required = 1 table = pages select { orderBy = sorting pidInList = this # prevent sys_language_uid lookup languageField = 0 } renderObj < lib.watcherDataObject renderObj.1.watcher.dataWrap = {register:watcher}|.__pages/pages:{field:uid} // pages:1.__pages/pages:2 }
  • 17. 16Nicole Cordes, T3DD15, CPS-IT Mehr Wert im Netz HOW TO START „Set up the frontend!“ JsonRenderer.ts – page.10  Get content records 20 = CONTENT 20 { table = tt_content select { orderBy = sorting where = colPos=0 } renderObj < lib.watcherDataObject renderObj.1.watcher.dataWrap = {register:watcher}|.__contents/tt_content:{field:uid} // pages:1.__contents/tt_content:1
  • 18. 17Nicole Cordes, T3DD15, CPS-IT Mehr Wert im Netz HOW TO START „Set up the frontend!“ JsonRenderer.ts – page.10.20  get additional information (sys_category, sys_file_reference) renderObj.10 = CONTENT if.isTrue.field = categories table = sys_category select { pidInList = root,-1 selectFields = sys_category.* join = sys_category_record_mm ON sys_category_record_mm.uid_local = sys_category.uid where.data = field:_ORIG_uid // field:uid where.intval = 1 where.wrap = sys_category_record_mm.uid_foreign=| orderBy = sys_category_record_mm.sorting_foreign languageField = sys_category.sys_language_uid } renderObj < lib.watcherDataObject renderObj.1.watcher.dataWrap = {register:watcher}|.categories/sys_category:{field:uid} // pages:1.__contents/tt_content:1.categories/sys_category:1
  • 19. 18Nicole Cordes, T3DD15, CPS-IT Mehr Wert im Netz HOW TO START „Set up the frontend!“ JsonRenderer.ts – page.10  store collected data for output in a section “Default” stdWrap.postUserFunc = TYPO3CMSCoreTestsFunctionalFrameworkFrontendCollector->attachSection stdWrap.postUserFunc.as = Default
  • 20. 19Nicole Cordes, T3DD15, CPS-IT Mehr Wert im Netz HOW TO START „Set up the frontend!“ JsonRenderer.ts – page  return collected sections as json stdWrap.postUserFunc = TYPO3CMSCoreTestsFunctionalFrameworkFrontendRenderer->renderSections
  • 21. 20Nicole Cordes, T3DD15, CPS-IT Mehr Wert im Netz HOW TO START „Write your test!“ /** * @test */ public function contentIsShown() { $expectedRecords = array( …, ); $response = $this->getFrontendResponse( 1, // page id 0, // language id 0, // backend user id 0, // workspace id TRUE, // fail on failure 0 // frontend user id ); $responseContent = json_decode($response->getContent() , TRUE); $this->assertEquals($expectedRecords, $responseContent['Default']['records']); $this->assertInRecords($expectedRecords[0], $responseContent['Default']['records']); }
  • 22. 21Nicole Cordes, T3DD15, CPS-IT Mehr Wert im Netz RUNNING FUNCTIONAL TESTS „What you need!“  global PHP >= 5.5.0  composer installation of PHPUnit { "require-dev": { "phpunit/phpunit": “~4.7.0", "mikey179/vfsStream": “1.4.*@dev“ } }  TYPO3 core source
  • 23. 22Nicole Cordes, T3DD15, CPS-IT Mehr Wert im Netz RUNNING FUNCTIONAL TESTS „FINALLY RUN!“  go to your TYPO3 root directory bin/phpunit -c typo3/sysext/core/Build/FunctionalTests.xml typo3conf/ext/example_extension/Tests/Functional  use TYPO3 source (or change the used database) typo3DatabaseName="yourDatabase" typo3DatabaseUsername="yourUser" typo3DatabasePassword="yourPassword" typo3DatabaseHost="localhost" TYPO3_PATH_WEB=“/path/to/typo3_root” bin/phpunit -c /path/to/typo3_root/typo3/sysext/core/Build/FunctionalTests.xml /path/to/typo3_root/typo3conf/ext/example_extension/Tests/Functional
  • 24. 23Nicole Cordes, T3DD15, CPS-IT Mehr Wert im Netz RUNNING FUNCTIONAL TESTS „PARTY!“
  • 25. 24Nicole Cordes, T3DD15, CPS-IT Mehr Wert im Netz Thank you for your attention!