Giter VIP home page Giter VIP logo

Comments (17)

brianium avatar brianium commented on September 21, 2024

Mind sharing what OS you are on and the exact command you are using?

from paratest.

julianseeger avatar julianseeger commented on September 21, 2024

I observed the issue with blocking tests when executing a single TestCase (1 class) with paratest. Multiple classes are executed parallel.

from paratest.

brianium avatar brianium commented on September 21, 2024

Just to double check, are you guys using the functional option (-f)? -f informs paratest to run each method in parallel rather than each class. This option was designed for selenium tests.

from paratest.

khards avatar khards commented on September 21, 2024

@brianium - I am using Windows 7, I am also using the -f option.

The TestCase is a single class that inherits about one hundred different tests. I was expecting patatest to execute the testXXX functions within the file in parallel.
I used Zend Debugger to step throught the code and the tests are queued up correctly, but when they executed they block - from memory it was blocking reading the executing status from the pipe.

from paratest.

brianium avatar brianium commented on September 21, 2024

Hmmm.. Seems like it might be a windows issue with proc_open. Any way you can share your tests?

from paratest.

khards avatar khards commented on September 21, 2024

I have an update to this issue. I spent sometime yesterday attemting to debug the issue, so today I have made a clean install of patatest using compose (about 30 mins ago).
I have also made a fairly simple test case.

The test are now failing upon execution. As you can see, they execute successfully using phpunit.

c:\temp\paratest>phpunit myParaTest.php
PHPUnit 3.7.31 by Sebastian Bergmann.

..........

Time: 1.03 minutes, Memory: 4.00Mb

OK (10 tests, 10 assertions)
c:\temp\paratest>vendor\bin\paratest.bat -f myParaTest.php

Running phpunit in 5 processes with C:\temp\paratest\vendor\bin\phpunit.bat. Functional mode is on

Catchable fatal error: Argument 1 passed to ParaTest\Logging\JUnit\TestSuite::suiteFromNode() must be an instance of SimpleXMLElement, boolean given, called in C:\temp\paratest\vendor\brianium\parates
t\src\ParaTest\Logging\JUnit\Reader.php on line 193 and defined in C:\temp\paratest\vendor\brianium\paratest\src\ParaTest\Logging\JUnit\TestSuite.php on line 105

from paratest.

brianium avatar brianium commented on September 21, 2024

Mind sharing your test case so I can try to reproduce?

from paratest.

khards avatar khards commented on September 21, 2024

One second, I am just making it as as small as feasible.

from paratest.

khards avatar khards commented on September 21, 2024
<?php

require "driver/lib/__init__.php";

class SeleniumConfiguration {
    const closeBrowser = true;
    const defaultHost = 'http://localhost:4444/wd/hub';
    const timeout_in_ms = 4000;
    const browser = 'chrome';
}

class SeleniumTestCase extends PHPUnit_Framework_TestCase {

    public static function setUpBeforeClass() {

        class_alias('SeleniumConfiguration', 'config');

        $capabilities = array();
        $capabilities[WebDriverCapabilityType::BROWSER_NAME] = config::browser;

        self::$session = RemoteWebDriver::create(
                config::defaultHost, 
                $capabilities, 
                config::timeout_in_ms);
    }

    public static function tearDownAfterClass() {
        if (config::closeBrowser) {
            self::$session->close();
        }
    }

    protected static $session;

    protected function openAny($url) {
        self::$session->get($url);
    }

    protected function xpath($path) {
        return self::$session->findElement(WebDriverBy::xpath($path));
    }

    protected function wait($seconds = 5) {
        sleep($seconds);
    }


    /***************************/


    const middleDotChar = "\xc2\xb7";

    public function testA() {
        $this->doSameTest();
    }
    public function testB() {
        $this->doSameTest();
    }
    public function testC() {
        $this->doSameTest();
    }
    public function testD() {
        $this->doSameTest();
    }


