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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
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
Generative KI, Ethik und Nachhaltigkeit
oliverklee
0
98
Gewaltfreie Kommunikation: ein Crashkurs
oliverklee
0
130
Team-Management-Plattform
oliverklee
0
98
Vertrauen in Teams & Führung
oliverklee
0
330
Software-Qualität von TYPO3-Extensions automatisieren
oliverklee
0
62
Vertrauen in Teams & Führung
oliverklee
0
180
Testing von TYPO3-Extensions
oliverklee
0
110
Software-Qualität von Extensions automatisieren
oliverklee
1
66
Content-Synchronisierung
oliverklee
0
200
Other Decks in Technology
See All in Technology
あるけみー式LTスライド作成術
alchemy1115
2
220
AIエージェントの権限管理 3: Agentic RAG の Fine grained access control 編
ren8k
0
130
Vibe Coding で作ったプロダクトをどう安全に動かすか / How to Safely Run Products Built with Vibe Coding
glidenote
0
180
AIを活用するために決めた "やらないこと" - 価値に注目する / Not betting on AI
soudai
PRO
3
560
LTのテーマ どうきめてる?〜5つの型と私のやり方〜
yama3133
1
110
ソフトウェアDNAとクラウドエージェントのススメ
cloudace
0
120
JSONataとAWS Step Functionsで目指すRuntimelessな世界
mu7889yoon
0
200
AIによるクリエイティブ生成を行う上での試行錯誤
plaidtech
PRO
0
160
CLIライブラリ開発を支える技術
htnabe
0
130
EventBridge に「合流」はない ― サーバーレスのワークフローを育てるということ / No Join in EventBridge
yusukeshimizu
2
170
作って終わりじゃないサーバーレス 〜9年運用する大規模EC物流API基盤の設計・運用のリアル〜
zozotech
PRO
0
190
AI 時代のスタートアップエコシステ厶から考究する技術的負債との向き合い方
m3m0r7
PRO
3
2.3k
Featured
See All Featured
Documentation Writing (for coders)
carmenintech
77
5.5k
Chasing Engaging Ingredients in Design
codingconduct
0
320
Are puppies a ranking factor?
jonoalderson
2
3.9k
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
2
700
Writing Fast Ruby
sferik
630
63k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
3k
RailsConf 2023
tenderlove
30
1.5k
From π to Pie charts
rasagy
1
370
WCS-LA-2024
lcolladotor
0
830
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
1
410
Statistics for Hackers
jakevdp
799
230k
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
240
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