Bill Rosmus | 13 Jul 00:54 2013

separate files for test scripts

What is the proper procedure for creating test scripts/modules. That is, 
if I want one file implementing a TestRunner class that calls tests in 
other files (I would like to do one test case per file to keep things 
neat). Do I have to implement a TestRunner class in each script file? Or 
can I just wrap my tests in Test object in the scripts file (as long as 
I am calling it from a TestRunner class in the controlling module)? And 
will I still be able to instrument the tests from within each script 
file (i.e. get statistics).

Regards,

BillR

------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
Fabiano Tarlao | 10 Jul 15:42 2013
Picon

Gzip/deflate problem

Hi,
 I'm new to grinder and I'm facing a problem with gzipped/deflated bodies in responses (I really like to left gzip support enabled in order to do proper load tests).

enviroment:
Grinder version 3.11
Java version 1.7.0_21
I have first  generated a script using the TCPProxy (than I modified it)

I need to  parse the responses from my application in order to construct proper requests, but unzipping the responses bodies triggers an JythonScriptExecutionException (attached at the bottom), which points to "java.util.zip.ZipException: incorrect header check"

I have already enabled content encoding with this function of mine:

def setConnectionDefaultsForHeron():
     connectionDefaults = HTTPPluginControl.getConnectionDefaults()
     connectionDefaults.useContentEncoding = True
     connectionDefaults.useTransferEncoding = True

it looks like (I have done few google search) Java InflaterInputStream fails to uncompress the body (lacking magic header?) http://stackoverflow.com/questions/11399350/gzinflate-in-java
I have tried enabling only gzip or only deflate in the request Accept-Encoding..

connectionDefaults.defaultHeaders = \
  [ NVPair('Accept-Encoding', 'gzip, deflate'),
    NVPair('Accept-Language', 'it-IT,it;q=0.8,en-US;q=0.5,en;q=0.3'),
    NVPair('User-Agent', 'Mozilla/5.0 (Windows NT 5.1; rv:22.0) Gecko/20100101 Firefox/22.0'), ]

These is the request/response which triggers the exception (is indeed the first encoded response):