    function doSameTest() {
        $this->openAny('https://www.google.co.uk/?gl=us#q=paratest');
        sleep(5);
        $heading = $this->xpath("//a[contains(text(), 'brianium/')]");
        $this->assertEquals('brianium/paratest '.self::middleDotChar.' GitHub', $heading->getText(), 'Anchor text does not match');
    }

}

The above tests are working correctly with phpunit and selenium.

from paratest.

khards avatar khards commented on September 21, 2024

require "driver/lib/init.php";

Refers to RemoteWebdriver: https://code.google.com/p/selenium/wiki/RemoteWebDriver

I have tried again without the RemoteWebdriver.

class SeleniumTestCase extends PHPUnit_Framework_TestCase {

    public static function setUpBeforeClass() {
    }

    public static function tearDownAfterClass() {
    }

    public function testA() {
        $this->doSameTest();
    }
    public function testB() {
        $this->doSameTest();
    }
    public function testC() {
        $this->doSameTest();
    }
    public function testD() {
        $this->doSameTest();
    }

    function doSameTest() {
        sleep(5);
    }
}

The above code results in:

Running phpunit in 5 processes with C:\temp\paratest\vendor\bin\phpunit.bat. Functional mode is on


Catchable fatal error: Argument 1 passed to ParaTest\Logging\JUnit\TestSuite::suiteFromNode() must be an instance of SimpleXMLElement, boolean given, called in C:\temp\paratest\vendor\brianium\parates
t\src\ParaTest\Logging\JUnit\Reader.php on line 193 and defined in C:\temp\paratest\vendor\brianium\paratest\src\ParaTest\Logging\JUnit\TestSuite.php on line 105

from paratest.

khards avatar khards commented on September 21, 2024

The error in ParaTest\Logging\JUnit\TestSuite::suiteFromNode() is due to the log file being empty

<?xml version="1.0" encoding="UTF-8"?>
<testsuites/>

from paratest.

brianium avatar brianium commented on September 21, 2024

That usually means a process crashed.

from paratest.

khards avatar khards commented on September 21, 2024

OK, I have resolved that issue - it's the same one I encountered yesterday, so I should have remembered!

File: brianium\paratest\src\ParaTest\Runners\PHPUnit\TestMethod.php

protected function prepareOptions($options)
{
    $options['filter'] = sprintf("'/\b%s\b/'", $this->name);
    return $options;
}

phpunit on windows will not accept /\b \b/ in the filer, removing this resolves the error.

protected function prepareOptions($options)
{
    $options['filter'] = sprintf("'%s'", $this->name);
    return $options;
}

from paratest.

khards avatar khards commented on September 21, 2024

A did a little more digging on this issue over the weekend and it appears to be a bug in the Symphony Process module.

[Process] Process::start is blocking on windows #9755: symfony/symfony#9755

It is related to this PHP bug: https://bugs.php.net/bug.php?id=51800

from paratest.

julianseeger avatar julianseeger commented on September 21, 2024

symfony/symfony#9755 has been fixed and merged into 2.3.
@khards can you verify that paratest works correctly on windows now?

from paratest.

grangeway avatar grangeway commented on September 21, 2024

Downloaded for first time today, trying to run the example from your instructions and getting what appears to be this issue. Assuming that 'merged into 2.3' refers to symfony\Component\Process, I've looked changelog for this shows version 2.4

vendor\bin\paratest.bat -p 2 -f --phpunit=vendor\bin\phpunit.bat WebDriverDemo.php

Running phpunit in 2 processes with vendor\bin\phpunit.bat. Functional mode is on

PHP Catchable fatal error: Argument 1 passed to ParaTest\Logging\JUnit\TestSuite::suiteFromNode() must be an instance of SimpleXMLElement, boolean given, called in vendor\brianium\paratest\src\ParaTest\Logging\JUnit\Reader.php on line 193 and defined in vendor\brianium\paratest\src\ParaTest\Logging\JUnit\TestSuite.php on line 105

from paratest.

github-actions avatar github-actions commented on September 21, 2024

This issue has gone two months without activity. In another two weeks, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you label it Backlog or In Progress, I will leave it alone ... forever!

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.