You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by aidy lewis <ai...@googlemail.com> on 2007/06/20 17:41:55 UTC
Data driven testing
Data driven testing
Sander's sent me some ideas off-line, but I am enountering a few problems.
This is my spike set up:
Test Plan
User Defined Variables
name=datafile value=C:\all_data.csv
User Parameters
name=execute user1=${_CSVRead(${datafile},0)}
name=testcase user1=${_CSVRead(${datafile},1)}
name=testdescription user1=${_CSVRead(${datafile},2)}
If controller
condition=${execute} == 'Y'
BeanShell PreProcessor
print(${testcase});
print(${testdescription});
The data file contents are these
Execute, testcase, testdescription
Y, a_test, a_description
The problems I am encountering are that:
1) The BeanShell PreProcessor is not printing out the testcase and the
testdescription.
2) The test execution seems to hang
Thanks
Aidy
---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
Re: Data driven testing
Posted by aidy lewis <ai...@googlemail.com>.
Sebb
> print("${testcase}");
Thanks
I will hide in a corner of shame now,
Aidy
---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
Re: Data driven testing
Posted by sebb <se...@gmail.com>.
On 20/06/07, aidy lewis <ai...@googlemail.com> wrote:
> Hi,
>
> The data from the csv data file = 'test1'
>
> BeanShell preprocessor
> print('${testcase}');
Java requires strings to be in double-quotes:
print("${testcase}");
>
> The errors I receive are:
>
> at java.lang.Thread.run(Thread.java:595)
> Caused by: Sourced file: inline evaluation of: ``print('test1');''
> Token Parsing Error: Lexical error at line 1, column 9. Encountered:
> "e" (101), after : "\'t": <at unknown location>
>
> 2007/06/20 20:28:30 WARN - jmeter.modifiers.BeanShellPreProcessor:
> Problem in BeanShell script org.apache.jorphan.util.JMeterException:
> Error invoking bsh method eval
>
> Thanks
>
> Aidy
>
> ---------------------------------------------------------------------
> 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: Data driven testing
Posted by aidy lewis <ai...@googlemail.com>.
Hi,
The data from the csv data file = 'test1'
BeanShell preprocessor
print('${testcase}');
The errors I receive are:
at java.lang.Thread.run(Thread.java:595)
Caused by: Sourced file: inline evaluation of: ``print('test1');''
Token Parsing Error: Lexical error at line 1, column 9. Encountered:
"e" (101), after : "\'t": <at unknown location>
2007/06/20 20:28:30 WARN - jmeter.modifiers.BeanShellPreProcessor:
Problem in BeanShell script org.apache.jorphan.util.JMeterException:
Error invoking bsh method eval
Thanks
Aidy
---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
Re: Data driven testing
Posted by aidy lewis <ai...@googlemail.com>.
Hi Sebb,
> What are you trying to achieve?
I am load testing a fairly simple application. I have 30-40 scripts to
write.I was thinking of writing 1 script and using if controllers when
reading in csv test data to cover all scenarios. I was also thinking
of logging relevant information to a file through the BeanShell.
Aidy
---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
Re: Data driven testing
Posted by sebb <se...@gmail.com>.
Pre-Processors require a sampler or they won't be run. Likewise
Post-Processors and timers.
What are you trying to achieve?
On 20/06/07, aidy lewis <ai...@googlemail.com> wrote:
> Hi,
>
> I am still having problems printing a global when reading a csv using
> a BeanShell pre-processor. The BeanShell jar is in the lib directory.
>
---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
Re: Data driven testing
Posted by aidy lewis <ai...@googlemail.com>.
Hi,
I am still having problems printing a global when reading a csv using
a BeanShell pre-processor. The BeanShell jar is in the lib directory.
<jmeterTestPlan version="1.2" properties="1.8">
<hashTree>
<TestPlan guiclass="TestPlanGui" testclass="TestPlan"
testname="ALL_VIA_Tests" enabled="true">
<collectionProp name="TestPlan.thread_groups"/>
<elementProp name="TestPlan.user_defined_variables"
elementType="Arguments" guiclass="ArgumentsPanel"
testclass="Arguments" testname="User Defined Variables"
enabled="true">
<collectionProp name="Arguments.arguments"/>
</elementProp>
<stringProp name="TestPlan.user_define_classpath"></stringProp>
<boolProp name="TestPlan.serialize_threadgroups">true</boolProp>
<boolProp name="TestPlan.functional_mode">false</boolProp>
<stringProp name="TestPlan.comments"></stringProp>
</TestPlan>
<hashTree>
<ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup"
testname="Thread Group" enabled="true">
<longProp name="ThreadGroup.start_time">1182362026000</longProp>
<stringProp name="ThreadGroup.delay"></stringProp>
<stringProp name="ThreadGroup.duration"></stringProp>
<stringProp name="ThreadGroup.num_threads">1</stringProp>
<boolProp name="ThreadGroup.scheduler">false</boolProp>
<elementProp name="ThreadGroup.main_controller"
elementType="LoopController" guiclass="LoopControlPanel"
testclass="LoopController" testname="Loop Controller" enabled="true">
<stringProp name="LoopController.loops">1</stringProp>
<boolProp name="LoopController.continue_forever">false</boolProp>
</elementProp>
<longProp name="ThreadGroup.end_time">1182362026000</longProp>
<stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
<stringProp name="ThreadGroup.ramp_time">1</stringProp>
</ThreadGroup>
<hashTree>
<BeanShellPreProcessor guiclass="TestBeanGUI"
testclass="BeanShellPreProcessor" testname="BeanShell PreProcessor"
enabled="true">
<stringProp name="script">print(${testcase});</stringProp>
</BeanShellPreProcessor>
<hashTree/>
</hashTree>
<CSVDataSet guiclass="TestBeanGUI" testclass="CSVDataSet"
testname="CSV Data Set Config" enabled="true">
<stringProp name="delimiter">,</stringProp>
<stringProp name="variableNames">testcase,testdescription</stringProp>
<boolProp name="recycle">true</boolProp>
<stringProp name="filename">C:\all_data.csv</stringProp>
</CSVDataSet>
<hashTree/>
</hashTree>
</hashTree>
</jmeterTestPlan>
the csv 'C:\all_data.csv' contains
test1,a test
Thanks for your help
Aidy
---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
Re: Data driven testing
Posted by sebb <se...@gmail.com>.
On 20/06/07, aidy lewis <ai...@googlemail.com> wrote:
> Data driven testing
>
> Sander's sent me some ideas off-line, but I am enountering a few problems.
>
> This is my spike set up:
>
> Test Plan
>
> User Defined Variables
> name=datafile value=C:\all_data.csv
>
> User Parameters
> name=execute user1=${_CSVRead(${datafile},0)}
> name=testcase user1=${_CSVRead(${datafile},1)}
> name=testdescription user1=${_CSVRead(${datafile},2)}
You need to add ${_CSVRead(${datafile},next)} to the last variable
(or use a dummy variable)
Better would be to use CSV DataSet.
> If controller
> condition=${execute} == 'Y'
That's not valid Javascript; try
condition: ${execute}' == 'Y'
> BeanShell PreProcessor
> print(${testcase});
> print(${testdescription});
>
>
>
> The data file contents are these
>
> Execute, testcase, testdescription
> Y, a_test, a_description
Spaces are not removed...
>
> The problems I am encountering are that:
>
> 1) The BeanShell PreProcessor is not printing out the testcase and the
> testdescription.
These will appear in the console window.
> 2) The test execution seems to hang
Check jmeter.log
> Thanks
>
> Aidy
>
> ---------------------------------------------------------------------
> 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