Mailingliste - Einträge 2005


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

Re: [qftestJUI] calling a method of a class


  • Subject: Re: [qftestJUI] calling a method of a class
  • From: Karlheinz Kellerer <Karlheinz.Kellerer@?.de>
  • Date: Fri, 01 Jul 2005 09:37:03 -0000

Hi Sylwia,

You need to declare your jython variable as global.

    import myresolver
    import testresult

    global infoModelAlignmentResult
    infoModelAlignmentResult = testresult.TestResult("InfoModelAlignment")


Now you are can use this variable in other script nodes.

    infoModelAlignmentResult.addSuccess(...)

Best regards,
    Karl

farraige@?.pl writes:

> Hi,
>
> I have the following problem.
> The setup node of my Test-suite contains the following SUT script:
>
> import myresolver
> import testresult
>
> infoModelAlignmentResult = testresult.TestResult("InfoModelAlignment")
> rc.setGlobal("IMTestResult", infoModelAlignmentResult)
>
> I set here a global variable named IMTestResult which is an instance
> of the class testresult.TestResult.
>
> Now I would like to call one of methods of this class in another
> node of the test-suite. I do the following:
>
> IMTestResult.addSuccess(...)
>
> Then I get the following error:
>
> NameError: IMTestResult
>
> Then I tried to modify the script a bit:
>
> rc.lookup("IMTestResult").addSuccess
>
> I got the error:
> AttributeError: 'string' object has no attribute 'addSuccess'
>
> How can I call a given method (via Jython script) of given class
> (testresult.TestResult)instance defined as global variable in a
> setup node of a test-suite?
>
> Thank you in advance for hints.
>
> Best Regards,
> Sylwia
>
> _______________________________________________
> qftestJUI-list mailing list
> qftestJUI-list@?.de
> http://www.qfs.de/mailman/listinfo/qftestjui-list

--
Karlheinz Kellerer                     Karlheinz.Kellerer@?.de
Quality First Software GmbH                    http://www.qfs.de



Videos Downloads Dokumentation Kaufen Gratis Testen