GET /nomeapplicazione/Login.Ajax.ashx/Initialize?FormKey=qWaqJkcOdkKirsuen4rgHw2&_=1373366275746 HTTP/1.1
Host: 192.168.1.166
Connection: Keep-Alive, TE
TE: trailers, deflate, gzip, compress
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:22.0) Gecko/20100101 Firefox/22.0
Accept-Encoding: gzip, deflate, x-gzip, compress, x-compress
Accept-Language: it-IT,it;q=0.8,en-US;q=0.5,en;q=0.3
Accept: text/javascript, application/javascript, application/ecmascript, application/x-ecmascript, */*; q=0.01
Referer: http://192.168.1.166/nomeapplicazione/Login.aspx
Cookie: ASP.NET_SessionId=rdaqfgmr1nwhxbzn41sflzqo
Cookie2: $Version="1"


HTTP/1.1 200 OK
Cache-Control: no-cache, no-store
Pragma: no-cache
Content-Type: text/javascript; charset=utf-8
Content-Encoding: deflate
Expires: -1
Server: Microsoft-IIS/7.5
X-AspNet-Version: 2.0.50727
X-Powered-By: ASP.NET
Date: Wed, 10 Jul 2013 13:23:44 GMT
Content-Length: 157
...`.I.%******************************************** binarystuff   ../...gE.O...}tZ.U=.....~.......

Wireshark correctly translates the body into Line-based text data: text/javascript:
var initialData  = { STUFFFFFFF };

My google searches points to different solutions but it seems to me tha Grinder is not
decondig the bodies correctly..
I like to ask here for a solution first than writing a dirty workaround.

In case you have code/configuration snippets which solves my issue?

Thanks in advance

Fabiano
 

Zip Excetion details:

net.grinder.scriptengine.jython.JythonScriptExecutionException: Java exception calling TestRunner
    result = request201.GET('/nomeapplicazione/Login.Ajax.ashx/Initialize' +
    File "C:\Source\ProveCarico\customscripts\grinder.py", line 122, in page2
    self.page2()      # GET Initialize (requests 201-202)
    File "C:\Source\ProveCarico\customscripts\grinder.py", line 338, in __call__
java.util.zip.ZipException: incorrect header check
    at java.util.zip.InflaterInputStream.read(Unknown Source) ~[na:1.7.0_21]
    at HTTPClient.HTTPResponse.readResponseData(HTTPResponse.java:1011) ~[grinder-httpclient-3.11.jar:na]
    at HTTPClient.HTTPResponse.getData(HTTPResponse.java:515) ~[grinder-httpclient-3.11.jar:na]
    at net.grinder.plugin.http.HTTPRequest$AbstractRequest.getHTTPResponse(HTTPRequest.java:1292) ~[grinder-http-3.11.jar:na]
    at net.grinder.plugin.http.HTTPRequest.GET(HTTPRequest.java:499) ~[grinder-http-3.11.jar:na]
    at net.grinder.plugin.http.HTTPRequest.GET(HTTPRequest.java:445) ~[grinder-http-3.11.jar:na]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_21]
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:1.7.0_21]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.7.0_21]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.7.0_21]
    at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:186) ~[jython-standalone-2.5.3.jar:na]
    at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:204) ~[jython-standalone-2.5.3.jar:na]
    at org.python.core.PyObject.__call__(PyObject.java:404) ~[jython-standalone-2.5.3.jar:na]
    at org.python.core.PyObject.__call__(PyObject.java:408) ~[jython-standalone-2.5.3.jar:na]
    at org.python.core.PyMethod.__call__(PyMethod.java:124) ~[jython-standalone-2.5.3.jar:na]
    at org.python.pycode._pyx1.page2$4(C:\Source\ProveCarico\customscripts\grinder.py:131) ~[na:na]
    at org.python.pycode._pyx1.call_function(C:\Source\ProveCarico\customscripts\grinder.py) ~[na:na]
    at org.python.core.PyTableCode.call(PyTableCode.java:165) ~[jython-standalone-2.5.3.jar:na]
    at org.python.core.PyBaseCode.call(PyBaseCode.java:134) ~[jython-standalone-2.5.3.jar:na]
    at org.python.core.PyFunction.__call__(PyFunction.java:317) ~[jython-standalone-2.5.3.jar:na]
    at org.python.core.PyMethod.__call__(PyMethod.java:109) ~[jython-standalone-2.5.3.jar:na]
    at org.python.pycode._pyx1.__call__$25(C:\Source\ProveCarico\customscripts\grinder.py:398) ~[na:na]
    at org.python.pycode._pyx1.call_function(C:\Source\ProveCarico\customscripts\grinder.py) ~[na:na]
    at org.python.core.PyTableCode.call(PyTableCode.java:165) ~[jython-standalone-2.5.3.jar:na]
    at org.python.core.PyBaseCode.call(PyBaseCode.java:301) ~[jython-standalone-2.5.3.jar:na]
    at org.python.core.PyBaseCode.call(PyBaseCode.java:194) ~[jython-standalone-2.5.3.jar:na]
    at org.python.core.PyFunction.__call__(PyFunction.java:387) ~[jython-standalone-2.5.3.jar:na]
    at org.python.core.PyMethod.instancemethod___call__(PyMethod.java:220) ~[jython-standalone-2.5.3.jar:na]
    at org.python.core.PyMethod.__call__(PyMethod.java:211) ~[jython-standalone-2.5.3.jar:na]
    at org.python.core.PyMethod.__call__(PyMethod.java:206) ~[jython-standalone-2.5.3.jar:na]
    at org.python.core.PyObject.invoke(PyObject.java:3555) ~[jython-standalone-2.5.3.jar:na]
    at org.python.core.PyInstance.instance___call__(PyInstance.java:351) ~[jython-standalone-2.5.3.jar:na]
    at org.python.core.PyInstance.__call__(PyInstance.java:342) ~[jython-standalone-2.5.3.jar:na]
    at org.python.core.PyObject.__call__(PyObject.java:371) ~[jython-standalone-2.5.3.jar:na]
    at net.grinder.scriptengine.jython.JythonScriptEngine$JythonWorkerRunnable.run(JythonScriptEngine.java:263) ~[grinder-core-3.11.jar:na]
    at net.grinder.engine.process.GrinderThread.run(GrinderThread.java:119) ~[grinder-core-3.11.jar:na]
    at java.lang.Thread.run(Unknown Source) [na:1.7.0_21]


 



------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
grinder-use mailing list
grinder-use@...
https://lists.sourceforge.net/lists/listinfo/grinder-use
Ouray Viney | 8 Jul 20:25 2013
Picon

Using automatic redirects

Hi Phil,

I was wondering if there is a clever way to uniquely set the automatic redirects on a per script basis even when running multiple scripts in parallel.

I have updated a few scripts to use automatic redirects as it really makes the scripts more robust to change.  However, in doing so, I have noticed that some of the other scripts inherit this setting.  I tested by forcing the setting to false in the scripts I didn't want redirects, but that didn't help.  The setting seems to be global to all scripts once set (perhaps the last script inititialized wins?).

Thanks,

--
Ouray Viney
http://www.viney.ca

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
grinder-use mailing list
grinder-use@...
https://lists.sourceforge.net/lists/listinfo/grinder-use
t1279k | 5 Jul 15:55 2013
Picon

capture grinder request sent from fiddler

Hi

While i am generating script i would like to see if the request sent from
grinder is proper. fiddler does not seem capture this. Is there a way to
capture the request from grinder  by fiddler or any other similar tool. for
debugging purpose.

thanks

--
View this message in context: http://grinder.996249.n3.nabble.com/capture-grinder-request-sent-from-fiddler-tp8496.html
Sent from the Grinder - User mailing list archive at Nabble.com.

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
t1279k | 5 Jul 15:45 2013
Picon

Grinder in Windows 8 not creating log

Hi

When i run grinder in windows 8 no log is generated in my xp system it is
working. I open command line as "Run as administrator" and open the console
and agent. when it runs there are not errors. I do not see any log files
being generated. 

one odd thing this is when i open command line in normal mode ( with out run
as administrator) error is shown in the console and at that time log file is
generated. I need the log file to generate report

this is the sample script i am running

from net.grinder.script.Grinder import grinder 
from net.grinder.script import Test 
from net.grinder.plugin.http import HTTPRequest 
from java.lang import System 

class TestRunner: 
        def __init__(self): 
                grinder.statistics.delayReports=True 
        def __call__(self): 
                Google() 

request = HTTPRequest()
Test(1, "Google").record(request) 

def Google(): 
        result = request.GET("http://www.google.com") 
        grinder.logger.info(" Vij running google test  ") 
        grinder.statistics.forLastTest.success = True
        if result.getStatusCode() == 302 :
                grinder.statistics.forLastTest.success = 1
        else:
                grinder.statistics.forLastTest.success = 0 

thanks

--
View this message in context: http://grinder.996249.n3.nabble.com/Grinder-in-Windows-8-not-creating-log-tp8495.html
Sent from the Grinder - User mailing list archive at Nabble.com.

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
Jai P | 1 Jul 19:25 2013
Picon

How to call a command after all tests have finished execution

I have a Grinder test which runs fine. I want to start perfmon to collect system metrics for the test duration. The problem is I that I am able to start the perfmon counter from the grinder script but unable to stop.
In the code below, the last lines get executed even before the Grinder threads begin running. Without the if condition, the perfmon counter is stopped before the test runs. What is the best way to ensure I capture the system metrics for the test duration?


import string
import re
import random
import os

from net.grinder.script.Grinder import grinder
from net.grinder.script import Test
from java.lang import System



# set to one to have verbose output
show = 0

# Test parameters, pin and user name prefix
pin = "1234"
userPrefix = "perfuser"

# define some useful shortcuts
err = grinder.logger.error

os.system("C:/PSRT/perfmon/delete_collector.bat")
os.system("C:/PSRT/perfmon/create_data_collector.bat") 
os.system("C:/PSRT/perfmon/start_collector.bat")
start = System.currentTimeMillis()

# Authentication test
def doWork():

       //code
        return ok


# define all tests here
aTest = Test(1, "Test this").wrap(doWork)

#os.system("C:/PSRT/perfmon/stop_collector.bat") where to call this?

# The main class for this script
class TestRunner:
    def __init__(self):
        # start the load generator counters
        
        self.startTime = System.currentTimeMillis()  
       
    
    
    def initialSleep( self):
        sleepTime = grinder.threadNumber * 5  # 5 seconds per thread
        grinder.sleep(sleepTime, 0)
        log("initial sleep complete, slept for around %d ms" % sleepTime)  

    def __call__(self):
        #if grinder.runNumber == 0: self.initialSleep()
        if System.currentTimeMillis() - self.startTime > 300 * 1000: grinder.stopThisWorkerThread()        
        statistics = grinder.statistics

        
        statistics.delayReports = 1

       

        # run test
        statistics.forLastTest.success = aTest()




if System.currentTimeMillis() - start > 300 * 1000:    
    os.system("C:/PSRT/perfmon/stop_collector.bat")



------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
grinder-use mailing list
grinder-use@...
https://lists.sourceforge.net/lists/listinfo/grinder-use
Rob Cruz | 27 Jun 22:31 2013
Picon

Need ideas on Correlation in XML Request/Response

Hi All,
I decided to use The Grinder in performance testing our SOAP service layer.  I need ideas on how to implement
correlation with my XML request and responses.  For example, I want to extract session ID from an XML
response and use it to compose a new request for a new service call.

The way I implemented this is I'm importing dom4j into my script and use dom4j functions to get a node from the
xml and also to insert a value for a node into the xml.

Is there a better way to do this?  Does anyone have any experience on this?  I'd appreciate any feedback, thanks.

Rob
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
Nick Downs | 12 Jun 07:57 2013
Picon

Building from Source

Hello, 

I am attempting to build The Grinder from master but seem to be running into an issue with the build process finding pre-req jars that have already been built.I was hoping someone would be able to help me out. 

I am attempting to bypass the tests and package the software directly with the command: /usr/local/maven/bin/mvn -Dmaven.test.skip=true package

[INFO] ------------------------------------------------------------------------
[INFO] Building grinder-http 3.12-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] grinder-parent .................................... SUCCESS [2.566s]
[INFO] grinder-dcr-agent ................................. SUCCESS [2.800s]
[INFO] grinder-translation ............................... SUCCESS [6.320s]
[INFO] grinder-test-support .............................. SUCCESS [1.079s]
[INFO] grinder-core ...................................... SUCCESS [13.402s]
[INFO] grinder-httpclient ................................ SUCCESS [1.519s]
[INFO] grinder-xmlbeans .................................. SUCCESS [4.875s]
[INFO] grinder-http ...................................... FAILURE [0.991s]
[INFO] grinder-console-service ........................... SKIPPED
[INFO] grinder-swing-console ............................. SKIPPED
[INFO] grinder ........................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 36.948s
[INFO] Finished at: Wed Jun 12 05:51:28 UTC 2013
[INFO] Final Memory: 33M/87M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project grinder-http: Could not resolve dependencies for project net.sf.grinder:grinder-http:jar:3.12-SNAPSHOT: Could not find artifact net.sf.grinder:grinder-core:jar:tests:3.12-SNAPSHOT in sonatype-nexus-snapshots (https://oss.sonatype.org/content/repositories/snapshots) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <goals> -rf :grinder-http


I am new to Maven so this is probably a very simple issue to resolve. I am going to keep digging but was hoping someone else has seen this.

Thanks in advance, 
Nick Downs
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
grinder-use mailing list
grinder-use@...
https://lists.sourceforge.net/lists/listinfo/grinder-use
adrian | 31 May 12:23 2013

Different number of users in different times (in step)

Hi there,

I am new to grinder and this is my first post in this forum, so be merciful
please. I want to simulate this scenario. During the first hour I want to
connect, lets say, 50 users. The following hour I want to connect 120 users.
Finally, in the begining of the third hour I want to have connected 100 user
until I stop the threads manually using the REST interface. I mean, I want
to be able to connect a different number of users in steps. How can I
achieve that by code? I have not found something related about this in the
forum.  

I am looking forward to your reply. Please, excuse my limited English.

Adrián

--
View this message in context: http://grinder.996249.n3.nabble.com/Different-number-of-users-in-different-times-in-step-tp8470.html
Sent from the Grinder - User mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite
It's a free troubleshooting tool designed for production
Get down to code-level detail for bottlenecks, with <2% overhead.
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap2
_______________________________________________
grinder-use mailing list
grinder-use <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/grinder-use
Sean Tiley | 22 May 16:07 2013
Picon

How to call function for each response

Hello
I am using grinder 3.11.  I record my tests using the TCPProxy and am really having no issues.
I have created several functions that I use to validate response sizes, content type etc and one function to write out the responses.
 
Up to now when I  want to write out a response for a request, I add the "saveToHTML" line to each section of the recorded script as below
 
  def page1(self):
    """GET / (request 101)."""
    result = request101.GET('/fins_enu/', None,
      ( NVPair('If-Modified-Since', 'Wed, 22 Oct 2008 23:41:54 GMT'),
        NVPair('If-None-Match', '\"04d6ec39f34c91:0\"'), ))
    saveToHTML(result,"Response_Page1")
    return result
 
 
This becomes very tiresome to add this line to each section of the code, especially when some of the tests have > 50 request/responses.  Very manual and there must be a better way
 
So my question is how can I simplify this?
I already have a function that writes out the files, I just need to understand how to call that function a better way so its not such a manual thing for me.
 
Can I add something to the section
def __call__(self):
    """Called for every run performed by the worker thread."""
    self.page1()      # GET / (request 101)
 
    grinder.sleep(25)
    self.page2()      # GET start.swe (requests 201-211)
....
 
Any insight is much appreciated
------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
_______________________________________________
grinder-use mailing list
grinder-use@...
https://lists.sourceforge.net/lists/listinfo/grinder-use
Ravi Joshi | 19 May 20:39 2013
Picon

How to know the value of grinder.consolePort and headless console service port value?

Hi all,

Till now I am in habit of running Agents in 6372/6373 port. My question is how to know the value of grinder.consolePort and headless console service port value?
 
I found that after starting console in headless mode, it shows below log-
2013-05-19 23:23:39,870 INFO  org.eclipse.jetty.server.AbstractConnector: Started SelectChannelConnector <at> :6373

Is this 6373 headless console service port or is it grinder.consolePort ?

I found that in my setup, agent is connected to console on port 6372 and console (which is running in headless mode) is showing 6373 port number. Anybody here, please explain me about it?

The screenshot is attached for more information.

So what are the ways to know the value of both?

-Ravi Joshi
------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
_______________________________________________
grinder-use mailing list
grinder-use@...
https://lists.sourceforge.net/lists/listinfo/grinder-use

Gmane