atoum / AtoumBundle

This bundle provides a simple integration of atoum into Symfony 2.
MIT License
45 stars 25 forks source link

Add a command to launch tests of a bundle #9

Open jubianchi opened 11 years ago

jubianchi commented 11 years ago

It would be really nice to have a native SF2 command to launch test on a bundle :

$ app/console atoum @AcmeBundle
stephpy commented 11 years ago

:+1:

BenoitLeveque commented 11 years ago

:+1:

ludofleury commented 11 years ago

Of course :) someone started it already ?

stephpy commented 11 years ago

I can look at this asap, we discuss about this with @jubianchi, having:

in config.yml

atoum:
    bundles: [FooBundle, BarBundle]
$ app/console atoum @FooBundle
$ app/console atoum # launch all bundles configured.
jubianchi commented 11 years ago

:+1:

ludofleury commented 11 years ago

why bundles configuration ? is it really needed (is it for coverage etc ?) ?

stephpy commented 11 years ago

This is useful to launch tests of each bundles which contains atoum tests. (via app/console atoum command).

ludofleury commented 11 years ago

can't it seek for all registered bundles ?? I don't see the need to add config for the test env.

stephpy commented 11 years ago

We'll have to define if tests are atoum or phpunit or other ..., why not.

But IMO, i would prefer to launch tests of MY bundles, having fail tests on bundles which are not mine is so boring ...

For sure, this config has to be on config_test.yml.

stephpy commented 11 years ago

We keep in mind to add some other configurations, like the storage(orm, odm, propel, propel2, etc...) to propose annotations for refresh database or load fixtures.

jubianchi commented 11 years ago

@ludofleury : seeking among registered bundles can quickly become a pain as, as @stephpy said, we don't know which test framework is used in which bundle and sniffing it would add, to me, useless and painful to maintain code.

In my mind, when I submitted this feature request, it was only intended to run tests for bundles laying in src/ but @stephpy suggested that it would also be cool, in some cases, to launch every bundle's test suite with only one command.

So, I think the config is the most secure and esay way to get best of both worlds and it could be optional, letting AtoumBundle trigger only certain suites.

mageekguy commented 11 years ago

I think that it's must be a good idea to launch tests of ALL bundles even if they are not write with atoum. It's a good solution to check if the environment is ok when you install a software. But sure that it's not easy to do a launcher which can handle PHPUnit tests and atoum tests.

stephpy commented 11 years ago

Yes, and user may just want to launch his tests, or it could be configurable.

By doing a configuration, we reinvent the wheel, it's may be more useful to show some examples of .atoum.php configuration files, by this way, user could launch:

$ bin/console atoum --c=.atoum.all.php
ludofleury commented 11 years ago

It's kinda related to this issue, but Atoum Bundle (and the sf command) do not support the requirement of app/autoload.php ???

How should I deal with this in this bundle ? (I don't want to require in each test classes)

jubianchi commented 11 years ago

@ludofleury did you try using a bootstrap file (including it in all tests) which would include the app/autoload ?

FlorianLB commented 11 years ago

Maybe we could provide an option for the bootstrap file in the command (and use a generic bootstrap file if none provided)

stephpy commented 11 years ago

Yes, bootstrap file + configuration file.

ludofleury commented 11 years ago

It's a bundle in a Symfony Context, we should rely on composer autoload for this no ?

stephpy commented 11 years ago

Using a default bootstrap file integrated on AtoumBundle would be great.

maxailloud commented 7 years ago

I think this ticket can be close, isn't it?