Logo QF-Test

Im Archiv der Mailingliste
wertvolle Antworten finden.

 

Gratis Testen  Download  Kaufen

Thomas Max, QF-Test Training und Support

Tipp für die Recherche in der Mailingliste: Volltextsuche (oben) verwenden.

Thomas Max,
Sr. Software Engineer & Trainer, QFS

2017 bis heute 2016 2015 2014 | 2013 | 2012 | 2011 2010 2009 | 2008 | 2007

(ältere Archiveinträge vor 2007 nicht dargestellt, aber in der Suche enthalten)

Mailingliste - Einträge 2017 bis heute


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

Re: [QF-Test] How to compare the component displayed value


  • Subject: Re: [QF-Test] How to compare the component displayed value
  • From: Gregor Schmid <Gregor.Schmid@?.de>
  • Date: Tue, 08 Aug 2017 17:36:19 +0200
  • Delivered-to: qftest-list@?.net

Hi Kevin,

the problem is that you are using rc.getComponent as the test in an
'If' node. You can't do that because rc.getComponent is solely
available in the SUT whereas 'If' node tests are evaluated in
QF-Test's Jython interpreter.

Instead, use a 'Fetch text' node to read the text of the intended
target component and store it in a variable, e.g. "text", then use

rc.lookup("text") != "0.00"

in the test of the 'If' node.

NB: In general rc.lookup("text") is preferable to "$(text)" because it
doesn't throw an exception in case of line breaks or special escape
sequences.

Best regards,
    Greg


"Liu, Kevin (DPTI)" <Kevin.Liu@?.au> writes:

