Mailing list - Entries of 2006


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

Re: [qftestJUI] Ref. QftestJUI 1.08.5 / conditional statement and regex without resorting to scripts.


  • Subject: Re: [qftestJUI] Ref. QftestJUI 1.08.5 / conditional statement and regex without resorting to scripts.
  • From: Gregor Schmid <Gregor.Schmid@?.de>
  • Date: 19 Apr 2006 21:30:38 +0200

Hi Adrian,

you will need to run one initial Server script during your setup to
import the re package and ideally to create the compiled regexps you
need as global Jython variables:

import re
global reoch, reodu, ...etc.

reoch = re.compile("[oO][cC][hH]-[0-9]+")
reodu = re.compile("[oO][dD][uU]-[0-9]+")
etc.

then, in the "If" node's condition attribute, use

reoch.match(rc.lookup("signalType"))

There are other alternatives that don't require regexps and may be
more elegant if your signals are as well-structured as it seems:

rc.lookup("signalType").upper().startswith("ODU-")

will match all the oDu-* variants. 

Best regards,
    Greg

"Adrian Chamberlain" <Adrian.Chamberlain@?.com> writes:

> Ref. QftestJUI 1.08.5 / conditional statement and regex without resorting
> to scripts.
> 
> Hi,
> 
> I effectively wish to do the following using an 'IF' node and avoiding
> resorting to the use of SUT/Server scripts.
> 
> If search("([O]|[o])([C]|[c])([H]|[h])", rc.lookup("signalType")) == true
>      etc.
> 
> is there anyway to achieve the above?
> 
> Basically I have a qfs procedure with a parameter named 'signalType'.  The
> signal type can be either ODU-1, OCh or VC-4.  Consequently I have
> conditional statements which use the signal type to determine which popmenu
> menu should be displayed etc.  Without going into to too much detail, the
> basic problem is that the application in question (lazy developers!!) is
> not being consistent with respect to the case of letters of the signal type
> string.  Consequently the signal type OCh can be "Och" in some combo box's
> etc. and yet "OCH" or "OCh" elsewhere in the application.  So how does one
> include a condition in the 'If' node which utilises a regular expression?
> 
> Any tips would be appreciated.
> 
> Thank you in anticipation of your help
> Kind Regards
> Adrian

-- 
Gregor Schmid                                Gregor.Schmid@?.de
Quality First Software GmbH                     http://www.qfs.de
Tulpenstr. 41                                Tel: +49 8171 919870
DE-82538 Geretsried                          Fax: +49 8171 919876


Videos Downloads Documentation Buy Free Trial