Notification Test Example Code (2 of 2)

This functionality is supported only if you are using the Classic Agent.

This is the complete test case file for a two-user notification test. It shows the next level of complexity in testing client/server notification operations. For additional information on the testing technique, see Notification Example 2 Explained.

//------------------------------------------------------------
// This testcase logs in as user QAtest1 on the first machine,
// and logs in as user QAtest2 on the second machine; then 
// sends a message from the user on the first machine to the
// user on the second machine; it then switches to the second
// machine and waits to be notified that new mail has arrived.
//

multitestcase TwoUserNotification ( STRING sMachine1, STRING sMachine2 )

  //=== MULTI-APPLICATION SETUP SECTION ===================//
  SetUpMachine( sMachine1, CcMail )
  SetUpMachine( sMachine2, CcMail, "EnsureInBoxIsEmpty" )
  SetMachineData( sMachine1, "Username", "QAtest1" )
  SetMachineData( sMachine1, "Password", "QAtest1" )
  SetMachineData( sMachine2, "Username", "QAtest2" )
  SetMachineData( sMachine2, "Password", "QAtest2" )
  SetMultiAppStates()

  //=== TEST BEGINS HERE ==================================//
  //---------------------------------------------------------
  // Switch to the first machine:
  SetMachine( sMachine1 )

  // Send mail from user 1 to user 2
  SimpleMessage("QAtest2", "Message to user 2", "Message from me to you.")

  //---------------------------------------------------------
  // Switch to the second machine:
  SetMachine( sMachine2 )

  // Wait for notification to occur, then acknowledge it:
  Verify( CcMailNewMailAlert.Exists( NOTIFICATION_TIMEOUT ), TRUE )
  Verify( CcMailNewMailAlert.IsActive(), TRUE, "ALERT" )
  CcMailNewMailAlert.OK.Click()

  // Refresh the In box and check that a message is waiting there:
  CcMail.xWindow.GoToInbox.Pick ()
  Verify( CcMail.Message.DeleteMessage.IsEnabled(), TRUE,
    "MESSAGE WAITING" )