You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Marco Pas <ma...@gmail.com> on 2009/09/09 14:21:24 UTC

Help in getting relative path for sending datafile

Hi there, i am using a hardcoded directory inside a test that succesfully
send the contents via a http request. Now i want to get rid of the hardcoded
directory and am searching for a way on how to get the current directory
from the current executing tests.

Any relative paths i tried seem not to work.

My test in in a directory called testplans and so is my file that i want to
upload. When loading the test via the gui i tried several relative path
settings but the test is unable to find the file i want to send.

directory: testcases contains the testplan and import .txt file so i tried
to use ../import.txt ./import.txt and just plain import.txt so far no
succes..

Is there any way using beanshell or whatever to retrieve the current
directory of the testplan that is executing?

Greetings marco

Re: Help in getting relative path for sending datafile

Posted by sebb <se...@gmail.com>.
In that case, I don't see how you can use a fixed relative path unless
you mimic what the buildserver does.

Nor does it seem possible to calculate the relative path at run-time
unless you know the absolute paths of both the file and the JMeter
starting directory.

However, you should be able to use a variable relative (or absolute)
path (using a property).

You can default this for the buildserver, and override it on the
command-line otherwise.

E.g. on the test plan

DATADIR      ${__P(datadir,../testdir/)}

on the command-line:

jmeter -Jdatadir=../../x/testdir ...

and in the test plan sampler:

${DATADIR}import.txt

On 09/09/2009, Marco Pas <ma...@gmail.com> wrote:
> Could be a solution, but the testcases are also used and started by our
>  buildserver. As far as i know i can not influence the startingpoint of that.
>
>  2009/9/9 sebb <se...@gmail.com>
>
>
>  > On 09/09/2009, Marco Pas <ma...@gmail.com> wrote:
>  > > Hi there, i am using a hardcoded directory inside a test that succesfully
>  > >  send the contents via a http request. Now i want to get rid of the
>  > hardcoded
>  > >  directory and am searching for a way on how to get the current directory
>  > >  from the current executing tests.
>  > >
>  > >  Any relative paths i tried seem not to work.
>  > >
>  > >  My test in in a directory called testplans and so is my file that i want
>  > to
>  > >  upload. When loading the test via the gui i tried several relative path
>  > >  settings but the test is unable to find the file i want to send.
>  > >
>  > >  directory: testcases contains the testplan and import .txt file so i
>  > tried
>  > >  to use ../import.txt ./import.txt and just plain import.txt so far no
>  > >  succes..
>  > >
>  > >  Is there any way using beanshell or whatever to retrieve the current
>  > >  directory of the testplan that is executing?
>  >
>  > Just start JMeter in the testcases directory.
>  >
>  > >  Greetings marco
>  > >
>  >
>
> > ---------------------------------------------------------------------
>  > To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>  > For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>  >
>  >
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: Help in getting relative path for sending datafile

Posted by Marco Pas <ma...@gmail.com>.
Could be a solution, but the testcases are also used and started by our
buildserver. As far as i know i can not influence the startingpoint of that.

2009/9/9 sebb <se...@gmail.com>

> On 09/09/2009, Marco Pas <ma...@gmail.com> wrote:
> > Hi there, i am using a hardcoded directory inside a test that succesfully
> >  send the contents via a http request. Now i want to get rid of the
> hardcoded
> >  directory and am searching for a way on how to get the current directory
> >  from the current executing tests.
> >
> >  Any relative paths i tried seem not to work.
> >
> >  My test in in a directory called testplans and so is my file that i want
> to
> >  upload. When loading the test via the gui i tried several relative path
> >  settings but the test is unable to find the file i want to send.
> >
> >  directory: testcases contains the testplan and import .txt file so i
> tried
> >  to use ../import.txt ./import.txt and just plain import.txt so far no
> >  succes..
> >
> >  Is there any way using beanshell or whatever to retrieve the current
> >  directory of the testplan that is executing?
>
> Just start JMeter in the testcases directory.
>
> >  Greetings marco
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>

Re: Help in getting relative path for sending datafile

Posted by sebb <se...@gmail.com>.
On 09/09/2009, Marco Pas <ma...@gmail.com> wrote:
> Hi there, i am using a hardcoded directory inside a test that succesfully
>  send the contents via a http request. Now i want to get rid of the hardcoded
>  directory and am searching for a way on how to get the current directory
>  from the current executing tests.
>
>  Any relative paths i tried seem not to work.
>
>  My test in in a directory called testplans and so is my file that i want to
>  upload. When loading the test via the gui i tried several relative path
>  settings but the test is unable to find the file i want to send.
>
>  directory: testcases contains the testplan and import .txt file so i tried
>  to use ../import.txt ./import.txt and just plain import.txt so far no
>  succes..
>
>  Is there any way using beanshell or whatever to retrieve the current
>  directory of the testplan that is executing?

Just start JMeter in the testcases directory.

>  Greetings marco
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org