Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » ServerTools (WTP) » Strategy for unit testing web applications
Strategy for unit testing web applications [message #179012] Wed, 13 September 2006 09:34 Go to next message
Eclipse UserFriend
Originally posted by: gert.anova.be

L.S.,

We just started to use WTP for web application development and were
wondering about how to unit test these applications. You can have a
separate source folder for the unit tests, as you can have in any
regular Java project. However, the Java test classes are also getting
included in the WAR file. It's even worse if you have unit tests using
a dummy (HyperSonic or Derby) database instead of the production
database, as we do.

Is there a way to exclude the classes from some source folders from the
resulting WAR file? Or do we need to create a separate project to hold
the unit test for the war file?

Regards,

Gert Vanthienen
gert@anova.be
Re: Strategy for unit testing web applications [message #179029 is a reply to message #179012] Wed, 13 September 2006 12:55 Go to previous messageGo to next message
Larry Isaacs is currently offline Larry IsaacsFriend
Messages: 1354
Registered: July 2009
Senior Member
Assuming you also specified a separate output folder for the unit test
source folder, you may also need to open the
"org.eclipse.wst.common.component" file in the project's ".settings"
folder and remove the <wb-resouce> element that is referencing your unit
test folder as its "source-path". This should keep these classes from
being included in the web application, and thus the WAR file.

Cheers,
Larry

Gert Vanthienen wrote:
> L.S.,
>
> We just started to use WTP for web application development and were
> wondering about how to unit test these applications. You can have a
> separate source folder for the unit tests, as you can have in any
> regular Java project. However, the Java test classes are also getting
> included in the WAR file. It's even worse if you have unit tests using
> a dummy (HyperSonic or Derby) database instead of the production
> database, as we do.
>
> Is there a way to exclude the classes from some source folders from the
> resulting WAR file? Or do we need to create a separate project to hold
> the unit test for the war file?
>
> Regards,
>
> Gert Vanthienen
> gert@anova.be
Re: Strategy for unit testing web applications [message #179037 is a reply to message #179029] Wed, 13 September 2006 13:13 Go to previous message
Eclipse UserFriend
Originally posted by: gert.anova.be

Larry,

In fact I hadn't specified a separate output folder for the unit tests.
After doing this and changing the order of the source folders in
'Order and export', everything works fine!

Thanks for helping us out with this,

Gert Vanthienen
gert@anova.be


Larry Isaacs wrote:
> Assuming you also specified a separate output folder for the unit test
> source folder, you may also need to open the
> "org.eclipse.wst.common.component" file in the project's ".settings"
> folder and remove the <wb-resouce> element that is referencing your unit
> test folder as its "source-path". This should keep these classes from
> being included in the web application, and thus the WAR file.
>
> Cheers,
> Larry
>
> Gert Vanthienen wrote:
>> L.S.,
>>
>> We just started to use WTP for web application development and were
>> wondering about how to unit test these applications. You can have a
>> separate source folder for the unit tests, as you can have in any
>> regular Java project. However, the Java test classes are also getting
>> included in the WAR file. It's even worse if you have unit tests
>> using a dummy (HyperSonic or Derby) database instead of the production
>> database, as we do.
>>
>> Is there a way to exclude the classes from some source folders from
>> the resulting WAR file? Or do we need to create a separate project to
>> hold the unit test for the war file?
>>
>> Regards,
>>
>> Gert Vanthienen
>> gert@anova.be
Previous Topic:[Web Services] A way to add a new runtime
Next Topic:ERROR: unable to retrieve remote reference
Goto Forum:
  


Current Time: Thu Apr 25 08:45:09 GMT 2024

Powered by FUDForum. Page generated in 0.03403 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top