This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 236355 - Run Test File or Run Test Project only run first test found
Summary: Run Test File or Run Test Project only run first test found
Status: VERIFIED FIXED
Alias: None
Product: php
Classification: Unclassified
Component: Atoum (show other bugs)
Version: 7.4
Hardware: PC Windows 7 x64
: P2 normal (vote)
Assignee: Tomas Mysik
URL:
Keywords:
: 236421 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-09-25 10:01 UTC by rebolon
Modified: 2013-11-14 13:48 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Full sample project to reproduce the bug (7.45 MB, application/octet-stream)
2013-09-25 12:21 UTC, rebolon
Details
NetBeans Log (33.69 KB, application/octet-stream)
2013-09-25 12:24 UTC, rebolon
Details
Full project with netbeans project files (7.45 MB, application/octet-stream)
2013-09-26 09:20 UTC, rebolon
Details
Screenshot of a Run Focused Test Method (161.66 KB, image/png)
2013-09-26 09:59 UTC, rebolon
Details

Note You need to log in before you can comment on or make changes to this bug.
Description rebolon 2013-09-25 10:01:33 UTC
In a project with some tests file using atoum. Each file has more than one test.
When i try to Run Test Project it only run first test of the first Test file.
When i try to Run Test on one File, it only rune first test of this file.

Here is output of atoum run one test file :

"C:\dev\php\5.4.20\php.exe" "C:\dev\library\mageekguy.atoum.phar" "-bf" "Z:\public\bundle-entity-membre\src\M6\Bundle\MembreEntityBundle\Tests\bootstrap.php" "-utr" "-f" "Z:\public\bundle-entity-membre\src\M6\Bundle\MembreEntityBundle\Tests\Units\Entity\Decorator\MembreJvfr.php"
1..4
ok 1
# M6\Bundle\MembreEntityBundle\Tests\Units\Entity\Decorator\MembreJvfr::testConstruct()
Done.

Content of the test file :

<?php

namespace myNS\Tests\Units\Entity\Decorator;

use myNS\Entity\Decorator\MembreJvfr as TestedClass;
use mageekguy\atoum\test;

/**
 * Test class for DecoratorMembreJvfr.
 */
class MembreJvfr extends test
{
    /**
     * Test getter and setter for idSite
     * 
     * test of the abstract class
     */
    public function testConstruct()
    {
        $this->if($entity = new \M6\Bundle\MembreEntityBundle\Entity\Membre)
            ->then($decorator = new TestedClass($entity))
            ->object($decorator->getDecorated())
            ->isEqualTo($entity);
    }

    /**
     * Test getter and setter for idSite
     * 
     * test of the abstract class
     */
    public function testGetterAndSetter()
    {
        $this->if($entity = new \M6\Bundle\MembreEntityBundle\Entity\Membre)
            ->then($decorator = new TestedClass())
            ->then($decorator->setDecorated($entity))
            ->then($decorator->setAppDomain('myDomain'))
            ->object($decorator->getDecorated())
            ->isEqualTo($entity)
            ->string($decorator->getAppDomain())
            ->isEqualTo('myDomain');
    }

    /**
     * Test getter and setter for idSite
     * 
     * test of the abstract class
     */
    public function testCall()
    {
        $this->if($entity = new \M6\Bundle\MembreEntityBundle\Entity\Membre)
            ->then($decorator = new TestedClass())
            ->then($decorator->setDecorated($entity))
            ->variable($decorator->getLogin())
            ->isNull()
            ->exception(function () use ($decorator) {
                $decorator->getRienDeRien();
            })
            ->isInstanceOf('\M6\Bundle\MembreEntityBundle\Exception\DecoratorMembreException');
    }

    /**
     * Return a Membre entity manager mock
     *
     * @return \mock\Doctrine\Common\Persistence\ObjectManager
     */
    private function getMembreEntityMock()
    {
        $mock = new \mock\M6\Bundle\MembreEntityBundle\Entity\Membre;

        $mock->getMockController()->getLogin = function() {
            return 'monLogin';
        };

        $mock->getMockController()->getId = function() {
            return 99;
        };

        return $mock;
    }

    /**
     * Test buildProfileUrl and buildAvatarUrl
     * 
     */
    public function testBuildUrl()
    {
        $this->if($entity = $this->getMembreEntityMock())
            ->then($decorator = new TestedClass())
            ->then($decorator->setDecorated($entity))
            ->then($decorator->setAppDomain('jeuxvideo.fr'))
            ->string($decorator->buildProfileUrl())
            ->isEqualTo('http://www.jeuxvideo.fr/forum/profil/monLogin-99/')
            ->string($decorator->buildAvatarUrl())
            ->isEqualTo('http://img.jeuxvideo.fr/photo/forum/00000/99/avatar.jpg');
    }
}


Here is output of atoum run profect test (there is 3 tests file) :
"C:\dev\php\5.4.20\php.exe" "C:\dev\library\mageekguy.atoum.phar" "-bf" "Z:\public\bundle-entity-membre\src\M6\Bundle\MembreEntityBundle\Tests\bootstrap.php" "-utr" "-d" "Z:\public\bundle-entity-membre\src\M6\Bundle\MembreEntityBundle\Tests"
1..7
ok 1
# M6\Bundle\MembreEntityBundle\Tests\Units\Entity\Decorator\MembreClubic::testBuildUrl()
Done.
Comment 1 rebolon 2013-09-25 10:07:40 UTC
More info : Here is the output of the specified command from netbeans directly wirtten in my cmd.exe :
"C:\dev\php\5.4.20\php.exe" "C:\dev\library\mageekguy.atoum.phar" "-bf" "Z:\public\bundle-entity-membre\src\M6\Bundle\MembreEntityBundle\Tests\bootstrap.php" "-utr" "-d" "Z:\public\bundle-entity-membre\src\M6\Bundle\MembreEntityBundle\Tests"

And this is what i should get in Netbeans:

PS C:\dev> C:\dev\php\5.4.20\php.exe C:\dev\library\mageekguy.atoum.phar -bf Z:\public\bundle-entity-membre\src\M6\Bundle\MembreEntityBundle\Tests\bootstrap.php -utr -d Z:\public\bundle-entity-membre\src\M6\Bundle\MembreEntityBundle\Tests
1..7
ok 1
# M6\Bundle\MembreEntityBundle\Tests\Units\Entity\Decorator\MembreClubic::testBuildUrl()
ok 2
# M6\Bundle\MembreEntityBundle\Tests\Units\Entity\Decorator\MembreJvfr::testConstruct()
ok 3
# M6\Bundle\MembreEntityBundle\Tests\Units\Entity\Decorator\MembreJvfr::testGetterAndSetter()
ok 4
# M6\Bundle\MembreEntityBundle\Tests\Units\Entity\Decorator\MembreJvfr::testCall()
ok 5
# M6\Bundle\MembreEntityBundle\Tests\Units\Entity\Decorator\MembreJvfr::testBuildUrl()
ok 6
# M6\Bundle\MembreEntityBundle\Tests\Units\Manager\MembreManager::testGetAndSetIdSite()
ok 7
# M6\Bundle\MembreEntityBundle\Tests\Units\Manager\MembreManager::testGetUserByUsernameException()
Comment 2 Tomas Mysik 2013-09-25 11:25:49 UTC
Please, which NetBeans version do you have (see Help > About)? Also, would it be possible to attach a sample project I can use? In order to fix this issue, I need a reproducible use case.

Thanks.
Comment 3 rebolon 2013-09-25 11:38:32 UTC
Product Version: NetBeans IDE 7.4 RC1 (Build 201309162201)

I'm going to create a light project to show the problem.
Comment 4 Tomas Mysik 2013-09-25 11:53:35 UTC
Also, please attach your IDE log [1] once this problem occurs.

Thanks.
[1] http://wiki.netbeans.org/FaqLogMessagesFile
Comment 5 rebolon 2013-09-25 12:21:54 UTC
Created attachment 140462 [details]
Full sample project to reproduce the bug

Here is the command line i launch in cmd.exe and the result i have:

C:\dev\php\5.4.20\php.exe C:\dev\library\mageekguy.atoum.phar -bf Z:\public\netbeansBug\src\MyBundle\Tests\bootstrap.php -utr -d Z:\public\netbeansBug\src\MyBundle\Tests
1..6
ok 1
# MyBundle\Tests\Units\Entity\Decorator\MembreSiteOne::testBuildUrl()
ok 2
# MyBundle\Tests\Units\Entity\Decorator\MembreSiteTwo::testConstruct()
ok 3
# MyBundle\Tests\Units\Entity\Decorator\MembreSiteTwo::testGetterAndSetter()
ok 4
# MyBundle\Tests\Units\Entity\Decorator\MembreSiteTwo::testCall()
ok 5
# MyBundle\Tests\Units\Entity\Decorator\MembreSiteTwo::testBuildUrl()
ok 6
# MyBundle\Tests\Units\Entity\MembreSiteThird::testBuildUrl()

In netbeans it fails

"C:\dev\php\5.4.20\php.exe" "Z:\public\netbeansBug\vendor\atoum\atoum\bin\atoum" "-bf" "Z:\public\netbeansBug\src\MyBundle\Tests\bootstrap.php" "-utr" "-d" "Z:\public\netbeansBug\src\MyBundle\Tests"
1..6
ok 1
# MyBundle\Tests\Units\Entity\Decorator\MembreSiteOne::testBuildUrl()
Done.


==================================
In NetBeans here is the config of the project :
source folder : Z:\public\netbeansBug
test folder : Z:\public\netbeansBug\src\MyBundle\Tests
PHP version : 5.4
Testing : atoum
Atoum bootstrap : Z:\public\netbeansBug\src\MyBundle\Tests\bootstrap.php

Here is the output of the Run Test Project : 
"C:\dev\php\5.4.20\php.exe" "Z:\public\netbeansBug\vendor\atoum\atoum\bin\atoum" "-bf" "Z:\public\netbeansBug\src\MyBundle\Tests\bootstrap.php" "-utr" "-d" "Z:\public\netbeansBug\src\MyBundle\Tests"
1..6
ok 1
# MyBundle\Tests\Units\Entity\Decorator\MembreSiteOne::testBuildUrl()
Done.
Comment 6 rebolon 2013-09-25 12:24:50 UTC
Created attachment 140463 [details]
NetBeans Log

Just after running a Run Test Project
Comment 7 Tomas Mysik 2013-09-26 05:34:59 UTC
Unfortunately, I cannot reproduce your problem in the current dev build, it works for me as expected (everytime, all 6 tests are run).

@mmolda: Milane, could you please try to reproduce on Windows? BTW the attached project is not a NetBeans project - see comment #5.

@reporter: Next time, please attach a NetBeans project so we can just open it. It eliminates possible mistakes in the project setup.

Thanks.

Product Version: NetBeans IDE Dev (Build 20130920-d00e99cb51c3)
Java: 1.7.0_40; Java HotSpot(TM) 64-Bit Server VM 24.0-b56
Runtime: Java(TM) SE Runtime Environment 1.7.0_40-b43
System: Linux version 3.8.0-27-generic running on amd64; UTF-8; cs_CZ (nb)
Comment 8 rebolon 2013-09-26 09:20:06 UTC
Created attachment 140496 [details]
Full project with netbeans project files
Comment 9 rebolon 2013-09-26 09:22:48 UTC
I've just uploaded the same source file with the netbeans project files inside to avoid any config problem. Hope it will help you.

I'm downloading the latest nighlyt build to check if the problem still happen.
Comment 10 Tomas Mysik 2013-09-26 09:44:40 UTC
I guess this could be OS dependent. Let's wait for Milan for verification on Windows.

Thanks.
Comment 11 rebolon 2013-09-26 09:59:00 UTC
Created attachment 140498 [details]
Screenshot of a Run Focused Test Method

Here is a screenshot to display the same kind of error :
i do a right-click on e test method and i choose Run Focused Test Method

in the output window i get the atoum output
in the "test results" window i get "No tests executed" so it doesn't identify how many tests has ran, how many has succed or failed.
Comment 12 Tomas Mysik 2013-09-26 10:21:34 UTC
Feel free to submit it as a new issue.

Thanks.
Comment 13 rebolon 2013-09-26 12:38:22 UTC
I installed this version of Netbeans : NetBeans IDE Dev (Build 201309260002)
It still fails. You can edit one test method and modify it to fail the test. Then run Test Project, and if it's not the first test to run, the output window won't detect the faileur because it stop after first test method found.
Comment 14 mmolda 2013-09-27 13:14:38 UTC
Hi,
I think there may be some problem in NetBeans. I tried last dev build and I have same output as reporter.

"C:\xampp\php\php.exe" "C:\xampp\php\mageekguy.atoum.phar" "-bf" "C:\xampp\htdocs\testBug\src\MyBundle\Tests\bootstrap.php" "-utr" "-d" "C:\xampp\htdocs\testBug\src\MyBundle\Tests"
1..6
ok 1
# MyBundle\Tests\Units\Entity\Decorator\MembreSiteOne::testBuildUrl()
Done.

When I try to run same command in cmd.exe I get the right result:

C:\xampp\php>php C:\xampp\php\mageekguy.atoum.phar -bf C:\xampp\htdocs\testBug\src\MyBundle\Tests\bootstrap.php -utr -d C:\xampp\htdocs\testBug\src\MyBundle\Tests
1..6
ok 1
# MyBundle\Tests\Units\Entity\Decorator\MembreSiteOne::testBuildUrl()
ok 2
# MyBundle\Tests\Units\Entity\Decorator\MembreSiteTwo::testConstruct()
ok 3
# MyBundle\Tests\Units\Entity\Decorator\MembreSiteTwo::testGetterAndSetter()
ok 4
# MyBundle\Tests\Units\Entity\Decorator\MembreSiteTwo::testCall()
ok 5
# MyBundle\Tests\Units\Entity\Decorator\MembreSiteTwo::testBuildUrl()
ok 6
# MyBundle\Tests\Units\Entity\MembreSiteThird::testBuildUrl()

I have downloaded latest Atoum version but it does not help.

Product Version: NetBeans IDE Dev (Build 201309270002)
Java: 1.7.0_45; Java HotSpot(TM) 64-Bit Server VM 24.45-b08
Runtime: Java(TM) SE Runtime Environment 1.7.0_45-b14
System: Windows 7 version 6.1 running on amd64; Cp1250; en_US (nb)
Comment 15 Tomas Mysik 2013-09-30 05:07:51 UTC
(In reply to Tomas Mysik from comment #10)
> I guess this could be OS dependent. Let's wait for Milan for verification on
> Windows.

So, it seems that I was right. I will try to investigate what could be done to fix it on Windows.

Thanks.
Comment 16 Tomas Mysik 2013-09-30 08:27:11 UTC
*** Bug 236421 has been marked as a duplicate of this bug. ***
Comment 17 Tomas Mysik 2013-09-30 09:03:37 UTC
Adding Petr to CC, he is the author of the external execution API so he could have an idea what we could try. Petře, the problem appears only on Windows and the likely cause is that atoum executable creates child processes which run tests in parallel.

Thanks.
Comment 18 Tomas Mysik 2013-09-30 13:43:08 UTC
Definitely a patch candidate for NB 7.4 Patch 1.
Comment 19 Tomas Mysik 2013-10-08 14:28:16 UTC
So, I hope that this issue should be fixed now. Could you please verify? Also Milan?

Thanks a lot Petře for your help!

http://hg.netbeans.org/web-main/rev/542329e4049a
Comment 20 Quality Engineering 2013-10-09 02:22:07 UTC
Integrated into 'main-silver', will be available in build *201310090001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/542329e4049a
User: Tomas Mysik <tmysik@netbeans.org>
Log: #236355 - Run Test File or Run Test Project only run first test found
Comment 21 mmolda 2013-10-09 12:32:26 UTC
Verified. All tests are executed.
Thanks.

Product Version: NetBeans IDE Dev (Build 201310090001)
Java: 1.7.0_45; Java HotSpot(TM) 64-Bit Server VM 24.45-b08
Runtime: Java(TM) SE Runtime Environment 1.7.0_45-b14
System: Windows 7 version 6.1 running on amd64; Cp1250; en_US (nb)
Comment 22 rebolon 2013-10-29 13:46:12 UTC
I've just installed official Netbeans 4 

Product Version: NetBeans IDE 7.4 (Build 201310111528)
Java: 1.7.0_25; Java HotSpot(TM) Client VM 23.25-b01
Runtime: Java(TM) SE Runtime Environment 1.7.0_25-b17
System: Windows 7 version 6.1 running on x86; Cp1252; fr_FR (nb)

And it fails again whereas on previous build it works well

Product Version: NetBeans IDE Dev (Build 201310110001)
Java: 1.7.0_25; Java HotSpot(TM) Client VM 23.25-b01
Runtime: Java(TM) SE Runtime Environment 1.7.0_25-b17
System: Windows 7 version 6.1 running on x86; Cp1252; fr_FR (nb)
Comment 23 mmolda 2013-10-29 13:57:14 UTC
Please do not reopen fixed issues. It is fixed and it is working in dev build. It is not in 7.4, but it will be in 7.4 patch 1.

You can test it in latest dev build [1]. Thanks

Product Version: NetBeans IDE Dev (Build 201310290001)
Java: 1.7.0_45; Java HotSpot(TM) Client VM 24.45-b08
Runtime: Java(TM) SE Runtime Environment 1.7.0_45-b18
System: Windows 7 version 6.1 running on x86; Cp1250; en_US (nb)

[1] http://bits.netbeans.org/dev/nightly/
Comment 24 Tomas Mysik 2013-10-29 14:03:40 UTC
@reporter: One can easily determine in which NetBeans version the fix will be available - see the Target Milestone field.

Thanks.
Comment 25 Tomas Mysik 2013-11-12 09:47:58 UTC
Transplanted to the releases repository, branch release74.

http://hg.netbeans.org/releases/rev/c95696372108
Comment 26 mmolda 2013-11-14 13:48:38 UTC
Verified.

Product Version: NetBeans IDE 7.4 (Build 201311141216)
Java: 1.8.0-ea; Java HotSpot(TM) 64-Bit Server VM 25.0-b50
Runtime: Java(TM) SE Runtime Environment 1.8.0-ea-b108
System: Windows 7 version 6.1 running on amd64; Cp1250; en_US (nb)