Having problems with your account or logging in?
A lot of changes are happening in the community right now. Some may affect you. READ MORE HERE

Why does SilkTest not return blank lines when using the GetMultiText() method?

Why does SilkTest not return blank lines when using the GetMultiText() method?

Problem:

Why does SilkTest not return blank lines when using the GetMultiText() method?

Resolution:

NOTE: This applies to SilkTest 2008 and SilkTest 2008 SP1 only. The behaviour has been fixed in SilkTest2008 R2 with the addition of the OPT_GET_MULTITEXT_KEEP_EMPTY_LINES flag.

This behaviour is as-designed in that all blank lines are discarded when using either the GetMultiText() or the GetMultiSelText() methods.

Previous versions of SilkTest have allowed the return of blank lines but that behaviour was not as-designed. The defect has been corrected in SilkTest 2008 and a doc-issue has been logged to specifically state this for a future version of SilkTest. A Change Request has been entered to allow backwards compatibility with the incorrect behaviour by use of an optional flag. One possible way of implementing an alternative solution in a multi-version SilkTest environment (or to retain backwards compatibility with current text verification tests) is to extend the TextField class so that it checks for the version of SilkTest that is currently in use and then calls an appropriate GetMultiText() based on the result:

[-] winclass TextField : TextField
[-] LIST OF STRING NewGetMultiText ()
[ ] string sVer = GetPartnerVersion ()
[-] if SubStr (sVer, 27, 1)=="9"
[ ] this.Typekeys("")
[ ] print("Using GetMultiText() new method") //Debug string
[ ] return Clipboard.GetText()
[-] else
[ ] print("Using GetMultiText() original Method") //Debug string
[ ] return this.GetMultiText()



The following testcase was run against the multiline textfield under Control | Textfield on the sample Test Application supplied with SilkTest.

For versions prior to SilkTest 2008 the sample application is under

Start | Programs | Borland | SilkTest | Sample Applications | Test Application

For versions after SilkTest2008 the sample application is under

Start | Programs | Borland | SilkTest | Sample Applications | Win32 | Test Application



[-] testcase GetMultiTextTest() appstate none
[ ] TextField1.SetActive()
[ ] print(TextField1.TheMultipleLineTextField.NewGetMultiText())



SilkTest2008 returns the following result:

[-] Testcase GetMultiTextTest - Passed
[ ] Using GetMultiText() new method
[ ] {This is a check, , to see, if the NewGetMultiLineText() method, , , works as expected.}



SilkTest2006R2 SP2 returns the following result:


[-] Testcase GetMultiTextTest - Passed
[ ] Using GetMultiText() original method
[ ] {This is a check, , to see, if the NewGetMultiLineText() method, , , works as expected.}


Old KB# 23481

DISCLAIMER:

Some content on Community Tips & Information pages is not officially supported by Micro Focus. Please refer to our Terms of Use for more detail.
Top Contributors
Version history
Revision #:
1 of 1
Last update:
‎2013-02-15 19:35
Updated by:
 
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.