Handling Login Windows in Non-Web Applications that Use the Classic Agent

Although a non-Web application’s main window is usually displayed first, it is also common for a login or security window to be displayed before the main window.

Use the wStartup constant and the Invoke method

To handle login windows, record a declaration for the login window, set the value of the wStartup constant, and write a new Invoke method for the main window that enters the appropriate information into the login window and dismisses it. This enables the DefaultBaseState routine to perform the actions necessary to get past the login window.

You do not need to use this procedure for splash screens, which disappear on their own.

  1. Open the login window that precedes the application’s main window.
  2. Open the test frame.
  3. Click Record > Window Declarations to record a declaration for the window.
  4. Point to the title bar of the window and then press Ctrl+Alt. The declaration is captured in the Record Window Declarations dialog box.
  5. Click Paste to Editor to paste the declaration into the test frame.
  6. In the Record Window Declarations dialog box, click Close.
  7. Close your application.
  8. In your test frame file, find the stub of the declaration for the wStartup constant, located at the top of the declaration for the main window:
    // First window to appear when application is invoked
    // const wStartup = ?
  9. Complete the declaration for the wStartup constant by:
    • Removing the comment characters, the two forward slash characters, at the beginning of the declaration.
    • Replacing the question mark with the identifier of the login window, as recorded in the window declaration for the login window.
  10. Click the wStartup constant and then click Record > Method.
  11. On the Record Method dialog box, from the Method Name list box, select Invoke.
  12. Open your application, but do not dismiss the login window.
  13. Click Start Recording. Silk Test Classic is minimized and your application and the Silk Test Record Status dialog box open.
  14. Perform and the record the actions that you require.
  15. On the Silk Test Record Status dialog box, click Done. The Record Method dialog box opens with the actions you recorded translated into 4Test statements.
  16. On the Record Method dialog box, click OK to paste the code into your include file.
  17. Edit the 4Test statements that were recorded, if necessary.
  18. Define an Invoke method in the main window declaration that calls the built-in Invoke method and additionally performs any actions required by the login window, such as entering a name and password.

    After following this procedure, your test frame might look like this:

    window MainWin MyApp
       tag "My App"
       const wStartup = Login
    
       // the declarations for the MainWin should go here
       Invoke () 
          derived::Invoke ()
          Login.Name.SetText ("Your name")
          Login.Password.SetText ("password")
          Login.OK.Click ()
    
    window DialogBox Login
       tag "Login"
    
       // the declarations for the Login window go here
       PushButton OK 
          tag "OK"

    About the derived keyword and scope resolution operator

    Notice the statement derived::Invoke ( ). That statement uses the derived keyword followed by the scope resolution operator ( :: ) to call the built-in Invoke method, before performing the operations needed to fill in and dismiss the login window.