In 5/20/05, Stephan Wiesner <[EMAIL PROTECTED]> wrote:
> I tried that by adding it to the jmeter.bat file (last line):
> %JM_START% %JM_LAUNCH% %JVM_ARGS% %ARGS% -jar ApacheJMeter.jar
> -Dtoday="`date`" %JMETER_CMD_LINE_ARGS%
>
> The variable is just printed as ${today} when using it as a form parameter
> and running a test, though. User defined variables in JMeter work, though.
> Can anybody tell me what I did wrong?
>
Yes - nothing ...
Sorry, my mistake - you need to use one of the property functions to
refer to it.
For example:
${__P(today)}
BTW, no need to edit jmeter.bat - you can pass parameters to it.
Seems you are using DOS - you cannot use `date` to get the date.
Short of writing a program, I think it's very tricky to automatically
get the date in DOS.
But for test purposes, you can of course do it manually:
jmeter -Dtoday=20050520 -n -t testplan.jmx
This will run the test plan in non-GUI mode with output to testplan.jtl
S.
> Stephan
>
> -----Urspr�ngliche Nachricht-----
> Von: sebb [mailto:[EMAIL PROTECTED]
> Gesendet: Freitag, 20. Mai 2005 01:05
> An: JMeter Users List
> Betreff: Re: way to get current date into a variable?
>
>
> On 5/19/05, Seth Ladd <[EMAIL PROTECTED]> wrote:
> > Hello,
> >
> > I searched the FAQs and manual, but couldn't find this answer.
> >
> > Is there a way to get the current date into reference name? I need to
> > set some input fields to "today".
> >
>
> Yes, several methods. All rely on functions.
>
> 1) Get the date from the OS, and set a property on the command line
> with the value, then use one of the property functions to retrieve it.
> E.g.
> jmeter -Dtoday="`date`"
> Then refer to it as ${today}
>
> 2) Use the JavaScript function to create a suitable date string, e.g.
> ${__javaScript(new Date(),Dummy)}
>
> 3) Use the BeanShell function to create a suitable date string e.g.
> ${__BeanShell(new java.util.Date())}
>
> You'll need to adjust the format.
>
> S.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]