You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by Supun Kamburugamuva <su...@gmail.com> on 2007/04/17 19:59:02 UTC

Need some help with running tests

Hi,

I got some problems while trying to run test cases.

1. When I try to run the tests using Ant build(ant test) I got the
following error.

"Could not create task or type of type:  junit.  Ant could not find
the task or a class this task relies upon."

I'm using ant-1.6.5.

2.  I have built an IntelliJ Idea project from the current SVN
checkout of the Velocity Engine. When I try to run some test cases I
got the following exception.

"org.apache.velocity.exception.ResourceNotFoundException: Unable to
find resource 'context_safety.vm' "

Same exception occurs for other test cases where external files are
required. Some test cases that don't use external files run correctly.

Cheers,
Supun.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@velocity.apache.org
For additional commands, e-mail: dev-help@velocity.apache.org


Re: Need some help with running tests

Posted by Will Glass-Husain <wg...@gmail.com>.
Glad that helped.  I've updated the release notes on the Wiki with a note
about this, and am adding the same to the "building" section in the docs.

WILL

On 4/18/07, Supun Kamburugamuva <su...@gmail.com> wrote:
>
> Hi,
>
> I have copied the Junit dll into the Ant lib directory and the problem
> is solved. I have also added the "ant – compile" generated
> TemplateTestBase to the source and now the tests are running ok.
> Thanks for the help.
>
> Cheers,
> Supun.
>
>
> On 4/17/07, Will Glass-Husain <wg...@gmail.com> wrote:
> > Hi Supun,
> >
> > There's a couple of quirks here.  Here's what I think the issue sare:
> >
> > (1) Ant can't find the junit jar for the junit task.  That's because it
> > doesn't look in the build classpath.  Solutions (a) Use ant 1.7 which
> solves
> > this problem or (b) copy junit.jar into the ant\lib library.
> >
> > Let us know if this helps.  If this solves the problem I'll add a note
> to
> > the documentation about this.
> >
> > (2) The test velocity files cannot be found.  The junit tests will not
> run
> > in an IDE without slight modifications.  The path to the test files is
> added
> > by an ant task.  Specifically, TemplateTestBase has constant fields
> which
> > define the path to the test files.  These have dummy values by default.
> > When you run "ant compile" the entire source tree is copied to a
> temporary
> > location and these values are filled in with the current path.  (note to
> > self: we really need to remove this annoying feature if possible).
> >
> > Again, two possible solutions.
> > * Manually edit this class to include the path to your Velocity source
> > tree.  Probably "." will work, though you might need an absolute
> path.  This
> > is the easiest approach, though we'll have to be careful not to commit
> this.
> >
> > OR (this is what I do).
> >
> > * Run "ant compile" which will create the alternate source tree.  Then
> > configure your IDE to use as the source tree (1) the standard java files
> (2)
> > the standard directory of java test files and (3) TemplateTestBase from
> > bin/test-src  (which has the filled in paths).  Credit to Henning for
> this
> > workaround.
> >
> > WILL
> >
> >
> > On 4/17/07, Supun Kamburugamuva <su...@gmail.com> wrote:
> > >
> > > Hi,
> > >
> > > I got some problems while trying to run test cases.
> > >
> > > 1. When I try to run the tests using Ant build(ant test) I got the
> > > following error.
> > >
> > > "Could not create task or type of type:  junit.  Ant could not find
> > > the task or a class this task relies upon."
> > >
> > > I'm using ant-1.6.5.
> > >
> > > 2.  I have built an IntelliJ Idea project from the current SVN
> > > checkout of the Velocity Engine. When I try to run some test cases I
> > > got the following exception.
> > >
> > > "org.apache.velocity.exception.ResourceNotFoundException: Unable to
> > > find resource 'context_safety.vm' "
> > >
> > > Same exception occurs for other test cases where external files are
> > > required. Some test cases that don't use external files run correctly.
> > >
> > > Cheers,
> > > Supun.
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: dev-unsubscribe@velocity.apache.org
> > > For additional commands, e-mail: dev-help@velocity.apache.org
> > >
> > >
> >
> >
> > --
> > Forio Business Simulations
> >
> > Will Glass-Husain
> > wglass@forio.com
> > www.forio.com
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@velocity.apache.org
> For additional commands, e-mail: dev-help@velocity.apache.org
>
>


-- 
Forio Business Simulations

Will Glass-Husain
wglass@forio.com
www.forio.com

Re: Need some help with running tests

Posted by Supun Kamburugamuva <su...@gmail.com>.
Hi,

I have copied the Junit dll into the Ant lib directory and the problem
is solved. I have also added the "ant – compile" generated
TemplateTestBase to the source and now the tests are running ok.
Thanks for the help.

Cheers,
Supun.


