Giter VIP home page Giter VIP logo

Comments (12)

dbaltas avatar dbaltas commented on June 19, 2024

Filenames ending with Test.php is a strong PHPUnit convention.
Even running PHPUnit suite standalone would ignore php files not ending with this suffix when specifying a folder.

You could write a patch by setting $relaxTestPattern to true in the call of tryLoadTests
$this->tryLoadTests($path . DIRECTORY_SEPARATOR . $file, true);
https://github.com/brianium/paratest/blob/master/src/ParaTest/Runners/PHPUnit/SuiteLoader.php#L61

Alternatively, this option, relaxTestPattern could be configurable in the command line options, but I am not sure if Brian would like to go down this path.

Is there a good reason to not have your tests filenames ending with ...Test.php?

from paratest.

brianium avatar brianium commented on June 19, 2024

I am of the same opinion as Dimitris. Unless there is overwhelming demand for this, I think we should leave it as is. The configuration via command line would be an acceptable solution if it were necessary. Let's close this for now and revisit it if we see some demand for it.

from paratest.

adam-lynch avatar adam-lynch commented on June 19, 2024

Ok, no problem. But just let me comment on a couple of things.

Is there a good reason to not have your tests filenames ending with ...Test.php?

It's not a massive problem for us since we're just beginning to write the (Selenium) test files we intend to parallelize, but it just breaks our convention of having our test directories mirror our source directories in structure and filenames (which we have for our set of existing plain PHPUnit tests).

Filenames ending with Test.php is a strong PHPUnit convention.
Even running PHPUnit suite standalone would ignore php files not ending with this suffix when specifying a folder.

I just noticed this because in our .xml.dist we have specified:

<testsuites>
    <testsuite name="Blah project">
        <directory suffix='.php'>blah/blah</directory>
        <directory suffix='.php'>blah2/blah</directory>
        <exclude>blah/blah/blah</exclude>
    </testsuite>
</testsuites>

Which is fine when ran regularly with PHPUnit but via Paratest, the suffix we have specified is ignored. So, I guess it's blocking a PHPUnit configuration feature. It's not a big problem for us but might be for someone with a large set of existing tests they want to parallelize.

from paratest.

brianium avatar brianium commented on June 19, 2024

The configuration aspect of PHPUnit is more difficult to cover with Paratest. I think it would be awesome if we could support more of it. I started the work that supports the limited configuration here https://github.com/brianium/paratest/blob/master/src/ParaTest/Runners/PHPUnit/Configuration.php. Maybe this context is something we could begin to support?

from paratest.

adam-lynch avatar adam-lynch commented on June 19, 2024

Yeah I guessed that, since you'll basically be doing work PHPUnit will do anyway when it reads the dist itself.

Unless there's anyway to leverage the internal classes of PHPUnit itself?

from paratest.

adam-lynch avatar adam-lynch commented on June 19, 2024

This is really a frustrating issue. I got bitten by it just now again.

from paratest.

brianium avatar brianium commented on June 19, 2024

I am thinking on the best way to support this. The easy way is to allow suffix patterns to be specified via the cli. It might be worth looking into a better way to handle configuration concerns in general. It doesn't seem like it would be too difficult to make the suite loader aware of directories and their provided suffixes. The SuiteLoader already has access to the configuration that is parsing those suites. Maybe we can parse those suite nodes into more complete objects (instead of a dictionary of name => path pairs).

from paratest.

brianium avatar brianium commented on June 19, 2024

https://github.com/brianium/paratest/blob/master/src/ParaTest/Runners/PHPUnit/SuiteLoader.php#L36
https://github.com/brianium/paratest/blob/master/src/ParaTest/Runners/PHPUnit/Configuration.php#L34

These two points are our opportunity. I will look into creating a more complete Configuration\Suite object.

from paratest.

giorgiosironi avatar giorgiosironi commented on June 19, 2024

I agree with @adam-lynch in expecting a phpunit.xml[.dist] suffix attributes to work. If one of the goals of the project is transparency, it shouldn't be necessary to add new syntax (command line options) for features already supported by PHPUnit.

from paratest.

dbaltas avatar dbaltas commented on June 19, 2024

True that.
Parsing PHPUnit configuration would cause less confusion.
I am sure other people like Adam would expect a configuration set there simply to work.

When we get to the point where paratest supports other testing frameworks,
we can add this option in paratest. It would default to PHPUnit config when set.
Similar to what we did with the bootstrap file #34.

from paratest.

rusitschka avatar rusitschka commented on June 19, 2024

I'd also highly appreciate the PHPUnit configuration approach. Here's an example from one of our test suites:

    <testsuites>
        <testsuite name="all">
            <directory suffix="Test.php">test/application</directory>
            <directory suffix="SharedTest.php">../mzlib/test/application</directory>
        </testsuite>
    </testsuites>

The paths are interpreted correctly but the suffixes are currently ignored by paratest.

from paratest.

julianseeger avatar julianseeger commented on June 19, 2024

Thanks to @rusitschka this is finally implemented.

from paratest.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.