> Hi,
>
> I am writing an if condition in my sequence as follows:
>
> rc.getComponent("label0.00").getAttribute('value’) != "0.00"
>
> and I am getting the following error:
>
> de.qfs.apps.qftest.shared.exceptions.BadTestException: The expression
>
> 'rc.getComponent("label0.00").getAttribute(’value’) != "0.00"'
>
> is not a valid test.
>
> The Jython engine failed with the following message:
>
> Traceback (most recent call last):
>
>   File "<string>", line 1, in <module>
>
>   File "C:\Program Files (x86)\qfs\qftest\qftest-4.1.4\jython\Lib\qftest.py", line 172, in evaltest
>
>     exec "if " + test + ": ret[0]='true'" \
>
>   File "C:\Program Files (x86)\qfs\qftest\qftest-4.1.4\jython\Lib\qftest.py", line 172, in evaltest
>
>     exec "if " + test + ": ret[0]='true'" \
>
>   File "<string>", line 1
>
>     if rc.getComponent("label0.00").getAttribute(?value?) != "0.00": ret[0]='true'
>
>                                                 ^
>
> SyntaxError: no viable alternative at character '?'
>
>                 at de.qfs.apps.qftest.run.AbstractRunContext.evalTest(SourceFile:4610)
>
>                 at de.qfs.apps.qftest.step.IfSequence.exec(SourceFile:381)
>
>                 at de.qfs.apps.qftest.step.IfSequence.exec(SourceFile:354)
>
>                 at de.qfs.apps.qftest.run.AbstractRunContext.call(SourceFile:2230)
>
>                 at de.qfs.apps.qftest.step.BasicSequence.a(SourceFile:752)
>
>                 at de.qfs.apps.qftest.step.TryStep.exec(SourceFile:268)
>
>                 at de.qfs.apps.qftest.step.TryStep.exec(SourceFile:221)
>
>                 at de.qfs.apps.qftest.run.AbstractRunContext.call(SourceFile:2230)
>
>                 at de.qfs.apps.qftest.step.BasicSequence.a(SourceFile:752)
>
>                 at de.qfs.apps.qftest.step.BasicSequence.exec(SourceFile:677)
>
>                 at de.qfs.apps.qftest.step.BasicSequence.exec(SourceFile:657)
>
>                 at de.qfs.apps.qftest.run.AbstractRunContext.call(SourceFile:2230)
>
>                 at de.qfs.apps.qftest.step.BasicSequence.a(SourceFile:752)
>
>                 at de.qfs.apps.qftest.step.BasicSequence.exec(SourceFile:677)
>
>                 at de.qfs.apps.qftest.step.BasicSequence.exec(SourceFile:657)
>
>                 at de.qfs.apps.qftest.run.AbstractRunContext.call(SourceFile:2230)
>
>                 at de.qfs.apps.qftest.step.TryStep.exec(SourceFile:308)
>
>                 at de.qfs.apps.qftest.step.TryStep.exec(SourceFile:221)
>
>                 at de.qfs.apps.qftest.run.AbstractRunContext.call(SourceFile:2230)
>
>                 at de.qfs.apps.qftest.step.BasicSequence.a(SourceFile:752)
>
>                 at de.qfs.apps.qftest.step.BasicSequence.exec(SourceFile:677)
>
>                 at de.qfs.apps.qftest.step.SetupSequence.exec(SourceFile:176)
>
>                 at de.qfs.apps.qftest.step.BasicSequence.exec(SourceFile:657)
>
>                 at de.qfs.apps.qftest.run.AbstractRunContext.call(SourceFile:2230)
>
>                 at de.qfs.apps.qftest.step.Dependency.exec(SourceFile:773)
>
>                 at de.qfs.apps.qftest.run.AbstractRunContext.call(SourceFile:2230)
>
>                 at de.qfs.apps.qftest.run.AbstractRunContext.call(SourceFile:3124)
>
>                 at de.qfs.apps.qftest.run.an$a.a(SourceFile:1357)
>
>                 at de.qfs.apps.qftest.run.an.a(SourceFile:217)
>
>                 at de.qfs.apps.qftest.run.AbstractRunContext.resolveDependencies(SourceFile:4834)
>
>                 at de.qfs.apps.qftest.step.Dependency.exec(SourceFile:757)
>
>                 at de.qfs.apps.qftest.run.AbstractRunContext.call(SourceFile:2230)
>
>                 at de.qfs.apps.qftest.step.DependencyReference.exec(SourceFile:460)
>
>                 at de.qfs.apps.qftest.run.AbstractRunContext.call(SourceFile:2230)
>
>                 at de.qfs.apps.qftest.step.TestCase.exec(SourceFile:616)
>
>                 at de.qfs.apps.qftest.step.TestCase.exec(SourceFile:402)
>
>                 at de.qfs.apps.qftest.run.AbstractRunContext.call(SourceFile:2230)
>
>                 at de.qfs.apps.qftest.step.TestSet.exec(SourceFile:1146)
>
>                 at de.qfs.apps.qftest.step.TestSet.exec(SourceFile:657)
>
>                 at de.qfs.apps.qftest.run.AbstractRunContext.call(SourceFile:2230)
>
>                 at de.qfs.apps.qftest.step.BasicSequence.a(SourceFile:752)
>
>                 at de.qfs.apps.qftest.step.RootStep.exec(SourceFile:1258)
>
>                 at de.qfs.apps.qftest.step.BasicSequence.exec(SourceFile:657)
>
>                 at de.qfs.apps.qftest.run.AbstractRunContext.call(SourceFile:2230)
>
>                 at de.qfs.apps.qftest.run.AbstractRunContext.run(SourceFile:1450)
>
>                 at de.qfs.apps.qftest.run.AbstractRunContext.run(SourceFile:1335)
>
>                 at de.qfs.apps.qftest.run.AbstractRunContext$a.run(SourceFile:11642)
>
> Caused by: Traceback (most recent call last):
>
>   File "<string>", line 1, in <module>
>
>   File "C:\Program Files (x86)\qfs\qftest\qftest-4.1.4\jython\Lib\qftest.py", line 172, in evaltest
>
>     exec "if " + test + ": ret[0]='true'" \
>
>   File "C:\Program Files (x86)\qfs\qftest\qftest-4.1.4\jython\Lib\qftest.py", line 172, in evaltest
>
>     exec "if " + test + ": ret[0]='true'" \
>
>   File "<string>", line 1
>
>     if rc.getComponent("label0.00").getAttribute(?value?) != "0.00": ret[0]='true'
>
>                                                 ^
>
> SyntaxError: no viable alternative at character '?'
>
>                 at org.python.core.ParserFacade.fixParseError(ParserFacade.java:95)
>
>                 at org.python.core.ParserFacade.parse(ParserFacade.java:205)
>
>                 at org.python.core.Py.compile_flags(Py.java:1998)
>
>                 at org.python.core.Py.exec(Py.java:1432)
>
>                 at qftest$py.evaltest$6(C:\Program Files (x86)\qfs\qftest\qftest-4.1.4\jython\Lib\qftest.py:177)
>
>                 at qftest$py.call_function(C:\Program Files (x86)\qfs\qftest\qftest-4.1.4\jython\Lib\qftest.py)
>
>                 at org.python.core.PyTableCode.call(PyTableCode.java:167)
>
>                 at org.python.core.PyBaseCode.call(PyBaseCode.java:189)
>
>                 at org.python.core.PyFunction.__call__(PyFunction.java:446)
>
>                 at org.python.pycode._pyx36.f$0(<string>:1)
>
>                 at org.python.pycode._pyx36.call_function(<string>)
>
>                 at org.python.core.PyTableCode.call(PyTableCode.java:167)
>
>                 at org.python.core.PyCode.call(PyCode.java:18)
>
>                 at org.python.core.Py.runCode(Py.java:1391)
>
>                 at org.python.core.Py.exec(Py.java:1435)
>
>                 at org.python.util.PythonInterpreter.exec(PythonInterpreter.java:268)
>
>                 at de.qfs.apps.qftest.shared.script.JythonEngine.exec(SourceFile:177)
>
>                 at org.apache.bsf.BSFManager$6.run(Unknown Source)
>
>                 at java.security.AccessController.doPrivileged(Native Method)
>
>                 at org.apache.bsf.BSFManager.exec(Unknown Source)
>
>                 at de.qfs.apps.qftest.run.AbstractRunContext.evalTest(SourceFile:4591)
>
>                 ... 46 more
>
> So how do I compare the component’s displayed value with 0.00?
>
> Cheers
>
> Kevin
>
> _______________________________________________
> qftest-list mailing list
> qftest-list@?.de
> https://movement.qfs.de/mailman/listinfo/qftest-list

-- 
Gregor Schmid

E: gregor.schmid@?.de
T: +49 8171 38648-11
F: +49 8171 38648-16

Quality First Software GmbH | www.qfs.de
Tulpenstr. 41 | 82538 Geretsried | Germany
GF Gregor Schmid, Dr. Martina Schmid, Karlheinz Kellerer
HRB München 140833


Videos Downloads Dokumentation Kaufen Gratis Testen