On 4/17/07, Will Glass-Husain <wg...@gmail.com> wrote:
> Hi Supun,
>
> There's a couple of quirks here.  Here's what I think the issue sare:
>
> (1) Ant can't find the junit jar for the junit task.  That's because it
> doesn't look in the build classpath.  Solutions (a) Use ant 1.7 which solves
> this problem or (b) copy junit.jar into the ant\lib library.
>
> Let us know if this helps.  If this solves the problem I'll add a note to
> the documentation about this.
>
> (2) The test velocity files cannot be found.  The junit tests will not run
> in an IDE without slight modifications.  The path to the test files is added
> by an ant task.  Specifically, TemplateTestBase has constant fields which
> define the path to the test files.  These have dummy values by default.
> When you run "ant compile" the entire source tree is copied to a temporary
> location and these values are filled in with the current path.  (note to
> self: we really need to remove this annoying feature if possible).
>
> Again, two possible solutions.
> * Manually edit this class to include the path to your Velocity source
> tree.  Probably "." will work, though you might need an absolute path.  This
> is the easiest approach, though we'll have to be careful not to commit this.
>
> OR (this is what I do).
>
> * Run "ant compile" which will create the alternate source tree.  Then
> configure your IDE to use as the source tree (1) the standard java files (2)
> the standard directory of java test files and (3) TemplateTestBase from
> bin/test-src  (which has the filled in paths).  Credit to Henning for this
> workaround.
>
> WILL
>
>
> On 4/17/07, Supun Kamburugamuva <su...@gmail.com> wrote:
> >
> > Hi,
> >
> > I got some problems while trying to run test cases.
> >
> > 1. When I try to run the tests using Ant build(ant test) I got the
> > following error.
> >
> > "Could not create task or type of type:  junit.  Ant could not find
> > the task or a class this task relies upon."
> >
> > I'm using ant-1.6.5.
> >
> > 2.  I have built an IntelliJ Idea project from the current SVN
> > checkout of the Velocity Engine. When I try to run some test cases I
> > got the following exception.
> >
> > "org.apache.velocity.exception.ResourceNotFoundException: Unable to
> > find resource 'context_safety.vm' "
> >
> > Same exception occurs for other test cases where external files are
> > required. Some test cases that don't use external files run correctly.
> >
> > Cheers,
> > Supun.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@velocity.apache.org
> > For additional commands, e-mail: dev-help@velocity.apache.org
> >
> >
>
>
> --
> Forio Business Simulations
>
> Will Glass-Husain
> wglass@forio.com
> www.forio.com
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@velocity.apache.org
For additional commands, e-mail: dev-help@velocity.apache.org


Re: Need some help with running tests

Posted by "Henning P. Schmiedehausen" <hp...@intermeta.de>.
"Will Glass-Husain" <wg...@gmail.com> writes:

>* Run "ant compile" which will create the alternate source tree.  Then
>configure your IDE to use as the source tree (1) the standard java files (2)
>the standard directory of java test files and (3) TemplateTestBase from
>bin/test-src  (which has the filled in paths).  Credit to Henning for this
>workaround.

In (2) you want to exclude TemplateTestBase.java from the source tree. 

Can we put this on a wiki page somewhere? "Running on IDE" or something?

	Best regards
		Henning

-- 
Henning P. Schmiedehausen  -- hps@intermeta.de | J2EE, Linux,               |gls
91054 Buckenhof, Germany   -- +49 9131 506540  | Apache person              |eau
Open Source Consulting, Development, Design    | Velocity - Turbine guy     |rwc
                                                                            |m k
INTERMETA - Gesellschaft fuer Mehrwertdienste mbH - RG Fuerth, HRB 7350     |a s
Sitz der Gesellschaft: Buckenhof. Geschaeftsfuehrer: Henning Schmiedehausen |n

	       "Save the cheerleader. Save the world."

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@velocity.apache.org
For additional commands, e-mail: dev-help@velocity.apache.org


Re: Need some help with running tests

Posted by Will Glass-Husain <wg...@gmail.com>.
Hi Supun,

There's a couple of quirks here.  Here's what I think the issue sare:

(1) Ant can't find the junit jar for the junit task.  That's because it
doesn't look in the build classpath.  Solutions (a) Use ant 1.7 which solves
this problem or (b) copy junit.jar into the ant\lib library.

Let us know if this helps.  If this solves the problem I'll add a note to
the documentation about this.

(2) The test velocity files cannot be found.  The junit tests will not run
in an IDE without slight modifications.  The path to the test files is added
by an ant task.  Specifically, TemplateTestBase has constant fields which
define the path to the test files.  These have dummy values by default.
When you run "ant compile" the entire source tree is copied to a temporary
location and these values are filled in with the current path.  (note to
self: we really need to remove this annoying feature if possible).

Again, two possible solutions.
* Manually edit this class to include the path to your Velocity source
tree.  Probably "." will work, though you might need an absolute path.  This
is the easiest approach, though we'll have to be careful not to commit this.

OR (this is what I do).

* Run "ant compile" which will create the alternate source tree.  Then
configure your IDE to use as the source tree (1) the standard java files (2)
the standard directory of java test files and (3) TemplateTestBase from
bin/test-src  (which has the filled in paths).  Credit to Henning for this
workaround.

WILL


On 4/17/07, Supun Kamburugamuva <su...@gmail.com> wrote:
>
> Hi,
>
> I got some problems while trying to run test cases.
>
> 1. When I try to run the tests using Ant build(ant test) I got the
> following error.
>
> "Could not create task or type of type:  junit.  Ant could not find
> the task or a class this task relies upon."
>
> I'm using ant-1.6.5.
>
> 2.  I have built an IntelliJ Idea project from the current SVN
> checkout of the Velocity Engine. When I try to run some test cases I
> got the following exception.
>
> "org.apache.velocity.exception.ResourceNotFoundException: Unable to
> find resource 'context_safety.vm' "
>
> Same exception occurs for other test cases where external files are
> required. Some test cases that don't use external files run correctly.
>
> Cheers,
> Supun.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@velocity.apache.org
> For additional commands, e-mail: dev-help@velocity.apache.org
>
>


-- 
Forio Business Simulations

Will Glass-Husain
wglass@forio.com
www.forio.com