Created On:  19-05-2010
How can I verify that a particular word appears in an application's Window Caption, when the Caption itself is dynamic and changes for each user?

Consider the example caption below; in this case the first portion of the caption ("SW Test - CCView - SUPERUSER") is dynamic, where "SW Test" indicates the user type and "CCView - SUPERUSER" indicates the user' privileges).

> "SW Test - CCView - SUPERUSER - Real Time - STARTUP.DRW"

In this scenario we cannot use the standard verification funcitonality to confirm that the caption includes the text 'Real Time', because the Caption contains dynamic data. An error will therefore be reported if any differences are found at runtime.
The following approach reads the entire caption into a variable; and then searches this for the existence of the required text. An error is logged if the required text value is not found:
        [ ] SWTest.SetActive ()
              [ ]
              [ ] // VERIFY 'Real Time' appears in the title bar
              [ ] STRING cCaption // variable to store caption at runtime
              [ ] cCaption = SWTest.GetCaption() // read caption into variable
              [ ] STRING sExpected = "Real Time" // specify the text to verify
              [ ] BOOLEAN bFound
              [ ] bFound = MatchStr(sExpected, cCaption)
              [ ] if bFound = FALSE
              [ ] LogError("The Expected value '{Real Time}' was not Found!")
Incident #2427833