-
-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Iterate further on the integration tests via Travis #92
Comments
A couple of years ago I create some code for phpcodesniffer-composer-installer issue-24 that might be usable for some of this. |
Not sure how/where to best run build steps in Windows. Maybe @mjrider has some ideas? |
@Potherca I know you can set the OS for specific builds in both Travis as well as actions, so either could work. |
Especially with an eye on preventing regressions, while still broadening support to newer versions, like PHPCS 4.x, PHP 8.x and Composer 2.x, I've made an inventory of test cases which would need to be included, by going through every single issue and PR in this repo from the very beginning to the time of writing. My focus has been on integration tests and I have made "shorthand" notes. All the same, I figured it may be useful to make these notes public for whomever starts work on getting tests set up when they have time. OS matrix
Travis matrix:
Possibly use: Basic test scenarios:
More detailed test scenarios:
Note: When error output is expected, test with both Caveats:
Rough idea about basic test setup:
=> figure out how to use the "current" branch of the plugin in the tests as it may not (yet) be public Things to test:
composer install with composer.json with
composer require & require-dev
composer require/remove this plugin
other
test with installing something with --ignore-platform-reqs where one of the other dependencies of the project has a higher PHP requirement test situation where the root project is a PHPCS standard which requires the plugin
test with different search depths set via extra
test with different search depths set via -- see if we can set up a test which triggers other Composer command steps to verify this plugin does not interfere test with the plugin installed with different versions locally and globally
test with other Composer PHPCS plugin installed as well
Candidates:
Issue #13
Issue #32
Issue #33
Issue #63
Issue #103
test without PHPCS installed External standards types to test with:
wp-coding-standards/wpcs |
That's a really nice overview to have. Very worthwhile! I've found the test code I wrote for #103 and the test code for #105 . We might want to make separate tickets from the shorthand notes so that each topics/sections can be worked on individually. I think one of the first things to do is to set up "something" generic to make it easier to write other tests on top of. |
By the way, I concur with the suggested setup. The testcode originally written for #24 has a similar setup. Specifically
Although written in/for PHPUnit, the test script calls Composer on the commandline (instead of calling the PHP code directly, as the unit-tests do). The test code written in BASH was good to get things up and running quickly but the PHP code is better for the long-term as it is much easier to read, re-use, maintain and extend. Running the PHP-code test with
The first two files are taken care of, the last could be added. They are backed-up once (with
Assuming we want the tests live in this repo (maybe in The output is caught by running commands through exec: Several (I think most, except three of four) of the composer commands to run would be quite easy to implement. The phpcs commands would be better served by another/separate test-file, i think. Definitely interesting stuff I would like to work on. Earliest available time currently looks like September after the holidays, when my work with PDS Interop is further along, and when there is less Corona craziness. |
Just came across this Composer plugin which may be useful when setting up the integration tests: https://packagist.org/packages/g1a/composer-test-scenarios |
@jrfnl Nice find! I'll have a look at it when my schedule allows. 👍 |
Regarding my schedule: After September, my time was mostly taken up with my work for @pdsinterop and getting everything finished before specific deadlines. Currently, I'm involved in a project for the Dutch Government implementing COVID-19 related software, for which there is a lot of pressure. So until things settle down, I won't be able to contribute much here (as you have probably already noticed). 😓 |
@Potherca Appreciate the update. To be honest, I think between COVID and work pressures, everyone is at, or near, the end of their energy. Also see this blogpost I wrote about this and and other things a while back: https://24daysindecember.net/2020/12/21/a-perfect-storm/ As for my part: I'm still hoping to release the 1.0.0 version of PHPCSUtils soon (was due end of last summer) and PHPCompatibility 10.0.0, WPCS 3.0.0 and PHPCSExtra 1.0.0 will follow soon after and will all include a non-dev dependency on this project. Luckily, this repo doesn't need that much attention anyhow as it just works for the most part 😉 Also: we're nearing the 14 million downloads ;-) (last time I looked it was 8 million or something) 🎉 |
FYI: as we touched upon this issue again yesterday, I got seduced into having a go at creating a working and easily extendable setup for this and after a fruitful night, I now have a working proof of concept. The first test I've created basically moves the "integration test" as was being run via Travis to PHPUnit. The principle is basically E2E testing. The setup I've currently got uses an abstract TestCase for the heavy lifting. Concrete test classes can set an initial How does that sound ? And is anyone available to do an initial review some time in the foreseeable future ? If the setup can be agreed upon, it should be pretty straight forward to expand on it with additional tests. |
Sounds good! I've (almost) always got time for reviews somewhere during each week. 👍 |
@Potherca Excellent! I'm still trying to work out some kinks and the files need a LOT of clean up, but would appreciate a look. Or even talking some things through/review call. Current issue, which is only an issue when running locally, shouldn't be an issue in CI: getting the commands to use the current PHP version and not the system default version (as they are in a different process). For this I also need to know the location of the Composer phar file, but for some reason I can't seem to find a Composer CLI command to show the location to me. |
Finally got some time to get back to this again. Looking to clean up and improve on what I set up previously over the next few days. The current setup is PHPUnit based, all the same, I do keep wavering between different options for "test framework", with The reason for initially choosing PHPUnit is mostly as contributors to this repo will most likely be relatively familiar with it and it would make it more accessible because of that to add tests and to run tests locally (and in CI on different platforms, which not all other tools are suitable for). Still needs to figure out this one though:
|
As luck would have it, I've got a week of work, so I've got some time to look into this in the coming days as wel!
At this point, I think that is a winning argument, so lets keep it at PHPUnit and work out things from there. 👍 |
Status update: Done
WIP:
To do:Please feel free to volunteer to add any of these tests... 😇
|
This is a rather long thread and I fear that the conclusion might become buried/overlooked. @jrfnl Should we close this and create new issue(s) with the actionable conclusion(s)? |
This ticket is meant as the next iteration, following up on #91
In this iteration, the following additional variants should be explored:
The text was updated successfully, but these errors were encountered: