[ptt-users] (TM5,B2,Windows) Running jython scripts with htmlunit

Kyle Bell kylebell at tango-networks.com
Mon Jul 9 11:13:24 PDT 2007


Dominique,

Whenever I intend to import from a jar file, I have to ensure either the
classpath is set to include the jar (TestMaker.sh sets this up) or if I
am importing from a jython module not in TestMaker/lib, I'll add the
directory path containing the new module to sys.path which is a list of
directories where modules are found.  This can be done with

  sys.path.append("/path/to/directory/string")

and the module of interest resides in the /path/to/directory/string
directory.

In the case of the classpath definition, TestMaker.sh calls another
shell script called TMCP.sh found in TestMaker/utils which will define
the classpath for TestMaker.

In your case, using package com.pushtotest.tool to find the class called
HTMLUnit, I'm sure that com.pushtotest.tool exists in your classpath,
therefore this is not likely your issue since several TestMaker tools
rely on this package.  What I do not know, however, is in which package
HTMLUnit actually resides.

Regards,

Kyle Bell
Test and Automation Architect
Tango Networks
http://www.tango-networks.com



On Mon, 2007-07-09 at 18:42 +0200, Dominique de Waleffe wrote:
> I am trying to run a simple scenario in jython, generated by testmaker 
> from a recorded tesgen4web script.
> 
> All I can get to is errors about missing classes so far and not beeing 
> able to even run the line
> 
> from XXX import HTMLUnit
> in my script.
> 
> Has anybody succeeded in doing that kind of thing? What is the secret?
> 
> 
> I attach the scenario and the almost emptied jython file...
> 
> [note that I already tried putting a more recent js.jar in the system, 
> to no avail so far].
> 
> D.
> 
> plain text document attachment (flexoserv-t2.tg4w.py)
> import sys
> sys.add_package("com.pushtotest.tool")
> # Import tells TestMaker where to find TOOL objects
> from com.pushtotest.tool import HTMLUnit
> 
> class HTMLTest:
>     def setUp( self ):
>         pass
> 
>     def tearDown(self):
>         pass
> 
>     def test(self):
>         print "hello world()"
> 
> def getHTMLTest ():
>         test = HTMLTest();
>         return  test;
> _______________________________________________
> Users mailing list
> Users at lists.pushtotest.com
> http://lists.pushtotest.com/mailman/listinfo/users



More information about the Users mailing list