Closed FrontEndCoffee closed 5 years ago
For e2e testing, consider https://github.com/Behat/Behat
Working on this as a proof of concept
I like the concept of end to end testing, however for a PHP component that doesn't actually provide 'an end', like a front-end or a cli environment (excluding the console command for the api list), I think it's rather redundant to write BDT's.
Is there a scenario where basic UnitTests, which we already provide, wouldn't cover what an e2e test would?
As discussed internally, we won't add E2E tests to this package at the moment.
Proposal
The client is currently only covered by unit tests. This is awesome, but I think we should do more.
I propose we implement end-to-end tests. And I have an idea on how to do it.
The goal of these tests is to test all possible commands through the client.
Implementation
My proposed implementation would add a single test class that is called
e2eTest.php
. This class would consist of a test method, and a data provider method.testEndToEndCase($args...)
Instantiate the client like normal, the only difference from a real world example is that the
sendRequest
method gets mocked to return a static response, and assert the provided URL and request parameters. After that the eventual return value of the client is asserted for it's value.e2eProvider()
PHPUnit data provider that has the following structure: