Category — Eclipse
Running your Perl tests in Eclipse
As I keep dropping to a shell to run my tests I couldn’t help wonder if there was a way I could run them from my eclipse session. Of course you can, and its easy (I’m assuming Linux here):
So what I want to do is replicate this command in eclipse
prove -Ilib t/01_test.t
First setup an external tool: Run –>External Tools–>External Tools Configurations. You should see the following screen:

Right click the Program entry and choose New (if you dont see the Ant and program entries check the filters). You should now see the External Tool Configurations screen.

Location: Set this to the location of prove e.g.
/usr/bin/prove.
Working Directory: To set this to your project directory use the eclipse variable
${project_loc}
This will give you the absolute path to your project directory.
Arguments: This is where we can pass our arguments to prove. As I want to be able to run individual test files I use the eclipse variable ${resource_loc}. This gives me arguments of:
-Ilib ${resource_loc}
Now click Apply and Close. Select your .t file in the navigator view and click the external tools button
If all has gone well you should now see your test running in a console window at the bottom of your workspace.
If you need environment variables, such as DBIC_TRACE or CATALYST_CONFIG_LOCAL_SUFFIX then you can just add them to the Environment tab in the External Tool Configuration screen.
Happy testing!
p.s. You do write tests don’t you?
May 19, 2009 Comments Off