I'm trying to set up Eclipse to be able to debug PHPUnit tests. I'm trying to follow the instructions here. It says to set up a new Run Configuration, and choose PHP script, and the php file should be phpunit.php
My problem is, I can't find that file anywhere! Does the new version of PHPUnit not come with such a file? How else can you debug the unit tests?
Thanks
The file that the IDE is looking for is a single file that can run all the tests. One convention in the PHPUnit community is to call that file AllTests.php.
Kristian from Denmark explains this in an article that covers more than that.
Hope this helps!
Related
I use Karate as standalone JAR, and for writing scenarios I've installed Visual Source Code with the "karate-runner" plugin as IDE support.
I use an external jar for encryption treatments.
The trouble is that, when I execute a Karate scenario from Visual Source Code (for debuggig purpose), my external jar is not taken into account, and during execution, I get the message "java.lang.ClassNotFoundException: GenerateSign" in the console.
I've no problem when I launch the scenario directly in command line like :
Karate.bat mytest.feature
With the content of karate.bat is :
java -cp karate.jar;Sign.jar;. com.intuit.karate.Main %*
So, how to configure the tools in order to execute my karate scenarios from VScode taking into account my external jar too?
Thanks a lot.
I suspect the problem is you haven't updated the "karateCli" property in your launch.json debug configuration. Can you try to update it including your additional jar file and try again.
EDIT
Based on what command line does work in your batch file you should update your "Karate Runner" extensions settings as shown below in the images.
For running tests from Codelens with "Run Karate Test(s)"
For running tests with VSCode debugger
Maybe you simply are on the wrong version. Dir you try 0.9.5 ?
Here are the instructions: https://marketplace.visualstudio.com/items?itemName=kirkslota.karate-runner
For those coming across this in the future, you can use this as an additional reference: https://github.com/intuit/karate/wiki/Karate-Robot-Windows-Install-Guide
I have a java selenium QA project where we use ant and testng via the powershell terminal. What I would like help with is creating a redirect if a tester enters a typo in the terminal.
If I am in the run directory and I simply type ant, it will run the default.xml file listed in the build.xml file which is what I expect.
If I enter an actual ant command with a typo though:
ant -Dtestdir= c:\dev\qa\src\tests -Dtestxml=blablabla
it will attempt to run every test.xml file in the test directory. This is especially problematic because most of the those test.xml files call java classes that contain #Factory and #Dataprovider(s) and they allocate everything at once which just causes everything to fail.
What I would like is a way to tell ant if the input is erroneous, then run the default.xml file(which I have configured to populate an html error page). I've been reviewing both testng and ant docs and I'm not finding a solution, so your guidance would be appreciated.
Other than this one issue, the system works very well.
After digging around a bit more and learning how to ask the question properly, I found 2 great examples here on SO.
1) Create an additional ant target that checks for the existence of the file the user has typed. And add it to the depends attribute of the main target , and also adding the if attribute.
Example
2) Use the Ant fail task and fail the build (with a message) if the file is not available. I prefer this one because the tester can get some feedback.
Example 2
Alright, so just a disclaimer I suspect this question will be a duplicate of another question however I'm not even sure what to search for.
I have never used Eclipse or Golang before and am attempting to get a basic hello world application to work.
I have installed the goclipse plugin, created a new go package and go command source file. From what I have read to run a project in Eclipse you right click the package, select Run as then set the run configurations. The problem occurs when I attempt to select the go package as none shows up and if I leave it blank it throws a 'Go package not found' exception.
Thank you for any help you can provide.
EDIT: Upon the answers advice I have decided to go with the basic command line, however a friend did also recommend LiteIDE. I will "assume" tmichels answer is correct in regards to getting Go to work within eclipse.
If you don't use the GOPATH environment variable and you don't put your project folder under $GOPATH/src the compiler won't find it. As I see it goclipse lets you skip the GOPATH entirely but in this case you have to put your code under the src directory that you can see in the Project Explorer. See the related section of the goclipe documentation.
Although I think you make your life harder by using a full-fetched IDE for go development. Just use the command line tools. And it has the added benefit that you will actually understand what's going on (IDEs hide this from you).
So for building you can use go build or go install. The latter will copy the binary to your $GOPATH/bin directory. For running test just call go test or go test path/to/package. There is a hidden gem in the go tool: when you are working with multiple packages in the same directory you can use go test ./... to test all of them at once. This also works with other go commands.
When I create a controller with following through Zend_Tool
command:
create controller NameController
... netbeans creates a new controller successfully. BUT, it sends a message in the output window:
PHPUnit is required in order to generate controller test stubs.
How do I get Netbeans to automatically create a class with phpunit testing? I searched the net and thousands solutions so far not able to solve ...
Important Notes:
Have already installed the pear
Already installed phpunit
Already included 'phpunit' in the include_path
Has created a file and includes zf.ini too in the include_path
Options already configured netbeans, where I informed the directory phpunit.bat.
Is it a bug in NetBeans?
See:
I don't think it's so much a Neatbeans issue as it is a Zend_Tool (zf.bat) issue.
You are likely working with a project that was built by Zend_Tool before phpunit was installed properly.
In this case the portion or your .zfproject.xml does not have the required information to utilize phpunit.
Netbeans does not actually do anything with Zend_Tool other then to provide a graphical interface.
I wish I had a quick fix for this problem, but I don't. I have solved this in the past by:
Make sure phpunit is properly setup and working in Netbeans
Now you have 2 choices:
Remake your project directory with Zend_Tool and let the .zfproject.xml file be generated with a working phpunit.(This works well with new projects)
Make a new project with Zend_Tool, look at the .zfproject.xml with an editor and change the .zfproject.xml for your project to include the phpunit info. This method may take a bit of trial and error to get correct.
To be complete here is an excerpt from one of my .zfproject.xml files:
<testsDirectory>
<testPHPUnitConfigFile filesystemName="phpunit.xml"/>
<testPHPUnitBootstrapFile filesystemName="bootstrap.php"/>
<testApplicationDirectory>
<testApplicationControllerDirectory>
<testApplicationControllerFile forControllerName="Index"/>
</testApplicationControllerDirectory>
</testApplicationDirectory>
<testLibraryDirectory/>
</testsDirectory>
I haven't found a way to regenerate the .zfproject.xml file to reflect changes to the environment.
I hope someone else has an easier fix...
I found a solution.
In c:/user/you profile user/.zf.ini, the config file was like this:
php.include_path = ".C:/wamp/bin/php/php5.3.8/pear/PHPUnit;C:/Program Files/NetBeans 7.1/php/zend;C:/wamp/apps/ZendFramework/library"
basicloader.classes.0 = "NetBeansCommandsProvider"
I took the php.include_path, leaving the file as follows:
basicloader.classes.0 = "NetBeansCommandsProvider"
Well .. this is crazy and did not understand because it worked well for me.
NOTE: Please note that settings should already be set include_path in php.ini in the C:\wamp\bin\php\php5.3.8 and C:\wamp\bin\apache\Apache2.2.21\bin
Thanks to all!
I just installed a fresh setup of NetBeans 7.0.1 and the latest Xampp package. When I click Tools > Create Unit Tests on a file or class I get the following error in the output:
Could not open input file: .\pear\PHPUnit2\TextUI\TestRunner.php
This file is present and I can run the phpunit.bat from Explorer. I've wasted over an hour trying to find out why this is happening... Has anyone else had this problem?
Steve
The latest PHPUnit is 3.5.15. Version 2 is extremely old. While it does appear that NetBeans is at least seeing phpunit.bat, you might want to see if you have two versions of PHPUnit installed.
You can always try to update the paths and make them absolute instead of relative:
"C:\xampp\php\.\php.exe" ".\pear\PHPUnit2\TextUI\TestRunner.php" %*
to something like this, minding your own file structure of course.
"C:\xampp\php\php.exe" "C:\xampp\php\PEAR\PHPUnit2\TextUI\TestRunner.php" %*