JUnit and Data Files [message #92758] |
Wed, 21 February 2007 21:15 |
Eclipse User |
|
|
|
Originally posted by: paulf.amered.com
I'm pretty new with TPTP and am working on some JUnit test cases for
Java code that operates on data files. The data files used for the test
have been added to my project containing the test. I figured it would be
a simple matter to copy these files to the working directory used for
the test suite and work on them, however, I can't find any way to get
the location of my project from the test case. It seems like properties
on the TextExecutionService might contain this information, however, I
don't see how to find an instance of one.
Any advice? I have my test working with a hard-coded path for now, but
I'd like to fix that.
Thanks,
Paul Fife
|
|
|
Re: JUnit and Data Files [message #92788 is a reply to message #92758] |
Thu, 22 February 2007 16:43 |
Eclipse User |
|
|
|
Originally posted by: cindyjin.ca.ibm.com
Hi Paul:
You can get it by System.getProperty("user.dir");. The files in your
classpath are deployed to the "ROOTDIR + USR_NAME". You can define these
two variables in the test suite's artifact.
The help doc is
http://help.eclipse.org/help32/topic/org.eclipse.hyades.test .doc.user/concepts/cjunitintro.htm
Hope it can help you.
Cindy
Paul Fife wrote:
> I'm pretty new with TPTP and am working on some JUnit test cases for
> Java code that operates on data files. The data files used for the test
> have been added to my project containing the test. I figured it would be
> a simple matter to copy these files to the working directory used for
> the test suite and work on them, however, I can't find any way to get
> the location of my project from the test case. It seems like properties
> on the TextExecutionService might contain this information, however, I
> don't see how to find an instance of one.
>
> Any advice? I have my test working with a hard-coded path for now, but
> I'd like to fix that.
>
> Thanks,
> Paul Fife
|
|
|
Re: JUnit and Data Files [message #92817 is a reply to message #92788] |
Thu, 22 February 2007 20:44 |
Eclipse User |
|
|
|
Originally posted by: paulf.amered.com
Thanks for the reply Cindy.
I'm not sure this helped me. I am not trying to locate the deployment
folder, I am trying to locate the project folder containing the test suite.
I am trying to move data files (note class files) to the deployment
folder from my project folder. These files are loaded by the code being
tested and can't be part of the class path since some of them are JAR
files containing classes. I am manually copying them over now using a
hard-coded path to my project, but this definitely isn't a good way to
be doing it. I'm hoping to find a way to either
- get them automatically deployed but not be in the class path, or
- to be able to discover the project folder path programatically at
runtime so I can manually copy the files to the deployment.
Thanks for any advice,
Paul Fife
Cindy Jin wrote:
> Hi Paul:
>
> You can get it by System.getProperty("user.dir");. The files in your
> classpath are deployed to the "ROOTDIR + USR_NAME". You can define these
> two variables in the test suite's artifact.
>
> The help doc is
> http://help.eclipse.org/help32/topic/org.eclipse.hyades.test .doc.user/concepts/cjunitintro.htm
>
>
> Hope it can help you.
>
> Cindy
>
> Paul Fife wrote:
>> I'm pretty new with TPTP and am working on some JUnit test cases for
>> Java code that operates on data files. The data files used for the
>> test have been added to my project containing the test. I figured it
>> would be a simple matter to copy these files to the working directory
>> used for the test suite and work on them, however, I can't find any
>> way to get the location of my project from the test case. It seems
>> like properties on the TextExecutionService might contain this
>> information, however, I don't see how to find an instance of one.
>>
>> Any advice? I have my test working with a hard-coded path for now, but
>> I'd like to fix that.
>>
>> Thanks,
>> Paul Fife
|
|
|
Re: JUnit and Data Files [message #92848 is a reply to message #92817] |
Fri, 23 February 2007 15:12 |
Eclipse User |
|
|
|
Originally posted by: cindyjin.ca.ibm.com
Hi Paul:
You can get the directory of remote deployment for your_plugin
String deployDir = System.getProperty("user.dir")+
System.getProperty("file.separator")+your_plugin_name.
Only files/folders/jars defined in classpath can be automatically deployed.
Thanks
Cindy
Paul Fife wrote:
> Thanks for the reply Cindy.
>
> I'm not sure this helped me. I am not trying to locate the deployment
> folder, I am trying to locate the project folder containing the test suite.
>
> I am trying to move data files (note class files) to the deployment
> folder from my project folder. These files are loaded by the code being
> tested and can't be part of the class path since some of them are JAR
> files containing classes. I am manually copying them over now using a
> hard-coded path to my project, but this definitely isn't a good way to
> be doing it. I'm hoping to find a way to either
> - get them automatically deployed but not be in the class path, or
> - to be able to discover the project folder path programatically at
> runtime so I can manually copy the files to the deployment.
>
> Thanks for any advice,
> Paul Fife
>
>
> Cindy Jin wrote:
>> Hi Paul:
>>
>> You can get it by System.getProperty("user.dir");. The files in your
>> classpath are deployed to the "ROOTDIR + USR_NAME". You can define
>> these two variables in the test suite's artifact.
>>
>> The help doc is
>> http://help.eclipse.org/help32/topic/org.eclipse.hyades.test .doc.user/concepts/cjunitintro.htm
>>
>>
>> Hope it can help you.
>>
>> Cindy
>>
>> Paul Fife wrote:
>>> I'm pretty new with TPTP and am working on some JUnit test cases for
>>> Java code that operates on data files. The data files used for the
>>> test have been added to my project containing the test. I figured it
>>> would be a simple matter to copy these files to the working directory
>>> used for the test suite and work on them, however, I can't find any
>>> way to get the location of my project from the test case. It seems
>>> like properties on the TextExecutionService might contain this
>>> information, however, I don't see how to find an instance of one.
>>>
>>> Any advice? I have my test working with a hard-coded path for now,
>>> but I'd like to fix that.
>>>
>>> Thanks,
>>> Paul Fife
|
|
|
Re: JUnit and Data Files [message #95771 is a reply to message #92758] |
Fri, 13 April 2007 11:59 |
Paul Slauenwhite Messages: 975 Registered: July 2009 |
Senior Member |
|
|
Hi Paul,
Have a look at the Deployment ground rules document in the TPTP Help
(Help >> Help Contents >> Testing applications >> Reference >> Deployment
ground rules). For files to be deployed with a test, they must be on the
classpath.
The TextExecutionService is specific to using the Automatable Services
Framework (ASF) for test execution. IF you using the TPTP UI for test
execution, the TextExecutionService is not used.
Paul
"Paul Fife" <paulf@amered.com> wrote in message
news:ericp7$ckv$1@utils.eclipse.org...
> I'm pretty new with TPTP and am working on some JUnit test cases for Java
> code that operates on data files. The data files used for the test have
> been added to my project containing the test. I figured it would be a
> simple matter to copy these files to the working directory used for the
> test suite and work on them, however, I can't find any way to get the
> location of my project from the test case. It seems like properties on the
> TextExecutionService might contain this information, however, I don't see
> how to find an instance of one.
>
> Any advice? I have my test working with a hard-coded path for now, but I'd
> like to fix that.
>
> Thanks,
> Paul Fife
|
|
|
Powered by
FUDForum. Page generated in 0.05009 seconds