AtoumBundle icon indicating copy to clipboard operation
AtoumBundle copied to clipboard

Add a command to launch tests of a bundle

Open jubianchi opened this issue 12 years ago • 20 comments

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

$ app/console atoum @AcmeBundle

jubianchi avatar Dec 19 '12 14:12 jubianchi

:+1:

stephpy avatar Dec 19 '12 14:12 stephpy

:+1:

BenoitLeveque avatar Jan 08 '13 16:01 BenoitLeveque

Of course :) someone started it already ?

ludofleury avatar Jan 08 '13 16:01 ludofleury

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.

stephpy avatar Jan 08 '13 16:01 stephpy

:+1:

jubianchi avatar Jan 08 '13 16:01 jubianchi

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

ludofleury avatar Jan 08 '13 17:01 ludofleury

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

stephpy avatar Jan 08 '13 17:01 stephpy

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

ludofleury avatar Jan 08 '13 17:01 ludofleury

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 avatar Jan 08 '13 17:01 stephpy

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.

stephpy avatar Jan 08 '13 17:01 stephpy

@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.

jubianchi avatar Jan 08 '13 18:01 jubianchi

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.

mageekguy avatar Jan 09 '13 07:01 mageekguy

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

stephpy avatar Jan 09 '13 09:01 stephpy

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)

ludofleury avatar Mar 05 '13 03:03 ludofleury

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

jubianchi avatar Mar 05 '13 08:03 jubianchi

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

FlorianLB avatar Mar 05 '13 09:03 FlorianLB

Yes, bootstrap file + configuration file.

stephpy avatar Mar 05 '13 09:03 stephpy

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

ludofleury avatar Mar 05 '13 09:03 ludofleury

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

stephpy avatar Mar 05 '13 09:03 stephpy

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

maxailloud avatar May 17 '17 10:05 maxailloud