Package Structure
For the framework, I created a package structure (you can see it in the way I import the task files). Within my performance-testing directory where I have Grinder installed, I created a scripts directory, inside which I place the package:
scripts/
|-- grinder-frameworked.py
|-- grinder.properties
|-- grinder.py
`-- torqueo
|-- __init__.py
`-- test
|-- __init__.py
|-- framework
| |-- Scenario.py
| |-- Task.py
| `-- __init__.py
`-- tasks
|-- Affiliate
| |-- AddAffiliateTask.py
| `-- __init__.py
|-- Appointment
| |-- AddAppointmentTask.py
| `-- __init__.py
|-- Contact
| |-- AddContactTask.py
| `-- __init__.py
|-- Opportunity
| |-- AddOpportunityTask.py
| `-- __init__.py
|-- Reports
| |-- SearchAffiliateTask.py
| |-- SearchContactTask.py
| |-- SearchOpportunityTask.py
| `-- __init__.py
|-- Task
| |-- AddTaskTask.py
| `-- __init__.py
|-- __init__.py
`-- login
|-- LoginTask.py
|-- LogoutTask.py
`-- __init__.py
Of course, you can create it in any manner you see fit; this is just the way I did it.
Well, that's the end of this tutorial! Hope it was informative and helpful! Please comment and let me know where I can improve. This was my first time doing a lot things; it was my first time writing a framework, my first time doing performance testing, and my first time doing anything serious (and by serious I mean more serious than "Hello World!") in Python/Jython.
Download
If you want to check out the framework, here are the archives. They contain the Task and Scenario classes, and the Perl conversion script:
I configured, Grinderstone, PyDev and Jython on Eclipse Mars (version 4.5) with java 1.7, will can I be able to start recording scripts from Eclipse directly ? to do that should I include the startTCPProxy.sh from Eclipse or is there any other way ? Please adivise, which approach will be more productive , appreciate your response.
how to parameter values in quotes in jython, this is my method :
BaseSTSSchedulerTask.__init__(self, Test(testId, “Get Service Group by ID”), hostPort, ‘/SchServices/api/servicegroup/9999’, HEADERS)
I want to replace the value 9999 with a variable which is returned from a method., like id= Data.getID(). I tried doing this ‘/SchServices/api/servicegroup/’+id, it does not help . Any idea how to handle this ?