test: proof of concept to replace BDD tests - #64030
Draft
susnux wants to merge 2 commits into
Draft
Conversation
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
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); }).PHPUnit
Use PlayWright
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:
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.
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
3. to review, feature component)stable32)AI (if applicable)