-
-
Notifications
You must be signed in to change notification settings - Fork 373
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
Integration testing #5
Comments
So would it be necessary to create another package? or the whole app would be in the tests folder? please explain me because i didn't understand the travis part. |
Yep, another package would be an overkill. If we do the the app in tests folder, the travis part doesn't matter anymore. I can fiddle with that if you want and see if it's possible. |
I'd love to see some integration tests, but what worries me is that if we put an app inside the tests folder, when you get the package via composer, it would also retrieve the app. That surely is an overkill. And if I'm not wrong, the integration tests are responsibility of the app maintainer. A package should only take care of itself, hence the unit tests. This is just testing theory, so if we find a workaround for doing integration tests without creating an app inside a folder, I'm in. |
A HA! Here comes gitattributes to the rescue.
to the .gitattributes file and it's excluded from archive(composer download, download as zip etc.) Update: here's an example from Laravel https://github.com/laravel/framework/blob/5.2/.gitattributes |
I'm with @Mathius17 |
Nice suggestion @KKSzymanowski! The problem for me is that it's supposed to be automatic tests, it seems much of a hassle to execute the integration tests from inside the app (inside I'll close this issue but feel free to comment, and if you find a way to do it let us know! |
I don't think it's that much complicated. Take a look at my fork: <testsuites>
<testsuite name="Package Test Suite">
<directory suffix=".php">tests</directory>
<exclude>tests/Integration</exclude>
</testsuite>
</testsuites> In "autoload": {
"classmap": [
"../../src/commands",
"database"
],
"psr-4": {
"Santigarcor\\Laratrust\\": "../../src/Laratrust/",
"App\\": "app/"
}
}, I do not require Laratrust as a depencency. Instead I autoload it from above along with the commands. script:
- php vendor/bin/phpcs --standard=PSR2 src
- phpunit --verbose
- cd tests/Integration
- composer update
- phpunit --verbose I haven't figured out how to do this better, but it works. I've written some sample tests, I know they require refactoring but they're just as a just proof of concept. Here is the Travis build: https://travis-ci.org/KKSzymanowski/laratrust/builds Also, important part, if you take a look at my latest commits, I removed some files from By the way, don't worry. I will squash those stupid commits into one meaningful. |
Added caching to Travis. It decreased build time by nearly a half. |
What do you think about this solution? Do you know a better way to handle this? My only concern is different Laravel versions. How to test them all? Currently a lot of people uses 5.1 because it's a LTS release, rest of them uses 5.2 but soon some part of them will upgrade to 5.3. Some of the Laravel plugins keeps different branches for different releases of Laravel. |
Well i see everything fine, the thing is i don't know if this is the best way to do it, and the thing with all the laravel versions |
I have an idea for doing some integration tests.
Create a Laravel app, using Laratrust and write tests there.
What I mean is:
and so on.
This app will pull in
santigarcor/laratrust: "master"
so every time there is a change in Laratrust you would click "Restart Build" in Travis for this app to see if it all still works.What do you think about this?
Do you have better ideas?
I also think it would be great for regression tests eg. user says "When I do this and that everything crashes" we would be able to reproduce this error, write tests to fail it, fix the error and see tests turn green(just like Jeffrey explains here)
The text was updated successfully, but these errors were encountered: