Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Testen mit TYPO3 für Fortgeschrittene
Search
Oliver Klee
May 30, 2018
Technology
230
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Testen mit TYPO3 für Fortgeschrittene
Oliver Klee
May 30, 2018
More Decks by Oliver Klee
See All by Oliver Klee
Softwarequalität für öffentliche TYPO3-Extensions
oliverklee
0
57
Psychologische Sicherheit
oliverklee
0
43
Generative KI, Ethik und Nachhaltigkeit
oliverklee
0
170
Gewaltfreie Kommunikation: ein Crashkurs
oliverklee
0
140
Team-Management-Plattform
oliverklee
0
100
Vertrauen in Teams & Führung
oliverklee
0
330
Software-Qualität von TYPO3-Extensions automatisieren
oliverklee
0
65
Vertrauen in Teams & Führung
oliverklee
0
190
Testing von TYPO3-Extensions
oliverklee
0
110
Other Decks in Technology
See All in Technology
AI導入は済んだ。次は統制を作り替える番だ_AI×開発組織 Summit 2026
techtekt
PRO
0
310
ウォンテッドリーの最近のプロダクトと技術の紹介
stomk
0
120
実践!Cloud Run ハンズオン!! / Cloud Run handson
y0hgi
2
290
スプシの手作業からの解脱 ~更新はClaude Codeに、見せ方と使い方はGASアプリに任せる~
kentarofujii
0
160
Local CI × GitHub Actions
gogutan
2
220
宣言型部分更新は何を解決しどこへ向かうのか
shuta13
1
460
OptunaHub: ブラックボックス最適化のためのプラットフォーム
pfn
PRO
0
140
Persisting Massive Data with Rails ~Designing for 60 billion rows, and fighting the bottlenecks~ Railsで挑む大量データ永続化 〜600億件を永続化するための設計とボトルネックとの戦い〜
occhi
0
730
Gemini Intelligence 入門 ― AppFunctions と Gemini Nano
takuroabe
0
290
V8のArray.prototype.flatを最大約20倍速くするまでと、巨大OSSへの大規模コミットの道のり
riyaamemiya
0
300
ブラウザとサーバーから考えるAI時代のフロントエンド監視
shogo4131
3
990
実践! SRE × AI - ABEMA における AIOps -
tetsuya28
8
3.1k
Featured
See All Featured
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
430
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
310
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
710
VelocityConf: Rendering Performance Case Studies
addyosmani
331
25k
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
3
3.9k
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
580
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
730
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
800
Facilitating Awesome Meetings
lara
57
7.2k
How to build a perfect <img>
jonoalderson
1
6.1k
Writing Fast Ruby
sferik
630
63k
Bootstrapping a Software Product
garrettdimon
PRO
306
120k
Transcript
Testen mit TYPO3 (advanced) Oliver Klee, 2018-05 @oliklee |
[email protected]
Cartoon: www.fuchskind.de
Test-Level http://filipdefar.com/2015/06/tested-be-thy-name.html
Unit-Tests sind klein und schnell
Integrationstests testen das Zusammenspiel von Komponenten in TYPO3: „Functional Tests“
Systemtests testen das große Ganze
Test-Typen
Blackbox-Tests testen das nach außen Sichtbare
Whitebox-Tests wie genau es innen funktioniert testen,
Functional Tests
Akzeptanztests
Anti- Zombie- Tests-
Regressionstests
Smoketests
Smoketests
Story-Tests für Behavior-Driven Development (BDD)
None
Was bisher geschah
None
Deprecated seit PHPUnit 5.4.0 $this->backEndUser = $this->getMock( BackendUserAuthentication::class ); Empfohlen
seit PHPUnit 5.4.0 $this->backEndUser = $this->createMock( BackendUserAuthentication::class ); Änderungen bei Mocks $this->backEndUser = $this->getMockBuilder( BackendUserAuthentication::class )->disableOriginalConstructor() ->disableOriginalClone();
Prophecy: Empfohlen für Stubs (vollständige Mocks) Änderungen bei Mocks $this->viewProphecy
= $this->prophesize(TemplateView::class); $this->view = $this->viewProphecy->reveal(); … $this->viewProphecy->assign('tea', $tea)->shouldBeCalled(); PHPUnit-Mocks: Weiterhin empfohlen für partielle Mocks $this->controller = $this->getMockBuilder(TeaController::class) ->setMethods(['forward', 'redirect']);
Testing-Frameworks Testing-Framework der PHPUnit-Extension typo3/testing-framework nimut/testing-framework
Testing-Frameworks Testing-Framework der PHPUnit-Extension typo3/testing-framework nimut/testing-framework erhält keine neuen Features
mehr kompatibel bis TYPO3 CMS 8.7 benutzt eine echte TYPO3-Instanz
Testing-Frameworks Testing-Framework der PHPUnit-Extension typo3/testing-framework nimut/testing-framework läuft auf Linux und
Mac, nicht unter Windows API variiert zwischen TYPO3-Versionen wird vom Core-Team gepflegt
Testing-Frameworks Testing-Framework der PHPUnit-Extension typo3/testing-framework nimut/testing-framework läuft auf Linux, Mac
und Windows API ist identisch zwischen TYPO3-Versionen wird von Nicole und Helmut gepflegt
Testing-Frameworks Testing-Framework der PHPUnit-Extension typo3/testing-framework nimut/testing-framework nicht für neue Projekte
benutzen für Projekte unter genau einer TYPO3-Version für Extensions über mehrere TYPO3-Versionen
PhantomJS ist tot stattdessen empfohlen: Chromedriver Änderungen bei Akzeptanztests PHPUnit-Selenium
wird nicht mehr brauchbar gewartet hat keine aktuelle Dokumentation Benutzung ist weiterhin umständlich Codeception bietet High-Level-Browser-Tests mit und ohne Selenium unterstützt u.a. Chromedriver und PhpBrowser
None
Infrastruktur
https://github.com/oliverklee/tea
composer.json "require-dev": { "typo3/cms-fluid-styled-content": "^7.6.23 || ^8.7.10", "helhum/typo3-composer-setup": "^0.5.1", "helmich/typo3-typoscript-lint":
"^1.4.4", "nimut/testing-framework": "^3.0", "roave/security-advisories": "dev-master" },
Konfiguration in PhpStorm
Konfiguration in PhpStorm Unit-Tests Funktionale Tests
None
Funktionale Repository- Tests
TeaRepositoryTest.php class TeaRepositoryTest extends FunctionalTestCase { /** * @var string[]
*/ protected $testExtensionsToLoad = ['typo3conf/ext/tea'];
TeaRepositoryTest.php protected function setUp() { parent::setUp(); $this->persistenceManager = GeneralUtility::makeInstance(PersistenceManager::class); /**
@var ObjectManager $objectManager */ $objectManager = GeneralUtility::makeInstance(ObjectManager::class); $this->subject = $objectManager->get(TeaRepository::class); } /** * @test */ public function findAllForNoRecordsReturnsEmptyContainer() { $container = $this->subject->findAll(); static::assertCount(0, $container); }
TeaRepositoryTest.php /** * @test */ public function findAllWithRecordsFindsRecordsFromAllPages() { $this->importDataSet(
__DIR__ . '/../Fixtures/Product/Tea.xml' ); $container = $this->subject->findAll(); static::assertGreaterThanOrEqual(1, \count($container)); }
Fixtures/Product/Tea.xml <?xml version="1.0" encoding="utf-8"?> <dataset> <tx_tea_domain_model_product_tea> <uid>1</uid> <pid>1</pid> <title>Earl Grey</title>
<description>Fresh and hot.</description> </tx_tea_domain_model_product_tea> … <sys_file_reference> <uid>1</uid> <pid>1</pid> <uid_foreign>3</uid_foreign> <tablenames>tx_tea_domain_model_product_tea</tablenames> <fieldname>image</fieldname> <l10n_diffsource></l10n_diffsource> </sys_file_reference> </dataset>
TeaRepositoryTest.php /** * @test */ public function findByUidForExistingRecordReturnsModelWithData() { $this->importDataSet(
__DIR__ . '/../Fixtures/Product/Tea.xml' ); $uid = 1; /** @var Tea $model */ $model = $this->subject->findByUid($uid); static::assertNotNull($model); static::assertSame('Earl Grey', $model->getTitle()); static::assertSame( 'Fresh and hot.’, $model->getDescription() ); }
TeaRepositoryTest.php /** * @test */ public function fillsImageRelation() { $this->importDataSet(
__DIR__ . '/../Fixtures/Product/Tea.xml' ); $uid = 3; /** @var Tea $model */ $model = $this->subject->findByUid($uid); $image = $model->getImage(); static::assertInstanceOf(FileReference::class, $image); static::assertSame(1, $image->getUid()); }
TeaRepositoryTest.php /** * @test */ public function addAndPersistAllCreatesNewRecord() { $title
= 'Godesberger Burgtee'; $model = new Tea(); $model->setTitle($title); $this->subject->add($model); $this->persistenceManager->persistAll(); $databaseRow = $this->getDatabaseConnection() ->selectSingleRow( '*', 'tx_tea_domain_model_product_tea', 'uid = ' . $model->getUid() ); static::assertSame($title, $databaseRow['title']); }
Legacy- Projekte
Wo anfangen?
Ein Test-Grundgerüst schaffen Testing- Framework einbinden Starter-Test assertSame(1,1); Unit-Tests Model-Tests
auf AbstractEntity Functional Tests Repository-Tests für das Laden von Models
„Low-hanging fruit“ pflücken Model-Tests für Getter/Setter (Live-Templates) Utility-Klassen Unit-Tests oder
funktionale Tests Controller-Tests Forwards und Redirects mit partiellen Mocks Repositories funktionale Tests fürs das Mappen von Feldern Controller-Tests Datenfluss: Views <=> Repositories
Wichtige Tests schreiben Hohes Risiko Was darf auf gar keinen
Fall kaputtgehen? Fragilität Was geht öfter mal kaputt? Beweglichkeit Welchen Code verändern wir oft?
Wenn man ohnehin schraubt … Bugfixes neue Features Refactoring Zuerst
Tests schreiben!
None