Skip to content
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

Travis is not running the container tests. #66

Closed
Beanow opened this issue Oct 2, 2014 · 6 comments
Closed

Travis is not running the container tests. #66

Beanow opened this issue Oct 2, 2014 · 6 comments

Comments

@Beanow
Copy link

Beanow commented Oct 2, 2014

I've recently tried this out and a working setup can be found here:
https://github.com/Tuxion/DoctrineRest/tree/develop

Summary of what to change.

  • Instead of /test/unit/ the /test folder is the place to define phpunit.xml, bootstrap.php, etc.
  • The phpunit.xml file should have two directories for tests, both the container and unit tests.
  • The bootstrap.php file should take into account the new relative paths.
  • The .travis.yml file should point to the new locations.
@pmjones
Copy link
Member

pmjones commented Oct 2, 2014

Nice. I wonder if we should create the new phpunit* files in addition to the existing ones, so the existing ones can still be run separately. Or maybe the container phpunit* files, being an integration, should be moved up to tests/ and run from there, to include the actual unit tests. Then test-runners can get the full gamut of tests.

Thanks for working on this @Beanow, please comment more as you continue working.

@Beanow
Copy link
Author

Beanow commented Oct 3, 2014

The idea for moving the tests up one level was primarily so we only need one copy of all the vendor packages. If we can build the existing tests to use the same vendor folder we can have the best of both.

Another option is to have variations only on the phpunit.xml files and set them specifically as a phpunit parameter.

I do think that for TDD it makes sense to always run both tests, checking for unexpected side-effects is precisely one of the great benefits of automated tests in my experience. I'll have a look none the less.

@Beanow
Copy link
Author

Beanow commented Oct 3, 2014

I've implemented the multiple phpunit.xml variation and made a more flexible phpunit.sh script accepting several commonly used options.

$ tests/phpunit.sh -h
Usage: phpunit.sh [-hcdsp] [SUITE]...
Run the PHPUnit tests defined by the given suite.
By default the suite is '.', which runs all suites.

    -h              Display this help and exit.
    -d              Deploy the vendor package using composer.
    -s              Supress PHPUnit status code, always returning 0.
    -p              Preparations only, this skips the actual testing.
                    Useful for doing a one-time deployment with -d for example.
    -c type[=path]  Generate code coverage reports.
                    Type indicated the type of reports, based on phpunit functionality.
                    The optional path indicates where to store the report.

Examples scenarios:

  phpunit.sh -dc html=coverage.html
    Deploy the vendor package and generate a code coverage report in HTML format.

  phpunit.sh -c text unit
    Run the unit test suite only and report code coverage in TEXT format.

  phpunit.sh -dp
    Deploy vendor package only and skip testing.

My library now has 3 test suites you could run.

  • . which maps to tests/phpunit.xml which runs both the unit and container tests.
  • unit which maps to tests/unit/phpunit.xml.
  • container which maps to tests/container/phpunit.xml.

Please note your current working directory when running the script matters.
You should always cd tests before executing. As in the .travis.yml file.

@Beanow
Copy link
Author

Beanow commented Oct 6, 2014

This script is working well for us. Feel free to help yourself to a copy.
Perhaps you may decide to remove edge cases like the status code suppression.

@harikt
Copy link
Member

harikt commented Nov 15, 2014

@Beanow please see #72 . Feedback welcome :) . Discussion over google group https://groups.google.com/d/msg/auraphp/Dcxoigi13ss/HEjP3iJ_Wc8J

@pmjones
Copy link
Member

pmjones commented Mar 15, 2015

For the record I have not forgotten this. I am working on a revised testing structure that, while it is not exactly what I like best, will cover this and perhaps other cases. Thanks for your continued patience.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants