Philip Aston | 1 Apr 2007 14:35

Re: Repeated Concurrent script execution from a particular http request

dhinakar k wrote:
> Hi Grinder Users,
>  
> I am sure the subject that I have put is a little bit confusing. 
> Actually the requirement is like this,
>  
> Scenario :- Login -> Click on a tab -> Search for an item
>  
> 1. At first, say 10 concurrent users will login and do 'Click on a 
> tab' & 'Search for an item'
> 2. After the end of first iteration the same 10 concurrent users will 
> start 2nd iteration and but 'Click on a tab' and do the 'Search for an 
> item' without logging in again and so on for say 10 iterations.
>  
> The catch point is the login should be only once (by 10 concurrent 
> users).
>  
> Is that possible through jython scripting?
>  
> If any of you have any idea about this please send me your suggestions.

This is similar to the question asked a few days ago - I attach the 
reply I sent then.

In short, I'd recommend you record a typical scenario, and then add a 
loop to the __call__ method so that the searches are repeated appropriately.

- Phil

Notice:  This email message, together with any attachments, may contain information  of  BEA Systems,  Inc., 
(Continue reading)

dhinakar k | 2 Apr 2007 02:06
Picon

Re: Repeated Concurrent script execution from a particular http request

Philip,
 
Thanks very much for your reply. I will try it.
 
Thanks & Regards,
 
Dhinakar


On 4/1/07, Philip Aston <paston-2Tjm5za6O7k@public.gmane.org> wrote:
dhinakar k wrote:
> Hi Grinder Users,
>
> I am sure the subject that I have put is a little bit confusing.
> Actually the requirement is like this,
>
> Scenario :- Login -> Click on a tab -> Search for an item
>
> 1. At first, say 10 concurrent users will login and do 'Click on a
> tab' & 'Search for an item'
> 2. After the end of first iteration the same 10 concurrent users will
> start 2nd iteration and but 'Click on a tab' and do the 'Search for an
> item' without logging in again and so on for say 10 iterations.
>
> The catch point is the login should be only once (by 10 concurrent
> users).
>
> Is that possible through jython scripting?
>
> If any of you have any idea about this please send me your suggestions.

This is similar to the question asked a few days ago - I attach the
reply I sent then.

In short, I'd recommend you record a typical scenario, and then add a
loop to the __call__ method so that the searches are repeated appropriately.

- Phil


Notice:  This email message, together with any attachments, may contain information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated entities,  that may be confidential,  proprietary,  copyrighted  and/or legally privileged, and is intended solely for the use of the individual or entity named in this message. If you are not the intended recipient, and have received this message in error, please immediately return this by email and then delete it.

---------- Forwarded message ----------
From: Philip Aston <paston-2Tjm5za6O7k@public.gmane.org>
To: grinder-use <grinder-use-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org >
Date: Wed, 28 Mar 2007 19:09:10 +0100
Subject: Re: [Grinder-use] Using Cookies
Caroline Rioux wrote:
>
> I am new to grinder so I am not sure what I am doing with my jython
> script is acceptable or recommended.
>
> I want to test users logging in, browsing, and logging out of a (web)
> system. To be able to 'browse' for an extended period of time, I have
> put the login requests in the __init__ method of my TestRunner class,
> the browse code in the __call__ method and the logout requests in
> __del__ method.
>
> The problem with this is that the cookie accepted in the last request
> call in __init__ is not sent along with the first request in __call__,
> and in fact every subsequent run of the __call__ block requests a new
> cookie from the server.
>
> Is this expected behaviour? If so, is the solution for me to manually
> set the cookie at the start of the call block? Or should I put all the
> requests in the __call__ block and forget about __init__ and __del__?
>
> Thanks for your help!
>

The cookies are deliberately reset at the beginning of the __call__
method. Do something like:

class TestRunner:
def __call__(self):
# first time, log in.

for x in range(0, 100):
# scenario


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
grinder-use mailing list
grinder-use-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/grinder-use


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
grinder-use mailing list
grinder-use@...
https://lists.sourceforge.net/lists/listinfo/grinder-use
Hakan Koseoglu | 2 Apr 2007 13:14
Picon
Gravatar

Re: file distribution and the ageint

Hi Philip,

On 3/27/07, Philip Aston <paston@...> wrote:
> Just run the agents from another directory and all will be fine
> (although you still need to distribute).
Thanks, I think I will do just this but I will give the scenario I
first had an other try.
Cheers,
--

-- 
Hakan (m1fcj)

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
fierrot | 2 Apr 2007 18:23
Favicon

statistic addlong function problem


Hi
I try to use this function :

def htmlAnalysisReport(resp,writeInFile,report):
	if resp.statusCode > 300:
		grinder.statistics.addLong("userLong0",1)
		grinder.statistics.success=0
	if HttpResponseUtil.getInstance().isValid(resp.text,erreursHTML) == 0:
		#writeToFile(resp.text)	
		grinder.statistics.addLong("userLong1",1)
		grinder.statistics.success=0			
	
	if report == 1:
		grinder.statistics.report()
	
	if writeInFile == 1:
		writeToFile(resp.text)

i have the following message. I think it's an attribute problem but i don't
know how to resolve it.

Aborted run due to Jython exception "AttributeError: addLong" whilst
invoking test runner
AttributeError: addLong

Could you help me ?
i Think i did the goos import at the begining of the script.
Thanks a lot.

--

-- 
View this message in context: http://www.nabble.com/statistic-addlong-function-problem-tf3506731.html#a9794043
Sent from the Grinder - User mailing list archive at Nabble.com.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
Philip Aston | 2 Apr 2007 18:30

Re: statistic addlong function problem

fierrot wrote:
> I try to use this function :
>
> def htmlAnalysisReport(resp,writeInFile,report):
> 	if resp.statusCode > 300:
> 		grinder.statistics.addLong("userLong0",1)
> 		grinder.statistics.success=0
> 	if HttpResponseUtil.getInstance().isValid(resp.text,erreursHTML) == 0:
> 		#writeToFile(resp.text)	
> 		grinder.statistics.addLong("userLong1",1)
> 		grinder.statistics.success=0			
> 	
> 	if report == 1:
> 		grinder.statistics.report()
> 	
> 	if writeInFile == 1:
> 		writeToFile(resp.text)
>
> i have the following message. I think it's an attribute problem but i don't
> know how to resolve it.
>
>
> Aborted run due to Jython exception "AttributeError: addLong" whilst
> invoking test runner
> AttributeError: addLong
>   
The statistics API changed in beta31. If you derived the above by 
working from current documentation, please let me know.

Your scripts should read something like:

    grinder.statistics.forLastTest.addLong("userLong0", 1)
    grinder.statistics.forLastTest.success = 0
    # etc.

See 
http://grinder.sourceforge.net/g3/script-javadoc/net/grinder/script/Statistics.html#getForLastTest()

You can make this simpler with:
    stats = grinder.statistics.forLastTest
    stats.addLong("userLong0", 1)
    stats.success = 0

Regards,

- Phil

Notice:  This email message, together with any attachments, may contain information  of  BEA Systems,  Inc., 
its subsidiaries  and  affiliated entities,  that may be confidential,  proprietary,  copyrighted  and/or
legally privileged, and is intended solely for the use of the individual or entity named in this message.
If you are not the intended recipient, and have received this message in error, please immediately return
this by email and then delete it.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
fierrot | 3 Apr 2007 09:50
Favicon

Re: statistic addlong function problem


It's working fine !!!
Thanks again Phillip.

Philip Aston wrote:
> 
> fierrot wrote:
>> I try to use this function :
>>
>> def htmlAnalysisReport(resp,writeInFile,report):
>> 	if resp.statusCode > 300:
>> 		grinder.statistics.addLong("userLong0",1)
>> 		grinder.statistics.success=0
>> 	if HttpResponseUtil.getInstance().isValid(resp.text,erreursHTML) == 0:
>> 		#writeToFile(resp.text)	
>> 		grinder.statistics.addLong("userLong1",1)
>> 		grinder.statistics.success=0			
>> 	
>> 	if report == 1:
>> 		grinder.statistics.report()
>> 	
>> 	if writeInFile == 1:
>> 		writeToFile(resp.text)
>>
>> i have the following message. I think it's an attribute problem but i
>> don't
>> know how to resolve it.
>>
>>
>> Aborted run due to Jython exception "AttributeError: addLong" whilst
>> invoking test runner
>> AttributeError: addLong
>>   
> The statistics API changed in beta31. If you derived the above by 
> working from current documentation, please let me know.
> 
> Your scripts should read something like:
> 
>     grinder.statistics.forLastTest.addLong("userLong0", 1)
>     grinder.statistics.forLastTest.success = 0
>     # etc.
> 
> See 
> http://grinder.sourceforge.net/g3/script-javadoc/net/grinder/script/Statistics.html#getForLastTest()
> 
> You can make this simpler with:
>     stats = grinder.statistics.forLastTest
>     stats.addLong("userLong0", 1)
>     stats.success = 0
> 
> Regards,
> 
> - Phil
> 
> 
> Notice:  This email message, together with any attachments, may contain
> information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
> entities,  that may be confidential,  proprietary,  copyrighted  and/or
> legally privileged, and is intended solely for the use of the individual
> or entity named in this message. If you are not the intended recipient,
> and have received this message in error, please immediately return this by
> email and then delete it.
> 
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share
> your
> opinions on IT & business topics through brief surveys-and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> grinder-use mailing list
> grinder-use@...
> https://lists.sourceforge.net/lists/listinfo/grinder-use
> 
> 

--

-- 
View this message in context: http://www.nabble.com/statistic-addlong-function-problem-tf3506731.html#a9805182
Sent from the Grinder - User mailing list archive at Nabble.com.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
Steve Nam | 3 Apr 2007 19:09
Picon
Favicon

Stopping a worker thread in script

Hi,

 

I’m trying to raise an exception in my test script to stop a worker thread.

As sort of a shot in the dark, I’ve tried something like this:

 

if (self.vuser.error == 1):

        raise ScriptExecutionException, "Server returned error"

 

Now, this does seem to throw an exception but after that it keeps going on instead of stopping.

Does anyone have any suggestions?

 

Thanks,

 

Steve

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
grinder-use mailing list
grinder-use@...
https://lists.sourceforge.net/lists/listinfo/grinder-use
Philip Aston | 4 Apr 2007 12:08

Re: Stopping a worker thread in script

Steve Nam wrote:
>
> I’m trying to raise an exception in my test script to stop a worker 
> thread.
>
> As sort of a shot in the dark, I’ve tried something like this:
>
> if (/self/.vuser.error == 1):
>
> raise ScriptExecutionException, /"Server returned error"/
>
> Now, this does seem to throw an exception but after that it keeps 
> going on instead of stopping.
>
> Does anyone have any suggestions?
>

There isn't a public mechanism to shut down an individual thread. 
Throwing most exceptions will cause The Grinder to log the problem and 
start the next run using that thread. However, there is an undocumented 
way to terminate a single thread (which may or may not be supported in 
future versions) - throw a net.grinder.util.Sleeper.ShutdownException.

If you think this is an important feature for The Grinder, please open a 
feature request.

Regards,

- Phil

Notice:  This email message, together with any attachments, may contain information  of  BEA Systems,  Inc., 
its subsidiaries  and  affiliated entities,  that may be confidential,  proprietary,  copyrighted  and/or
legally privileged, and is intended solely for the use of the individual or entity named in this message.
If you are not the intended recipient, and have received this message in error, please immediately return
this by email and then delete it.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
McAlister, Keith | 5 Apr 2007 10:55
Favicon

Re: How to configure grinder to make sql querys

Grinder enables you to write scripts that call java classes, including
JDBC the java database connection method.

Grinder is a load generator, so we assume you are trying to load test
some or all of your application. To do this you will need to capture the
SQL that the application is generating for the workflow that your are
interested in. How to do this depends on your database, but there is
usually a way of tracing.

Once you have the SQL code it can be used in a Grinder script, using
JDBC calls. If you follow the jdbc.py example (examples\jdbc.py) you
should have some success.  Your will need the JDBC driver for your
database on to the CLASSPATH used to launch the grinder agent.

My advice is to make a batch file to startup the grinder agent and set
the JDBC library for your database on the CLASSPATH that you set in the
batch file. 

Keith McAlister

-----Original Message-----
From: grinder-use-bounces@...
[mailto:grinder-use-bounces@...] On Behalf Of fierrot
Sent: 19 March 2007 08:46
To: grinder-use@...
Subject: [Grinder-use] How to configure grinder to make sql querys

Hi,
i have been using the grinder for 3 days and i want to make sql querys
in order to delete datas i generate while the tests i used.
I have to use a delete query.
i read that i had to install JDBC oracle thin driver, but i did not
manage to do it.
Can someone help me, the doc on the grinder website is not very helpful
for me.
Thanks a lot !

--
View this message in context:
http://www.nabble.com/How-to-configure-grinder-to-make-sql-querys-tf3425
657.html#a9548104
Sent from the Grinder - User mailing list archive at Nabble.com.

------------------------------------------------------------------------
-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share
your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDE
V
_______________________________________________
grinder-use mailing list
grinder-use@...
https://lists.sourceforge.net/lists/listinfo/grinder-use

This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain
proprietary material, confidential information and/or be subject to legal privilege. It should not be
copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then
please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
fierrot | 5 Apr 2007 11:06
Favicon

Re: How to configure grinder to make sql querys


Thanks for your piece of advice.

Even if i don't really need it anymore(i found another solution), i will try
it.

Best regards

Pierre

--

-- 
View this message in context: http://www.nabble.com/How-to-configure-grinder-to-make-sql-querys-tf3425657.html#a9852314
Sent from the Grinder - User mailing list archive at Nabble.com.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

Gmane