Talk from TYPO3 Camps to present how to get started with Acceptance tests using PHP Codeception
Find a file
2022-10-20 15:20:17 +02:00
LICENSE Initial version for TYPO3 Camp Munich 2022 2022-10-20 15:20:17 +02:00
readme.rst Initial version for TYPO3 Camp Munich 2022 2022-10-20 15:20:17 +02:00

Acceptance Tests for TYPO3 with help of PHP Codeception

They can be executed within

  • a docker image
  • GitHub Actions
  • GitLab CI

Our goal

  • TDD JavaScript functionality in Frontend of website
  • Cover TYPO3 backend modifications for easier TYPO3 updates
  • Robust, very few to none false positives
  • No cross browser testing
  • No visual regression testing

Used components

Firefox + geckodriver

https://github.com/mozilla/geckodriver

Nix

https://nixos.org/

PHP Built-in web server

https://www.php.net/manual/en/features.commandline.webserver.php

TYPO3 Testing Framework

https://github.com/TYPO3/testing-framework

Alternatives

runTests.sh

As used and documented by TYPO3

Docker Images by SeleniumHQ

https://github.com/SeleniumHQ/docker-selenium

cypress

https://www.youtube.com/watch?v=C96MW6TcFCw&t=5553s

Concept

Keep things simple to use: a single command to execute tests.

Get to know the stack: so you are free to adapt to your setup.

The Command

./vendor/bin/codecept run

The Stack

Browser

Firefox (could be Chrome, Chromium, Edge, …)

Driver

geckodriver (could be chromedriver, selenium, …)

Server

PHP Built-in web server (could be nginx, apache, …)

Test Runner

Codeception (could be CodeceptJS, Cypress, …)

Codeception Extensions

Codeception\Extension\RunProcess

Used to start geckodriver and PHP server

TYPO3\TestingFramework\Core\Acceptance\Extension\BackendEnvironment

Used to create environment with extensions

My suggestions

Use smart wait

https://codeception.com/docs/modules/WebDriver#Configuration

Use retry

Codeception\Step\Retry

Use a namespace
Use modules and dependencies
Use recorder

Codeception\Extension\Recorder

Current Issues

Sources

Website

https://daniel-siepmann.de

Repository

https://github.com/werkraum-media/watchlist

TYPO3 Documentation

https://docs.typo3.org/m/typo3/reference-coreapi/11.5/en-us/Testing/WritingAcceptance.html

Sponsored by our customers