Aug 26 2009 02:55:27 AM Posted By : rajasankar
Comments (0)

As you know QEngine based on Jython(Java implementation of Python), you can write Java code and import that in QEngine.

Code:

public class test
{
public static void main(String args[])
{
}
public void work()
{

}
}


you can import that like this

Code:

import test as te

t=te();

use the method mentioned there

def makework():
t.work()


If you need to use this method across multiple scripts, you need to create and python file under /QEngine/jars folder and import that in the scripts file

Code:

workfile.py contains

import test as te
t=te();

def makework():
t.work()


Use
Code:

from workfile import *

or
Code:

from workfile import makework


Finally add the class in the classpath. Add this class entry to //bin/StartWebTestServer.bat in "set CLASS_PATH=" line. You need to restart the server after this change.

Rajasankar
rajasankar at zohocorp dot com

No one has commented yet! Be the first one to comment!

Post Comment