1
0
Fork 0
Talk from TYPO3 Camps to present how to get started with Acceptance tests using PHP Codeception
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Daniel Siepmann 117441ca14
Initial version for TYPO3 Camp Munich 2022
1 month ago
LICENSE Initial version for TYPO3 Camp Munich 2022 1 month ago
readme.rst Initial version for TYPO3 Camp Munich 2022 1 month ago

readme.rst

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

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