List Icon
Archive de la liste de diffusion

La liste de diffusion est fermée depuis juillet 2022, mais sert toujours d'archive d'informations sur QF-Test.
Cependant, si vous souhaitez rester informé des nouveautés concernant QF-Test, vous pouvez simplement vous
abonner à la newsletter 

our obtenir des informations à jour sur chaque version - y compris les versions mineures - vous pouvez
nous pouvez vous abonner au flux RSS ou nous suivre sur les médias sociaux.
Alternativement, QF-Test fournit également des informations sur la version elle-même.

Une autre source d'information est notre blog, qui contient des articles actuels sur des thèmes généraux, sur l'entreprise QFS et aussi divers "how-tos", veuillez vous
ABonner au Blog


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

Re: [QF-Test] How To Manipulate A String?


  • Subject: Re: [QF-Test] How To Manipulate A String?
  • From: Adesh Siddhu <Adesh.Siddhu@?.org>
  • Date: Mon, 6 Jan 2014 15:21:25 -0800

Thanks, Denis.

I got some examples from previous threads and modified them to come up with a server script as follows.

It is pretty close to what you suggested (perhaps less elegant) but seems to work. Do you see any pitfalls in it?

 

ExistingPriorAidBeginDate = rc.lookup("ExistingPriorAidBeginDate")   # ExistingPriorAidBeginDate is the variable in my Fetch Text

existingyear = rc.lookup("existingyear")

if ExistingPriorAidBeginDate.endswith("2014"):

    existingyear = "2014"

rc.setGlobal("existingyear", existingyear)

 

 

Then back in QFTest, I check the value of existinyear and perform steps as needed.

 

Adesh Siddhu

 

From: GAUTHIER Denis [mailto:Denis.Gauthier@?.au]
Sent: Monday, January 06, 2014 2:59 PM
To: Adesh Siddhu; 'qftest-list@xxxxxx'
Subject: RE: How To Manipulate A String?

 

[@@ OPEN @@]

Hi Adesh,

 

The easiest way would be to use a ‘Check Text’ node instead of a ‘Fetch Text’.

In the ‘Check Text’ node, use the same Client and Component id as the ones you used in your ‘Fetch Text’ node.

In the Text field, enter something like:

.*YYYY

With YYYY substituted by the value you want (it can be a variable in the $(…) syntax)

Do not forget to tick the ‘As regexp’ button.

 

You can use a more elaborate regexp if you want, the above example corresponds to a endswith() test.

 

Now if you want to stick to your ‘Fetch Text’ node, right after this node insert a ‘Server Script’ node and insert the following script:

 

text = rc.getStr(“variable_to_check”)    # replace with the name of the variable you used in the ‘Fetch Text’ node

if text.endswith(“YYYY”):                            # Replace with the actual YYYY value you want to check against

                rc.logError(“The year is not correct”)

else:

                rc.logMessage(“The year is correct”)

 

 

Hope this helps,

Cheers,

Denis GAUTHIER

This message contains OPEN information that is not sensitive and can be freely accessed by people both inside and outside of the Thales Group

This email was classified byGAUTHIER Denis on Tuesday, 7 January 2014 9:59:07 AM

------------------------------------------------------------------------- DISCLAIMER: This e-mail transmission and any documents, files and previous e-mail messages attached to it are private and confidential. They may contain proprietary or copyright material or information that is subject to legal professional privilege. They are for the use of the intended recipient only. Any unauthorised viewing, use, disclosure, copying, alteration, storage or distribution of, or reliance on, this message is strictly prohibited. No part may be reproduced, adapted or transmitted without the written permission of the owner. If you have received this transmission in error, or are not an authorised recipient, please immediately notify the sender by return email, delete this message and all copies from your e-mail system, and destroy any printed copies. Receipt by anyone other than the intended recipient should not be deemed a waiver of any privilege or protection. Thales Australia does not warrant or represent that this e-mail or any documents, files and previous e-mail messages attached are error or virus free. -------------------------------------------------------------------------

NOTICE: This email message and/or its attachments may contain
information that is confidential or restricted. It is intended only for
the individuals named as recipients in the message. If you are NOT an
authorized recipient, you are prohibited from using, delivering,
distributing, printing, copying, or disclosing the message or content to
others and must delete the message from your computer. If you have
received this message in error, please notify the sender by return
email.