Notification Test Example Explained (1 of 2)

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

The first line in the test case file is a comment that lists the name of the file holding this code.
// csmail.t
The next line is an include statement. The explanations for each fragment of code follow that code.
use "ccmail.inc"
The ccmail.inc file is defined for this test case. It contains the window declarations for the application in addition to application state definitions and definitions for general-purpose utility functions also needed by other test cases designed for this application. You can find the ccmail.inc file in the Silk Test Classic Examples directory. Code fragments from that file are included as needed in this discussion.
LogMeIn()
  LogInUser(GetMachineData(NULL, "Username"), 
    GetMachineData(NULL, "Password") )
The utility function LogMeIn is called by the invoke method for the CC Mail main window, called CcMail. The LogInUser function is defined in ccmail.inc. The machine data that LogInUser retrieves for its arguments gets established by each test before the application state function for each machine is invoked.
multitestcase SingleUserNotification (STRING sMachine1)
The function declaration for the test case passes in the name of the Agent for the machine on which the application is running.
if(sMachine1 == NULL)
  sMachine1 = "(local)"
This if statement if statement allows you to invoke the test case without specifying a machine name when you want to run on the local machine.
SetUpMachine(sMachine1, CcMail, "EnsureInBoxIsEmpty")

The SetUpMachine function provides the name of the main application window, CcMail, and the application state (EnsureInBoxIsEmpty) to be established by Silk Test Classic. EnsureInBoxIsEmpty is defined in ccmail.inc. This statement is part of the standard setup code for multi-application tests. The standard multi-application setup code is documented in template.t Explained and Concurrency Test Example Code. The setup code in this test case is essentially the same.

This is a single-user test case and therefore does not actually need the setup methodology required by a multi-application test. However, since client/server testing is frequently multi-application testing, all the example test cases use the multi-application coding methods. We recommend that you also follow this practice, since consistency of testing styles reduces coding errors in your test cases.

One difference for this test case is that this is an application that requires the user to log in. Therefore the following code fragment provides the user name and password for the application under test:
SetMachineData (sMachine1, "Username", "QAtest1")
SetMachineData (sMachine1, "Password", "QAtest1")
These statements associate two pieces of information, named "Username" and "Password," with the specified machine. In both cases the value of the associated information is the same, "QAtest1." Now that this information is available to the application state function, that function can log the user in. This will happen as a result of the next statement.
SetMultiAppStates()

In this test, SetMultiAppStates function will actually only set the application state for the one machine.

SimpleMessage ("QAtest1", "Message to myself", 
  "A message to myself")

The above line invokes the utility function from ccmail.inc, which sends the short message to the local machine.