Logo QF-Test

Finding valuable answers
in the Mailing List Archive.

 

Free Trial  Download  Buy

Thomas Max, QF-Test training and support

Use the full-text search on our web site to find helpful tips on the mailing list.

Thomas Max, 
Sr. Software Engineer & Trainer, QFS

2017 up to now  | 2016 | 2015 | 2014 | 2013 | 2012 | 2011 | 2010 | 2009 | 2008 | 2007

(older archive entries before 2007 are not shown here, but included in the onsite-search)

Mailing List - Entries of 2007


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [QF-Test] Jython question regarding referencing a java object...


  • Subject: Re: [QF-Test] Jython question regarding referencing a java object...
  • From: "Robert Lahmer, QFS support" <support@?.de>
  • Date: Thu, 22 Nov 2007 14:30:42 +0100


Hello Derrik,

use the 'global' statement to exchange objects between Server script nodes:

Script 1:
 global myObject
 myObject = MyObject()

Script 2:
 global myObject
 print myObject


Best regards,
   Robert


--On Mittwoch, November 21, 2007 13:37:32 -0800 Derrik Ammons
<dammons@?.COM> wrote:

I'm getting a TypeError: method():2nd arg can't be coerced to
pkg.MyClassName within a Server script node.

I instantiate a MyClassName object,
newObject=StaticClass.createNewObject(), in a Server script and call an
rc.setLocal("ReferencName",newObject).  I've also tried setGlobal as
well with the same result.

Later downstream from that node, in the same Test Case node, in another
Server script, I call fetchObject=rc.lookup("ReferenceName").  In the
same script, I use that reference in a function call, anotherObject=
StaticClass.method(someString, fetchObject).

I've compiled the java code into a jar file and placed it in the plugin
directory like I normally do.  I imported the classes in the Server
script like I normally do.  I tried both a setLocal and setGlobal
methods of the run context.  I understand that when I do, there is a
String association to the object, so that when I call rc.lookup(),
fetchObject is a String, but I need the object so I can pass it into
method.  How do I do this?

Hope my example makes sense.  I wanted to make it as generic as
possible.

Thanks,

Derrik



--
Robert Lahmer
Quality First Software GmbH                http://www.qfs.de
Tulpenstr. 41                           Tel: +49 8171 919874
DE-82538 Geretsried                     Fax: +49 8171 919876
GF: Gregor Schmid, Karlheinz Kellerer     HRB München 140833




Videos Downloads Documentation Buy Free Trial