Skip to content

test: proof of concept to replace BDD tests - #64030

Draft
susnux wants to merge 2 commits into
masterfrom
test/phpunit-integration
Draft

test: proof of concept to replace BDD tests#64030
susnux wants to merge 2 commits into
masterfrom
test/phpunit-integration

Conversation

@susnux

@susnux susnux commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Motivation

Every time we discussed integration tests it was concluded that no backend engineer liked the BDD tests (behat integration tests) as the gherkin language just adds a artificial language layer on top of the PHP fixtures.
But no non-technical person ever worked on the tests, meaning the one argument for such gherkin tests is not fulfilled.

Writing new integration tests is a burden that prevents many needed regression tests and thus negatively affects the Nextcloud QA.

There are various solutions available as alternatives, I have considered following approaches:

  • Use PEST + guzzle
  • Use PHPUnit + guzzle
  • Use Playwright requests
  • Keep behat

PEST

Pest is a slim framework on-top of PHPUnit it allows for slimmer test case code as you no longer need to write full test classes but just use functional approach test('what i am testing', function () { expect(1)->toBe(1); }).

Reduces the boiler plate for every test code Introduces a new dependency
Parallel test runner New test styles can lead to inconsistencies in unit tests as well
Not that popular in PHP world

PHPUnit

Known framework in Nextcloud Verbose test syntax
Same tech-stack for backend engineers No parallel test runner
Write tests just like code Tests require understanding code

Use PlayWright

Reuse infrastructure from e2e tests Tests written in Typescript = different tech stack for backend engineers
Reuse fixtures and helpers from e2e tests No direct access to server internal state anymore
Requests and JSON handling is language native
Fully parallel test runner

Comparison

As PEST only is a layer on top of PHPUnit I skipped this for the proof of concept, I personally also do not think it makes sense to introduce this new test pattern in Nextcloud backend.

For performance:

  • Behat: 43s
  • PHPUnit: 37s
  • Playwright: 38s

The test was a bit unfair as it mostly waits for the rate limit to cooldown, so a test like the sharing features is most likely much faster on Playwright than on the others as it can make use of fully parallel web requests.

PHPUnit Playwright
Keep PHP tech stack Easier working with requests
Migration is very simple as we just call existing behat helpers We can reuse and share helpers created for e2e tests
Still allows access to internals of the running server Faster when many requests are done in one test

Summary

I think that both alternatives Playwright and PHPUnit have their benefits so this is up for a discussion of all contributors.
From my point of view both are better readable and maintainable as an software engineer when compared with behat - at least when working in the Nextcloud ecosystem.

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
@susnux susnux added the 2. developing Work in progress label Sep 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2. developing Work in progress

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant