How to run PHPUnit Test from another directory - phpunit

I have a very straightforward PHPUnit test in c:\kim\test\HelloTest.php on a Windows PC. I can execute it from within the c:\kim\test directory with the command:
phpunit HelloTest
The problem is that I can't execute it from any other directory.
As far as I know I should be able to execute this from the c:\kim directory with:
phpunit test
Also, I would have thought the following syntax would work too:
phpunit c:\kim\test
But I don't get any response from the command. Simply a blank line and then I am returned to the cursor.
I am trying to get unit tests working properly with Netbeans and I think I need to solve this problem first. Perhaps it has something to do with paths? Any ideas?

I spent quite a while trying to sort this out, per the comments above. Also tried reinstalling PHPUnit. In the end I ran up a new server, installed XAMPP, and all works fine.

If any help.
I am using makegood extension for eclipse which handle phpunit test execution with one click.
Maybe you can find similar extension for Netbeans or switch to eclipse

Related

RobotFramework RIDE cannot import library

I have a file right here: Library ../../MyLib/My_Lib.py, and I try to import the python file in RIDE, but RIDE still report "FAIL : No keyword with name '****' found", and this keyword is defined in the My_Lib.py, seems RIDE cannot find the python file.
I using python 2.7.8+Robot Framework 3.1.2+windows server 2012r2. I even selected Library -> Name -> Browse in RIDE, but the error still there and this whole robot test case folder is copied from another server which is working fine
Can anyone suggest what have I missed?
Ah! I have worked this out, if anyone else meets the same issue, you can click Tools->view RIDE Log, to see what's happening there. For my case, it's because I didn't install thrift but the My_Lib.py obviously used thrift module, so the My_Lib.py compile failed with "No module named thrift.Thrift".
Is it possible the Python library was created to work with Python 3.x.x leading it to not work on your Python 2.7.8? See https://wiki.python.org/moin/Python2orPython3
Check what python version is being run on the other server where the test is running fine. You might need to update your local Python version.
Also, you could try running the Robot test outside of RIDE just in case. You may do so by navigating to the test folder where the .robot file resides and running the following command:
robot test_file_name.robot
See if you get the same error that way. Please report back after doing the mentioned checks and we can continue debugging, my reputation doesn't let me comment on your question so I will just update the answer as we go along.

PHPStorm 8 + PHPUnit 4.2.6 Error

I can't make PHPUnit 4.2.6 to work with PHPStorm 8.
PHPUnit is loaded as phar inside PHPStorm 8 settings.
Whenever i try to run unit test in PHPStorm i get this error:
Parse error: syntax error, unexpected '}' in /private/var/folders/qh/xjz1kr297v34pl6zy70_2rl00000gn/T/ide-phpunit.php(171) : eval()'d code on line 1
Call Stack:
0.0006 344584 1. {main}() /private/var/folders/qh/xjz1kr297v34pl6zy70_2rl00000gn/T/ide-phpunit.php:0
0.0007 344880 2. IDE_PHPUnit_Loader::init() /private/var/folders/qh/xjz1kr297v34pl6zy70_2rl00000gn/T/ide-phpunit.php:194
Warning: require_once(PHPUnit/Runner/Version.php): failed to open stream: No such file or directory in /private/var/folders/qh/xjz1kr297v34pl6zy70_2rl00000gn/T/ide-phpunit.php on line 49
When i looked into "ide-phpunit.php", i found that it tries to eval invalid code, because of invalid "substr" function usage.
So my question is, if someone managed to make PHPUnit 4.2.6 work with PHPStorm 8?
Here is how to "unhack" the IDE to run with phpnunit.phar (4x+) nicely on windows and linux!
Download phpunit.phar under php, set your phar location from the IDE -> settings -> phpunit and phar location. THEN CLOSE IDE
Find where your plugin files are, for php on windows this would be :\Program Files (x86)\JetBrains\PhpStorm 8.0.3\plugins\php\lib.
Open php.jar with winrar and open scripts/phpunit.php.
Comment out all PHPUnit/… require statements, so autoloader can do its job instead of using hardcoded values.
Go to public static function init() method.
Find the if section with a comment at the end says “awful hack”, screenshot.
Remove all the amateur hacky stuff and replace it with this, screenshot.
Save the file, Winrar will prompt you to save the archive, SAVE that one too.
Run IDE And Run your tests, coverage. Enjoy!
Hope this helps some of you out there. I will post the information to their forums as well.
I got the exact same error, and fixed it like this:
Installed phpunit using: composer global require phpunit/phpunit
Goto phpstorm settings: PHPUnit
Select "Use custom autoloader"
On Windows: C:\Users\[username]\AppData\Roaming\Composer\vendor\autoload.php
On Linux: /home/[username]/.composer/vendor/autoload.php
Or point it to the autoloader of your composer project
PhpStorm generates special temporary "wrapping" to execute the tests and get the output in the form it understands better. In your case it's /private/var/folders/qh/xjz1kr297v34pl6zy70_2rl00000gn/T/ide-phpunit.php. Since the error says there is a syntax error, the first thing you should try is deleting it, on the next run the IDE will create the new one, hopefully without that problem.
If that doesn't help, as suggested in the comments, try downgrading the PHPUnit a few versions back, see if that helps. Alternatively try reinstalling the PhpStorm. If that doesn't work, you have better chances of finding an answer by reporting an issue to the dev team.

Building Brackets Shell (After running the grunt build command)

On windows after running the grunt build command for creating brackets shell it gives done without errors but i dont see any .exe file generated..
What might be the problem???
Here are some possible solutions:
Are you following the full brackets-shell build instructions, including all prerequisites?
Make sure Brackets isn't running at the same time. The build will fail silently if the .exe file is currently in use (see bug).
Try with a fresh git clone of the repo. If your brackets-shell local copy has been around for a while, sometimes the build & deps folders can get in a bad state. (I'm assuming you haven't modified the source at all. If you have, try with an unmodified copy of the source first to make sure it builds correctly without any of your changes).
Check that python --version shows 2.7.x
Verbose build output would also be helpful in diagnosing issues like this, but unfortunately there's not yet an easy way to get that...
If you follow the instructions on bracket-shell's wiki page, the Windows executable should be created in the Release directory.

adobe brackets-shell : cef extract failed

I followed all the step is mention in given below url to build my project( I am using win7 OS).
https://github.com/adobe/brackets-shell/wiki/Building-brackets-shell.
actullly i want to create brackets installer (installed wix 3.7).
but i am getting cef-extract failed error.
even though i also used grunt cef-extract --force.
after that its throunging new error.
create -project failed after that i am not able to process further.
can some one help me.
thanks in advanced.
Regards
ashish .
If you include the exact console output you're seeing, it would be much easier to help you. But based on snags other people have encountered recently, you can try these things:
Make sure your PATH includes Python 2.7 (otherwise "create-project" will fail).
Delete all these folders to be sure you're starting from a clean slate: deps, Debug, include, libcef_dll, Release, Resources.
Just run the high-level tasks grunt setup and grunt build, following the Building brackets-shell instructions. (There's a known bug where grunt cef-extract fails when run standalone).

Jar file not executing

I am having a problem, I run my jar file but nothing happens, not even an error, it just returns to the cmd line where I started. the java code is ok because it works fine in netbeans on the machine i created it on, what is missing from the machine I am actually running it on? help please
If you are using javaw(java's "consoleless" version) instead of java and you print the answers with:
System.out.println(String stringToPrint);
or with
System.out.print(String stringToPrint);
You won't have anything printed on the screen because javaw won't print anything, so try execute it like this:
java -jar filename.jar
If this is not what you are looking for, sorry.

Resources