4. Modifying Script and Assigning Input Values

Applies to TestComplete 15.69, last modified on November 13, 2024

Dividing the Recorded Script into Several Routines

Let’s take a look at the recorded code:

JavaScript, JScript

function Test1()
{
  var orders;
  var mainForm;
  var orderForm;
  var groupBox;
  var numericUpDown;
  var textBox;
  // Launching the Orders application
  TestedApps.RunAll();
  // Opening the Order form
  orders = Aliases.Orders;
  mainForm = orders.MainForm;
  mainForm.MainMenu.Click("Orders|New order...");
  // Populating the Order form
  orderForm = orders.OrderForm;
  groupBox = orderForm.Group;
  groupBox.ProductNames.ClickItem("FamilyAlbum");
  numericUpDown = groupBox.Quantity;
  numericUpDown.Click(8, 7);
  numericUpDown.wValue = 20;
  groupBox.Date.wDate = "5/6/2005";
  textBox = groupBox.Customer;
  textBox.Click(69, 12);
  textBox.wText = "John Smith Jr";
  textBox = groupBox.Street;
  textBox.Click(4, 8);
  textBox.wText = "12, Orange Blvd";
  textBox = groupBox.City;
  textBox.Click(12, 14);
  textBox.wText = "Grovetown, CA";
  textBox = groupBox.State;
  textBox.Click(21, 6);
  textBox.wText = "US";
  textBox = groupBox.Zip;
  textBox.Click(14, 14);
  textBox.wText = "111155";
  groupBox.MasterCard.ClickButton();
  textBox = groupBox.CardNo;
  textBox.Click(35, 15);
  textBox.wText = "555777555888";
  groupBox.ExpDate.wDate = "5/6/2005";
  // Creating checkpoints
  aqObject.CheckProperty(Aliases.Orders.OrderForm.Group.Price, "wText", cmpEqual, "$80", false);
  aqObject.CheckProperty(Aliases.Orders.OrderForm.Group.Discount, "wText", cmpEqual, "15%", false);
  aqObject.CheckProperty(Aliases.Orders.OrderForm.Group.groupBox1.Total, "wText", cmpEqual, "1360", false);
  // Closing the Order form
  orderForm.ButtonOK.ClickButton();
  // Closing the application
  mainForm.Close();
  orders.dlgConfirmation.btnNo.ClickButton();
}

Python

def Test1():
  #Launching the tested application
  TestedApps.RunAll()
  #Opening the Order form
  orders = Aliases.Orders
  mainForm = orders.MainForm
  mainForm.MainMenu.Click("Orders|New order...")
  #Populating the Order form
  orderForm = orders.OrderForm;
  groupBox = orderForm.Group;
  groupBox.ProductNames.ClickItem("FamilyAlbum")
  numericUpDown = groupBox.Quantity
  numericUpDown.Click(8, 7)
  numericUpDown.wValue = 20
  groupBox.Date.wDate = "5/6/2005"
  textBox = groupBox.Customer
  textBox.Click(69, 12)
  textBox.settext("John Smith Jr")
  textBox = groupBox.Street
  textBox.Click(4, 8)
  textBox.wText = "12, Orange Blvd"
  textBox = groupBox.City
  textBox.Click(12, 14)
  textBox.wText = "Grovetown, CA"
  textBox = groupBox.State
  textBox.Click(21, 6)
  textBox.wText = "US"
  textBox = groupBox.Zip
  textBox.Click(14, 14)
  textBox.wText = "111155"
  groupBox.MasterCard.ClickButton()
  textBox = groupBox.CardNo
  textBox.Click(35, 15)
  textBox.wText = "555777555888"
  groupBox.ExpDate.wDate = "5/6/2005"
  #Creating checkpoints
  aqObject.CheckProperty(Aliases.Orders.OrderForm.Group.Price, "wText", cmpEqual, "$80")
  aqObject.CheckProperty(Aliases.Orders.OrderForm.Group.Discount, "wText", cmpEqual, "15%")
  aqObject.CheckProperty(Aliases.Orders.OrderForm.Group.groupBox1.Total, "wText", cmpEqual, "1360")
  #Closing the Orders form
  orderForm.ButtonOK.ClickButton()
  #Closing the Orders application
  mainForm.Close()
  orders.dlgConfirmation.btnNo.ClickButton()

VBScript

Sub Test1
  Dim orders
  Dim mainForm
  Dim orderForm
  Dim groupBox
  Dim numericUpDown
  Dim textBox
  ' Launching the Orders application
  TestedApps.RunAll
  ' Opening the Order form
  Set orders = Aliases.Orders
  Set mainForm = orders.MainForm
  Call mainForm.MainMenu.Click("Orders|New order...")
  ' Populating the Order form
  Set orderForm = orders.OrderForm
  Set groupBox = orderForm.Group
  Call groupBox.ProductNames.ClickItem("FamilyAlbum")
  Set numericUpDown = groupBox.Quantity
  Call numericUpDown.Click(37, 9)
  numericUpDown.wValue = 20
  groupBox.Date.wDate = "5/6/2005"
  Set textBox = groupBox.Customer
  Call textBox.Click(39, 7)
  textBox.wText = "John Smith Jr"
  Set textBox = groupBox.Street
  Call textBox.Click(66, 7)
  textBox.wText = "12, Orange Blvd"
  Set textBox = groupBox.City
  Call textBox.Click(72, 9)
  textBox.wText = "Grovetown, CA"
  Set textBox = groupBox.State
  Call textBox.Click(98, 9)
  textBox.wText = "US"
  Set textBox = groupBox.Zip
  Call textBox.Click(31, 12)
  textBox.wText = "111155"
  groupBox.MasterCard.ClickButton
  Set textBox = groupBox.CardNo
  Call textBox.Click(53, 12)
  textBox.wText = "555777555888"
  groupBox.ExpDate.wDate = "5/6/2005"
  ' Creating checkpoints
  Call aqObject.CheckProperty(Aliases.Orders.OrderForm.Group.Price, "wText", cmpEqual, "$80", False)
  Call aqObject.CheckProperty(Aliases.Orders.OrderForm.Group.Discount, "wText", cmpEqual, "15%", False)
  Call aqObject.CheckProperty(Aliases.Orders.OrderForm.Group.groupBox1.Total, "wText", cmpEqual, "1360", False)
  ' Closing the Order form
  orderForm.ButtonOK.ClickButton
  ' Closing the application
  mainForm.Close
  orders.dlgConfirmation.btnNo.ClickButton
End Sub

DelphiScript

procedure Test1;
  var orders : OleVariant;
  var mainForm : OleVariant;
  var orderForm : OleVariant;
  var groupBox : OleVariant;
  var numericUpDown : OleVariant;
  var textBox : OleVariant;
begin
  // Launching the Orders application
  TestedApps.RunAll;
  // Opening the Order form
  orders := Aliases.Orders;
  mainForm := orders.MainForm;
  mainForm.MainMenu.Click('Orders|New order...');
  // Populating the Order form
  orderForm := orders.OrderForm;
  groupBox := orderForm.Group;
  groupBox.ProductNames.ClickItem('FamilyAlbum');
  numericUpDown := groupBox.Quantity;
  numericUpDown.Click(37, 9);
  numericUpDown.wValue := 20;
  groupBox.Date.wDate := '5/6/2005';
  textBox := groupBox.Customer;
  textBox.Click(67, 17);
  textBox.wText := 'John Smith Jr';
  textBox := groupBox.Street;
  textBox.Click(31, 5);
  textBox.wText := '12, Orange Blvd';
  textBox := groupBox.City;
  textBox.Click(47, 15);
  textBox.wText := 'Grovetown, CA';
  textBox := groupBox.State;
  textBox.Click(82, 4);
  textBox.wText := 'US';
  textBox := groupBox.Zip;
  textBox.Click(10, 8);
  textBox.wText := '111155';
  groupBox.MasterCard.ClickButton;
  textBox := groupBox.CardNo;
  textBox.Click(46, 9);
  textBox.wText := '555777555888';
  groupBox.ExpDate.wDate := '5/6/2005';
  // Creating checkpoints
  aqObject.CheckProperty(Aliases.Orders.OrderForm.Group.Price, 'wText', cmpEqual, '$80', false);
  aqObject.CheckProperty(Aliases.Orders.OrderForm.Group.Discount, 'wText', cmpEqual, '15%', false);
  aqObject.CheckProperty(Aliases.Orders.OrderForm.Group.groupBox1.Total, 'wText', cmpEqual, '1360', false);
  // Closing the Order form
  orderForm.ButtonOK.ClickButton;
  // Closing the application
  mainForm.Close;
  orders.dlgConfirmation.btnNo.ClickButton;
end;

C++Script, C#Script

function Test1()
{
  var orders;
  var mainForm;
  var orderForm;
  var groupBox;
  var numericUpDown;
  var textBox;
  // Launching the Orders application
  TestedApps["RunAll"]();
  // Opening the Order form
  orders = Aliases["Orders"];
  mainForm = orders["MainForm"];
  mainForm["MainMenu"]["Click"]("Orders|New order...");
  // Populating the Order form
  orderForm = orders["OrderForm"];
  groupBox = orderForm["Group"];
  groupBox["ProductNames"]["ClickItem"]("FamilyAlbum");
  numericUpDown = groupBox["Quantity"];
  numericUpDown["Click"](37, 9);
  numericUpDown["wValue"] = 20;
  groupBox["Date"]["wDate"] = "5/6/2005";
  textBox = groupBox["Customer"];
  textBox["Click"](43, 7);
  textBox["wText"] = "John Smith Jr";
  textBox = groupBox["Street"];
  textBox["Click"](31, 11);
  textBox["wText"] = "12, Orange Blvd";
  textBox = groupBox["City"];
  textBox["Click"](24, 6);
  textBox["wText"] = "Grovetown, CA";
  textBox = groupBox["State"];
  textBox["Click"](31, 8);
  textBox["wText"] = "US";
  textBox = groupBox["Zip"];
  textBox["Click"](24, 17);
  textBox["wText"] = "111155";
  groupBox["MasterCard"]["ClickButton"]();
  textBox = groupBox["CardNo"];
  textBox["Click"](19, 7);
  textBox["wText"] = "555777555888";
  groupBox["ExpDate"]["wDate"] = "5/6/2005";
  // Creating checkpoints
  aqObject.CheckProperty(Aliases["Orders"]["OrderForm"]["Group"]["Price"], "wText", cmpEqual, "$80", false);
  aqObject.CheckProperty(Aliases["Orders"]["OrderForm"]["Group"]["Discount"], "wText", cmpEqual, "15%", false);
  aqObject.CheckProperty(Aliases["Orders"]["OrderForm"]["Group"]["groupBox1"]["Total"], "wText", cmpEqual, "1360", false);
  // Closing the Order form
  orderForm["ButtonOK"]["ClickButton"]();
  // Closing the application
  mainForm["Close"]();
  orders["dlgConfirmation"]["btnNo"]["ClickButton"]();
}

Comments divide the recorded code into the parts responsible for executing the Orders application, opening the Order form, populating the form, verifying the output values of the form fields, closing the form, and closing the application. Now we can place each code part in a single routine. These routines will be called from the Main routine.

Here is the list of routines:

  • The OpenForm routine is responsible for opening the Order form. Copy the strings situated under the "Opening the Order form" comment in the recorded code to the body of the OpenForm routine. The routine will have the following code:

    JavaScript, JScript

    function OpenForm()
    {
      orders = Aliases.Orders;
      mainForm = orders.MainForm;
      mainForm.MainMenu.Click("Orders|New order...");
    }

    Python

    def OpenForm():
      orders = Aliases.Orders
      mainForm = orders.MainForm
      mainForm.MainMenu.Click("Orders|New order...")

    VBScript

    Sub OpenForm
      Set orders = Aliases.Orders
      Set mainForm = orders.MainForm
      Call mainForm.MainMenu.Click("Orders|New order...")
    End Sub

    DelphiScript

    procedure OpenForm;
    begin
      orders := Aliases.Orders;
      mainForm := orders.MainForm;
      mainForm.MainMenu.Click('Orders|New order...');
    end;

    C++Script, C#Script

    function OpenForm()
    {
      orders = Aliases["Orders"];
      mainForm = orders["MainForm"];
      mainForm["MainMenu"]["Click"]("Orders|New order...");
    }

  • The PopulateForm routine is responsible for populating the Order form. Copy the strings situated under the "Populating the Order form" comment in the recorded code to the body of the PopulateForm routine. The routine will have the following code:

    JavaScript, JScript

    function PopulateForm()
    {
      orderForm = orders.OrderForm;
      groupBox = orderForm.Group;
      groupBox.ProductNames.ClickItem("FamilyAlbum");
      numericUpDown = groupBox.Quantity;
      numericUpDown.Click(8, 7);
      numericUpDown.wValue = 20;
      groupBox.Date.wDate = "5/6/2005";
      textBox = groupBox.Customer;
      textBox.Click(69, 12);
      textBox.wText = "John Smith Jr";
      textBox = groupBox.Street;
      textBox.Click(4, 8);
      textBox.wText = "12, Orange Blvd";
      textBox = groupBox.City;
      textBox.Click(12, 14);
      textBox.wText = "Grovetown, CA";
      textBox = groupBox.State;
      textBox.Click(21, 6);
      textBox.wText = "US";
      textBox = groupBox.Zip;
      textBox.Click(14, 14);
      textBox.wText = "111155";
      groupBox.MasterCard.ClickButton();
      textBox = groupBox.CardNo;
      textBox.Click(35, 15);
      textBox.wText = "555777555888";
      groupBox.ExpDate.wDate = "5/6/2005";
    }

    Python

    def PopulateForm():
      orderForm = orders.OrderForm;
      groupBox = orderForm.Group;
      groupBox.ProductNames.ClickItem("FamilyAlbum")
      numericUpDown = groupBox.Quantity
      numericUpDown.Click(8, 7)
      numericUpDown.wValue = 20
      groupBox.Date.wDate = "5/6/2005"
      textBox = groupBox.Customer
      textBox.Click(69, 12)
      textBox.settext("John Smith Jr")
      textBox = groupBox.Street
      textBox.Click(4, 8)
      textBox.wText = "12, Orange Blvd"
      textBox = groupBox.City
      textBox.Click(12, 14)
      textBox.wText = "Grovetown, CA"
      textBox = groupBox.State
      textBox.Click(21, 6)
      textBox.wText = "US"
      textBox = groupBox.Zip
      textBox.Click(14, 14)
      textBox.wText = "111155"
      groupBox.MasterCard.ClickButton()
      textBox = groupBox.CardNo
      textBox.Click(35, 15)
      textBox.wText = "555777555888"
      groupBox.ExpDate.wDate = "5/6/2005"

    VBScript

    Sub PopulateForm
      Set orderForm = orders.OrderForm
      Set groupBox = orderForm.Group
      Call groupBox.ProductNames.ClickItem("FamilyAlbum")
      Set numericUpDown = groupBox.Quantity
      Call numericUpDown.Click(37, 9)
      numericUpDown.wValue = 20
      groupBox.Date.wDate = "5/6/2005"
      Set textBox = groupBox.Customer
      Call textBox.Click(39, 7)
      textBox.wText = "John Smith Jr"
      Set textBox = groupBox.Street
      Call textBox.Click(66, 7)
      textBox.wText = "12, Orange Blvd"
      Set textBox = groupBox.City
      Call textBox.Click(72, 9)
      textBox.wText = "Grovetown, CA"
      Set textBox = groupBox.State
      Call textBox.Click(98, 9)
      textBox.wText = "US"
      Set textBox = groupBox.Zip
      Call textBox.Click(31, 12)
      textBox.wText = "111155"
      groupBox.MasterCard.ClickButton
      Set textBox = groupBox.CardNo
      Call textBox.Click(53, 12)
      textBox.wText = "555777555888"
      groupBox.ExpDate.wDate = "5/6/2005"
    End Sub

    DelphiScript

    procedure PopulateForm;
    begin
      orderForm := orders.OrderForm;
      groupBox := orderForm.Group;
      groupBox.ProductNames.ClickItem('FamilyAlbum');
      numericUpDown := groupBox.Quantity;
      numericUpDown.Click(37, 9);
      numericUpDown.wValue := 20;
      groupBox.Date.wDate := '5/6/2005';
      textBox := groupBox.Customer;
      textBox.Click(67, 17);
      textBox.wText := 'John Smith Jr';
      textBox := groupBox.Street;
      textBox.Click(31, 5);
      textBox.wText := '12, Orange Blvd';
      textBox := groupBox.City;
      textBox.Click(47, 15);
      textBox.wText := 'Grovetown, CA';
      textBox := groupBox.State;
      textBox.Click(82, 4);
      textBox.wText := 'US';
      textBox := groupBox.Zip;
      textBox.Click(10, 8);
      textBox.wText := '111155';
      groupBox.MasterCard.ClickButton;
      textBox := groupBox.CardNo;
      textBox.Click(46, 9);
      textBox.wText := '555777555888';
      groupBox.ExpDate.wDate := '5/6/2005';
    end;

    C++Script, C#Script

    function PopulateForm()
    {
      orderForm = orders["OrderForm"];
      groupBox = orderForm["Group"];
      groupBox["ProductNames"]["ClickItem"]("FamilyAlbum");
      numericUpDown = groupBox["Quantity"];
      numericUpDown["Click"](37, 9);
      numericUpDown["wValue"] = 20;
      groupBox["Date"]["wDate"] = "5/6/2005";
      textBox = groupBox["Customer"];
      textBox["Click"](43, 7);
      textBox["wText"] = "John Smith Jr";
      textBox = groupBox["Street"];
      textBox["Click"](31, 11);
      textBox["wText"] = "12, Orange Blvd";
      textBox = groupBox["City"];
      textBox["Click"](24, 6);
      textBox["wText"] = "Grovetown, CA";
      textBox = groupBox["State"];
      textBox["Click"](31, 8);
      textBox["wText"] = "US";
      textBox = groupBox["Zip"];
      textBox["Click"](24, 17);
      textBox["wText"] = "111155";
      groupBox["MasterCard"]["ClickButton"]();
      textBox = groupBox["CardNo"];
      textBox["Click"](19, 7);
      textBox["wText"] = "555777555888";
      groupBox["ExpDate"]["wDate"] = "5/6/2005";
    }

  • The Checkpoint routine is responsible for verifying the output values of the Order form. Copy the strings situated under the "Creating checkpoints" comment in the recorded code to the body of the Checkpoint routine. The routine will have the following code:

    JavaScript, JScript

    function Checkpoint()
    {
      aqObject.CheckProperty(Aliases.Orders.OrderForm.Group.Price, "wText", cmpEqual, "$80", false);
      aqObject.CheckProperty(Aliases.Orders.OrderForm.Group.Discount, "wText", cmpEqual, "15%", false);
      aqObject.CheckProperty(Aliases.Orders.OrderForm.Group.groupBox1.Total, "wText", cmpEqual, "1360", false);
    }

    Python

    def Checkpoint(Driver):
      aqObject.CheckProperty(Aliases.Orders.OrderForm.Group.Price, "wText", cmpEqual, "$80", False)
      aqObject.CheckProperty(Aliases.Orders.OrderForm.Group.Discount, "wText", cmpEqual, "15%", False)
      aqObject.CheckProperty(Aliases.Orders.OrderForm.Group.groupBox1.Total, "wText", cmpEqual, "1360", False)

    VBScript

    Sub Checkpoint
      Call aqObject.CheckProperty(Aliases.Orders.OrderForm.Group.Price, "wText", cmpEqual, "$80", False)
      Call aqObject.CheckProperty(Aliases.Orders.OrderForm.Group.Discount, "wText", cmpEqual, "15%", False)
      Call aqObject.CheckProperty(Aliases.Orders.OrderForm.Group.groupBox1.Total, "wText", cmpEqual, "1360", False)
    End Sub

    DelphiScript

    procedure Checkpoint;
    begin
      aqObject.CheckProperty(Aliases.Orders.OrderForm.Group.Price, 'wText', cmpEqual, '$80', false);
      aqObject.CheckProperty(Aliases.Orders.OrderForm.Group.Discount, 'wText', cmpEqual, '15%', false);
      aqObject.CheckProperty(Aliases.Orders.OrderForm.Group.groupBox1.Total, 'wText', cmpEqual, '1360', false);
    end;

    C++Script, C#Script

    function Checkpoint()
    {
      aqObject.CheckProperty(Aliases["Orders"]["OrderForm"]["Group"]["Price"], "wText", cmpEqual, "$80", false);
      aqObject.CheckProperty(Aliases["Orders"]["OrderForm"]["Group"]["Discount"], "wText", cmpEqual, "15%", false);
      aqObject.CheckProperty(Aliases["Orders"]["OrderForm"]["Group"]["groupBox1"]["Total"], "wText", cmpEqual, "1360", false);
    }

  • The CloseForm routine is responsible for closing the Order form. Copy the strings situated under the "Closing the Order form" comment in the recorded code to the body of the CloseForm routine. The routine will have the following code:

    JavaScript, JScript

    function CloseForm()
    {
      orderForm.ButtonOK.ClickButton();
    }

    Python

    def CloseForm(orderForm):
      orderForm.ButtonOK.ClickButton()

    VBScript

    Sub CloseForm
      orderForm.ButtonOK.ClickButton
    End Sub

    DelphiScript

    procedure CloseForm;
    begin
      orderForm.ButtonOK.ClickButton;
    end;

    C++Script, C#Script

    function CloseForm()
    {
      orderForm["ButtonOK"]["ClickButton"]();
    }

  • The CloseApplication routine is responsible for closing the Order form. Copy the strings situated under the " Closing the Order form" comment in the recorded code to the body of the CloseApplication routine. The routine will have the following code:

    JavaScript, JScript

    function CloseApplication()
    {
      mainForm.Close();
      orders.dlgConfirmation.btnNo.ClickButton();
    }

    Python

    def CloseApplication():
      mainForm.Close()
      orders.dlgConfirmation.btnNo.ClickButton()

    VBScript

    Sub CloseApplication
      mainForm.Close
      orders.dlgConfirmation.btnNo.ClickButton
    End Sub

    DelphiScript

    procedure CloseApplication;
    begin
      mainForm.Close;
      orders.dlgConfirmation.btnNo.ClickButton;
    end;

    C++Script, C#Script

    function CloseApplication()
    {
      mainForm["Close"]();
      orders["dlgConfirmation"]["btnNo"]["ClickButton"]();
    }

The created routines code is now in the rough stages. It’s final modification is displayed below.

Creating the Main Routine

The routines described above are called from the Main routine during its execution. Thus, the Main routine code should contain calls to these routines in the same sequence as they are described. The routine will have the following code:

JavaScript, JScript

function Main()
{
    TestedApps.RunAll();
    OpenForm();
    PopulateForm();
    Checkpoint();
    CloseForm();
    CloseApplication();
}

Python

def Main():
    OpenForm()
    PopulateForm()
    Checkpoint()
    CloseForm()
    CloseApplication()

VBScript

Sub Main
    TestedApps.RunAll
    OpenForm
    PopulateForm
    Checkpoint
    CloseForm
    CloseApplication
End Sub

DelphiScript

procedure Main;
begin
    TestedApps.RunAll;
    OpenForm;
    PopulateForm;
    Checkpoint;
    CloseForm;
    CloseApplication;
end;

C++Script, C#Script

function Main()
{
    TestedApps["RunAll"]();
    OpenForm();
    PopulateForm();
    Checkpoint();
    CloseForm();
    CloseApplication();
}

Modifying the Main Routine Code

The references to objects held in the orders, mainForm, orderForm, groupBox variables are used in several routines called from the Main one. To access the values of these variables from other routines you should declare them in the Main routine. The values should also be assigned to these variables in the Main routine. Move the strings that assign the values to orders and mainForm variables from the OpenForm routine and the strings that assign the values to orderForm and groupBox variables from the PopulateForm routine to the Main routine.

To access the data storage in the script the string that specifies the DDTDriver object to be used to access the storage needs to be moved to the beginning of the routine code. This string assigns the reference to a DDTDriver object to the Driver variable. This variable also should be declared in the Main routine.

Pay attention to the value of the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Jet\4.0\Engines\Excel\FirstRowHasNames registry key. This key specifies whether the first row of the table is recognized as a header or as data. If you use the first row of the table as a header, you should make sure that the key value is 01. If the first row of the table stores data, the key value should be 00. If a row is not empty, it is considered as the first row. Otherwise, it is ignored. For more information, see Using DDT Drivers.

To provide multiple test iterations we need to create a loop. The loop body should contain calls of OpenForm, PopulateForm, Checkpoints, and CloseForm routines. The loop exit condition is the true value of the DDTDriver.EOF property. We use one row of a data table per iteration place call of the DDTDriver.Next method before the end of the loop.

After all modifications the Main routine has the following code:

JavaScript, JScript

function Main()
{
    Driver = DDT.ExcelDriver("../../TestBook.xlsx", "TestSheet", true)
    TestedApps.RunAll();
    orders = Aliases.Orders;
    mainForm = orders.MainForm;
    while(!Driver.EOF())
    {
      OpenForm();
      orderForm = orders.OrderForm;
      groupBox = orderForm.Group;
      PopulateForm();
      Checkpoint();
      CloseForm();
      Driver.Next();
    }
    CloseApplication();
}

Python

def Main():
  Driver = DDT.ExcelDriver("../../../TestBook.xlsx", "TestSheet", True)
  TestedApps.RunAll()
  orders = Aliases.Orders
  mainForm = orders.MainForm
  while not Driver.EOF():
    OpenForm()
    orderForm = orders.OrderForm
    groupBox = orderForm.Group
    PopulateForm()
    Checkpoint()
    CloseForm()
    Driver.Next()
  CloseApplication()

VBScript

Sub Main
    Set Driver = DDT.ExcelDriver("../../TestBook.xlsx", "TestSheet", True)
    TestedApps.RunAll
    Set orders = Aliases.Orders
    Set mainForm = orders.MainForm
    While Not Driver.EOF
      OpenForm
      Set orderForm = orders.OrderForm
      Set GroupBox = orderForm.Group
      PopulateForm
      Checkpoint
      CloseForm
      Driver.Next
    Wend
    CloseApplication
End Sub

DelphiScript

procedure Main;
begin
    Driver := DDT.ExcelDriver('../../TestBook.xlsx', 'TestSheet', true);
    TestedApps.RunAll;
    orders := Aliases.Orders;
    mainForm := orders.MainForm;
    while not Driver.EOF do
    begin
      OpenForm;
      orderForm := orders.OrderForm;
      groupBox := orderForm.Group;
      PopulateForm;
      Checkpoint;
      CloseForm;
      Driver.Next;
    end;
    CloseApplication;
end;

C++Script, C#Script

function Main()
{
    Driver = DDT["ExcelDriver"]("../../TestBook.xlsx", "TestSheet", true)
    TestedApps["RunAll"]();
    orders = Aliases["Orders"];
    mainForm = orders["MainForm"];
    while(!Driver["EOF"]())
    {
      OpenForm();
      orderForm = orders["OrderForm"];
      groupBox = orderForm["Group"];
      PopulateForm();
      Checkpoint();
      CloseForm();
      Driver["Next"]();
    }
    CloseApplication();
}

The Main routine is almost ready. You should only paste the input parameters into strings used to call other routines.

Modifying the OpenForm, PopulateForm, Checkpoint, CloseForm, CloseApplication Routines

The values of the variables declared in the Main routine are used in other routines. You should declare each variable used in a routine as its input parameter, with the exception of the numericUpDown and textBox variables. The numericUpDown and textBox variables are used in the PopulateForm routine only. That is why these variables should be declared as local variables in the PopulateForm routine. Thus routines will have the following input parameters: OpenForm(mainForm), PopulateForm(groupBox), Checkpoint(), CloseForm(orderForm), CloseApplication(orders, mainForm). But the PopulateForm and Checkpoint routines will have one more input parameter. It will be described in the next section of this topic.

The strings used to assign values to the orders, mainForm, orderForm, groupBox variables are moved from the OpenForm and PopulateForm routines to the Main routine.

Retrieving Data from the Storage

The driver used to access the data storage is specified in the Main routine. To use this driver in the PopulateForm and Checkpoint routines, declare Driver as an input parameter. To populate the Order form with values retrieved from the data storage you should modify the PopulateForm routine code. Change the values specified while recording the script, to calls of the Driver.Value property with the appropriate index. You can find the values and the indexes in the following table:

Field name Recorded value Driver.Value property
Customer "John Smith Jr" Driver.Value(0)
Product "FamilyAlbum" Driver.Value(1)
Quantity "20" Driver.Value(2)
Date "06.05.2005" Driver.Value(3)
Street "12, Orange Blvd" Driver.Value(4)
City "Grovetown, CA" Driver.Value(5)
State "US" Driver.Value(6)
ZIP "111155" Driver.Value(7)
Card No "555777555888" Driver.Value(9)
Expiration Date "06.05.2005" Driver.Value(10)
Note: You may want to set the data type of a value explicitly. In this case, see the Retrieving Input Data From Storage topic.

In addition you should change the groupBox.MasterCard.ClickButton line in the routine code. This line is used to check an option button. Use the WinFormsObject(Driver.Value(8)) object instead of the MasterCard one. It allows you to check the object specified by name. The name of the option button is specified by the Driver.Value(8) property.

To compare the output values of Order form fields with values retrieved from the data storage you should modify the Checkpoint routine code. Change the values specified, while recording the script, to calls of the Driver.Value property with the appropriate index. You can find the values and the appropriate Driver.Value property indexes in the following table:

Field name Recorded value Driver.Value property
Price per unit "$80" Driver.Value(11)
Discount "15%" Driver.Value(12)
Total "1360" Driver.Value(13)

Thus the PopulateForm and Checkpoint routines will have the following code:

JavaScript, JScript

function PopulateForm(groupBox, Driver)
{
  var numericUpDown, textBox;

  groupBox.ProductNames.ClickItem(Driver.Value(1));
  numericUpDown = groupBox.Quantity;
  numericUpDown.Click(8, 7);
  numericUpDown.wValue = Driver.Value(2);
  groupBox.Date.wDate = Driver.Value(3);
  textBox = groupBox.Customer;
  textBox.Click(69, 12);
  textBox.wText = Driver.Value(0);
  textBox = groupBox.Street;
  textBox.Click(4, 8);
  textBox.wText = Driver.Value(4);
  textBox = groupBox.City;
  textBox.Click(12, 14);
  textBox.wText = Driver.Value(5);
  textBox = groupBox.State;
  textBox.Click(21, 6);
  textBox.wText = Driver.Value(6);
  textBox = groupBox.Zip;
  textBox.Click(14, 14);
  textBox.wText = Driver.Value(7);
  groupBox.WinFormsObject(Driver.Value(8)).ClickButton();
  textBox = groupBox.CardNo;
  textBox.Click(35, 15);
  textBox.wText = Driver.Value(9);
  groupBox.ExpDate.wDate = Driver.Value(10);
}

function Checkpoint(Driver)
{
  aqObject.CheckProperty(Aliases.Orders.OrderForm.Group.Price, "wText", cmpEqual, Driver.Value(11), false);
  aqObject.CheckProperty(Aliases.Orders.OrderForm.Group.Discount, "wText", cmpEqual,Driver.Value(12), false);
  aqObject.CheckProperty(Aliases.Orders.OrderForm.Group.groupBox1.Total, "wText", cmpEqual, Driver.Value(13), false);
}

Python

def PopulateForm():
  groupBox.ProductNames.ClickItem(Driver.Value[1])
  numericUpDown = groupBox.Quantity
  numericUpDown.Click(8, 7)
  numericUpDown.wValue = Driver.Value[2]
  groupBox.Date.wDate = Driver.Value[3]
  textBox = groupBox.Customer
  textBox.Click(69, 12)
  textBox.wText = Driver.Value[0]
  textBox = groupBox.Street
  textBox.Click(4, 8)
  textBox.wText = Driver.Value[4]
  textBox = groupBox.City
  textBox.Click(12, 14)
  textBox.wText = Driver.Value[5]
  textBox = groupBox.State
  textBox.Click(21, 6)
  textBox.wText = Driver.Value[6]
  textBox = groupBox.Zip
  textBox.Click(14, 14)
  textBox.wText = Driver.Value[7]
  groupBox.WinFormsObject(Driver.Value[8]).ClickButton()
  textBox = groupBox.CardNo
  textBox.Click(35, 15)
  textBox.wText = Driver.Value[9]
  groupBox.ExpDate.wDate = Driver.Value[10]

  
def Checkpoint(Driver):
  aqObject.CheckProperty(Aliases.Orders.OrderForm.Group.Price, "wText", cmpEqual, Driver.Value[11], False)
  aqObject.CheckProperty(Aliases.Orders.OrderForm.Group.Discount, "wText", cmpEqual, Driver.Value[12], False)
  aqObject.CheckProperty(Aliases.Orders.OrderForm.Group.groupBox1.Total, "wText", cmpEqual, Driver.Value[13], False)

VBScript

Sub PopulateForm(groupBox, Driver)
  Dim numericUpDown, textBox

  Call groupBox.ProductNames.ClickItem(Driver.Value(1))
  Set numericUpDown = groupBox.Quantity
  Call numericUpDown.Click(37, 9)
  numericUpDown.wValue = Driver.Value(2)
  groupBox.Date.wDate = Driver.Value(3)
  Set textBox = groupBox.Customer
  Call textBox.Click(39, 7)
  textBox.wText = Driver.Value(0)
  Set textBox = groupBox.Street
  Call textBox.Click(66, 7)
  textBox.wText = Driver.Value(4)
  Set textBox = groupBox.City
  Call textBox.Click(72, 9)
  textBox.wText = Driver.Value(5)
  Set textBox = groupBox.State
  Call textBox.Click(98, 9)
  textBox.wText = Driver.Value(6)
  Set textBox = groupBox.Zip
  Call textBox.Click(31, 12)
  textBox.wText = Driver.Value(7)
  groupBox.WinFormsObject(Driver.Value(8)).ClickButton
  Set textBox = groupBox.CardNo
  Call textBox.Click(53, 12)
  textBox.wText = Driver.Value(9)
  groupBox.ExpDate.wDate = Driver.Value(10)
End Sub

Sub Checkpoint(Driver)
  Call aqObject.CheckProperty(Aliases.Orders.OrderForm.Group.Price, "wText", cmpEqual, Driver.Value(11), False)
  Call aqObject.CheckProperty(Aliases.Orders.OrderForm.Group.Discount, "wText", cmpEqual, Driver.Value(12) , False)
  Call aqObject.CheckProperty(Aliases.Orders.OrderForm.Group.groupBox1.Total, "wText", cmpEqual, Driver.Value(13), False)
End Sub

DelphiScript

procedure PopulateForm(groupBox, Driver);
  var numericUpDown, textBox;
begin
  groupBox.ProductNames.ClickItem(Driver.Value(1));
  numericUpDown := groupBox.Quantity;
  numericUpDown.Click(37, 9);
  numericUpDown.wValue := Driver.Value(2);
  groupBox.Date.wDate := Driver.Value(3);
  textBox := groupBox.Customer;
  textBox.Click(67, 17);
  textBox.wText := Driver.Value(0);
  textBox := groupBox.Street;
  textBox.Click(31, 5);
  textBox.wText := Driver.Value(4);
  textBox := groupBox.City;
  textBox.Click(47, 15);
  textBox.wText := Driver.Value(5);
  textBox := groupBox.State;
  textBox.Click(82, 4);
  textBox.wText := Driver.Value(6);
  textBox := groupBox.Zip;
  textBox.Click(10, 8);
  textBox.wText := Driver.Value(7);
  groupBox.WinFormsObject(Driver.Value(8)).ClickButton;
  textBox := groupBox.CardNo;
  textBox.Click(46, 9);
  textBox.wText := Driver.Value(9);
  groupBox.ExpDate.wDate := Driver.Value(10);
end;

procedure Checkpoint(Driver);
begin
  aqObject.CheckProperty(Aliases.Orders.OrderForm.Group.Price, 'wText', cmpEqual, Driver.Value(11), false);
  aqObject.CheckProperty(Aliases.Orders.OrderForm.Group.Discount, 'wText', cmpEqual, Driver.Value(12), false);
  aqObject.CheckProperty(Aliases.Orders.OrderForm.Group.groupBox1.Total, 'wText', cmpEqual, Driver.Value(13), false);
end;

C++Script, C#Script

function PopulateForm(groupBox, Driver)
{
  var numericUpDown, textBox;

  groupBox["ProductNames"]["ClickItem"](Driver.Value(1));
  numericUpDown = groupBox["Quantity"];
  numericUpDown["Click"](37, 9);
  numericUpDown["wValue"] = Driver.Value(2);
  groupBox["Date"]["wDate"] = Driver.Value(3);
  textBox = groupBox["Customer"];
  textBox["Click"](43, 7);
  textBox["wText"] = Driver.Value(0);
  textBox = groupBox["Street"];
  textBox["Click"](31, 11);
  textBox["wText"] = Driver.Value(4);
  textBox = groupBox["City"];
  textBox["Click"](24, 6);
  textBox["wText"] = Driver.Value(5);
  textBox = groupBox["State"];
  textBox["Click"](31, 8);
  textBox["wText"] =Driver.Value(6);
  textBox = groupBox["Zip"];
  textBox["Click"](24, 17);
  textBox["wText"] = Driver.Value(7);
  groupBox["WinFormsObject"](Driver.Value(8))["ClickButton"]();
  textBox = groupBox["CardNo"];
  textBox["Click"](19, 7);
  textBox["wText"] = Driver.Value(9);
  groupBox["ExpDate"]["wDate"] = Driver.Value(10);
}

function Checkpoint(Driver)
{
  aqObject.CheckProperty(Aliases["Orders"]["OrderForm"]["Group"]["Price"], "wText", cmpEqual, Driver.Value(11), false);
  aqObject.CheckProperty(Aliases["Orders"]["OrderForm"]["Group"]["Discount"], "wText", cmpEqual, Driver.Value(12), false);
  aqObject.CheckProperty(Aliases["Orders"]["OrderForm"]["Group"]["groupBox1"]["Total"], "wText", cmpEqual, Driver.Value(13), false);
}

Below is the complete test script:

JavaScript, JScript

function OpenForm(mainForm)
{
  mainForm.MainMenu.Click("Orders|New order...");
}

function PopulateForm(groupBox, Driver)
{
  var numericUpDown, textBox;

  groupBox.ProductNames.ClickItem(Driver.Value(1));
  numericUpDown = groupBox.Quantity;
  numericUpDown.Click(8, 7);
  numericUpDown.wValue = Driver.Value(2);
  groupBox.Date.wDate = Driver.Value(3);
  textBox = groupBox.Customer;
  textBox.Click(69, 12);
  textBox.wText = Driver.Value(0);
  textBox = groupBox.Street;
  textBox.Click(4, 8);
  textBox.wText = Driver.Value(4);
  textBox = groupBox.City;
  textBox.Click(12, 14);
  textBox.wText = Driver.Value(5);
  textBox = groupBox.State;
  textBox.Click(21, 6);
  textBox.wText = Driver.Value(6);
  textBox = groupBox.Zip;
  textBox.Click(14, 14);
  textBox.wText = Driver.Value(7);
  groupBox.WinFormsObject(Driver.Value(8)).ClickButton();
  textBox = groupBox.CardNo;
  textBox.Click(35, 15);
  textBox.wText = Driver.Value(9);
  groupBox.ExpDate.wDate = Driver.Value(10);
}

function Checkpoint(Driver)
{
  aqObject.CheckProperty(Aliases.Orders.OrderForm.Group.Price, "wText", cmpEqual, Driver.Value(11), false);
  aqObject.CheckProperty(Aliases.Orders.OrderForm.Group.Discount, "wText", cmpEqual,Driver.Value(12), false);
  aqObject.CheckProperty(Aliases.Orders.OrderForm.Group.groupBox1.Total, "wText", cmpEqual, Driver.Value(13), false);
}

function CloseForm(orderForm)
{
  orderForm.ButtonOK.ClickButton();
}

function CloseApplication(mainForm, orders)
{
  mainForm.Close();
  orders.dlgConfirmation.btnNo.ClickButton();
}

function Main()
{
  var orders, mainForm, orderForm, groupBox, Driver;

  Driver = DDT.ExcelDriver("../../TestBook.xlsx", "TestSheet", true);
  TestedApps.RunAll();
  orders = Aliases.Orders;
  mainForm = orders.MainForm;
  while(!Driver.EOF())
  {
    OpenForm(mainForm);
    orderForm = orders.OrderForm;
    groupBox = orderForm.Group;
    PopulateForm(groupBox, Driver);
    Checkpoint(Driver);
    CloseForm(orderForm);
    Driver.Next();
  }
  CloseApplication(mainForm, orders);
}

Python

def OpenForm(mainForm):
  mainForm.MainMenu.Click("Orders|New order...")

def PopulateForm():
  groupBox.ProductNames.ClickItem(Driver.Value[1])
  numericUpDown = groupBox.Quantity
  numericUpDown.Click(8, 7)
  numericUpDown.wValue = Driver.Value[2]
  groupBox.Date.wDate = Driver.Value[3]
  textBox = groupBox.Customer
  textBox.Click(69, 12)
  textBox.wText = Driver.Value[0]
  textBox = groupBox.Street
  textBox.Click(4, 8)
  textBox.wText = Driver.Value[4]
  textBox = groupBox.City
  textBox.Click(12, 14)
  textBox.wText = Driver.Value[5]
  textBox = groupBox.State
  textBox.Click(21, 6)
  textBox.wText = Driver.Value[6]
  textBox = groupBox.Zip
  textBox.Click(14, 14)
  textBox.wText = Driver.Value[7]
  groupBox.WinFormsObject(Driver.Value[8]).ClickButton()
  textBox = groupBox.CardNo
  textBox.Click(35, 15)
  textBox.wText = Driver.Value[9]
  groupBox.ExpDate.wDate = Driver.Value[10]

  
def Checkpoint(Driver):
  aqObject.CheckProperty(Aliases.Orders.OrderForm.Group.Price, "wText", cmpEqual, Driver.Value[11], False)
  aqObject.CheckProperty(Aliases.Orders.OrderForm.Group.Discount, "wText", cmpEqual, Driver.Value[12], False)
  aqObject.CheckProperty(Aliases.Orders.OrderForm.Group.groupBox1.Total, "wText", cmpEqual, Driver.Value[13], False)

def CloseForm(orderForm):
  orderForm.ButtonOK.ClickButton()
  
def CloseApplication():
  mainForm.Close()
  orders.dlgConfirmation.btnNo.ClickButton()
  
def Main():
  Driver = DDT.ExcelDriver("../../TestBook.xlsx", "TestSheet", True)
  TestedApps.RunAll()
  orders = Aliases.Orders
  mainForm = orders.MainForm
  while not Driver.EOF():
    OpenForm(mainForm)
    orderForm = orders.OrderForm
    groupBox = orderForm.Group
    PopulateForm(groupBox, Driver)
    Checkpoint(Driver)
    CloseForm(orderForm)
    Driver.Next()
  CloseApplication(mainForm, orders)

VBScript

Sub OpenForm(mainForm)
  Call mainForm.MainMenu.Click("Orders|New order...")
End Sub

Sub PopulateForm(groupBox,Driver)
  Dim numericUpDown, textBox

  Call groupBox.ProductNames.ClickItem(Driver.Value(1))
  Set numericUpDown = groupBox.Quantity
  Call numericUpDown.Click(37, 9)
  numericUpDown.wValue = Driver.Value(2)
  groupBox.Date.wDate = Driver.Value(3)
  Set textBox = groupBox.Customer
  Call textBox.Click(39, 7)
  textBox.wText = Driver.Value(0)
  Set textBox = groupBox.Street
  Call textBox.Click(66, 7)
  textBox.wText = Driver.Value(4)
  Set textBox = groupBox.City
  Call textBox.Click(72, 9)
  textBox.wText = Driver.Value(5)
  Set textBox = groupBox.State
  Call textBox.Click(98, 9)
  textBox.wText = Driver.Value(6)
  Set textBox = groupBox.Zip
  Call textBox.Click(31, 12)
  textBox.wText = Driver.Value(7)
  groupBox.WinFormsObject(Driver.Value(8)).ClickButton
  Set textBox = groupBox.CardNo
  Call textBox.Click(53, 12)
  textBox.wText = Driver.Value(9)
  groupBox.ExpDate.wDate = Driver.Value(10)
End Sub

Sub Checkpoint(Driver)
  Call aqObject.CheckProperty(Aliases.Orders.OrderForm.Group.Price, "wText", cmpEqual, Driver.Value(11), False)
  Call aqObject.CheckProperty(Aliases.Orders.OrderForm.Group.Discount, "wText", cmpEqual, Driver.Value(12) , False)
  Call aqObject.CheckProperty(Aliases.Orders.OrderForm.Group.groupBox1.Total, "wText", cmpEqual, Driver.Value(13), False)
End Sub

Sub CloseForm(orderForm)
 orderForm.ButtonOK.ClickButton
End Sub

Sub CloseApplication(orders, mainForm)
  mainForm.Close
  orders.dlgConfirmation.btnNo.ClickButton
End Sub

Sub Main
  Dim orders, mainForm, orderForm, groupBox
  Set Driver = DDT.ExcelDriver("../../TestBook.xlsx", "TestSheet", True)
  TestedApps.RunAll
  Set orders = Aliases.Orders
  Set mainForm = orders.MainForm
  While Not Driver.EOF
    Call OpenForm(mainForm)
    Set orderForm = orders.OrderForm
    Set groupBox = orderForm.Group
    Call PopulateForm(groupBox, Driver)
    Call Checkpoint(Driver)
    Call CloseForm(orderForm)
    Driver.Next
  Wend
  Call CloseApplication(orders, mainForm)
End Sub

DelphiScript

procedure OpenForm(mainForm);
begin
  mainForm.MainMenu.Click('Orders|New order...');
end;

procedure PopulateForm(groupBox, Driver);
var numericUpDown, textBox;
begin
  groupBox.ProductNames.ClickItem(Driver.Value(1));
  numericUpDown := groupBox.Quantity;
  numericUpDown.Click(37, 9);
  numericUpDown.wValue := Driver.Value(2);
  groupBox.Date.wDate := Driver.Value(3);
  textBox := groupBox.Customer;
  textBox.Click(67, 17);
  textBox.wText := Driver.Value(0);
  textBox := groupBox.Street;
  textBox.Click(31, 5);
  textBox.wText := Driver.Value(4);
  textBox := groupBox.City;
  textBox.Click(47, 15);
  textBox.wText := Driver.Value(5);
  textBox := groupBox.State;
  textBox.Click(82, 4);
  textBox.wText := Driver.Value(6);
  textBox := groupBox.Zip;
  textBox.Click(10, 8);
  textBox.wText := Driver.Value(7);
  groupBox.WinFormsObject(Driver.Value(8)).ClickButton;
  textBox := groupBox.CardNo;
  textBox.Click(46, 9);
  textBox.wText := Driver.Value(9);
  groupBox.ExpDate.wDate := Driver.Value(10);
end;

procedure Checkpoint(Driver);
begin
  aqObject.CheckProperty(Aliases.Orders.OrderForm.Group.Price, 'wText', cmpEqual, Driver.Value(11), false);
  aqObject.CheckProperty(Aliases.Orders.OrderForm.Group.Discount, 'wText', cmpEqual, Driver.Value(12), false);
  aqObject.CheckProperty(Aliases.Orders.OrderForm.Group.groupBox1.Total, 'wText', cmpEqual, Driver.Value(13), false);
end;

procedure CloseForm(orderForm);
begin
  orderForm.ButtonOK.ClickButton;
end;

procedure CloseApplication(orders, mainForm);
begin
  mainForm.Close;
  orders.dlgConfirmation.btnNo.ClickButton;
end;

procedure Main;
var orders, mainForm, orderForm, groupBox, Driver;
begin
  Driver:=DDT.ExcelDriver('../../TestBook.xlsx', 'TestSheet', true);
  TestedApps.RunAll;
  orders := Aliases.Orders;
  mainForm := orders.MainForm;
  while not Driver.EOF do
  begin
    OpenForm(mainForm);
    orderForm := orders.OrderForm;
    groupBox := orderForm.Group;
    PopulateForm(groupBox,Driver);
    Checkpoint(Driver);
    CloseForm(orderForm);
    Driver.Next;
  end;
  CloseApplication(orders, mainForm);
end;

C++Script, C#Script

function OpenForm(mainForm)
{
  mainForm["MainMenu"]["Click"]("Orders|New order...");
}

function PopulateForm(groupBox, Driver)
{
  var numericUpDown, textBox;

  groupBox["ProductNames"]["ClickItem"](Driver.Value(1));
  numericUpDown = groupBox["Quantity"];
  numericUpDown["Click"](37, 9);
  numericUpDown["wValue"] = Driver.Value(2);
  groupBox["Date"]["wDate"] = Driver.Value(3);
  textBox = groupBox["Customer"];
  textBox["Click"](43, 7);
  textBox["wText"] = Driver.Value(0);
  textBox = groupBox["Street"];
  textBox["Click"](31, 11);
  textBox["wText"] = Driver.Value(4);
  textBox = groupBox["City"];
  textBox["Click"](24, 6);
  textBox["wText"] = Driver.Value(5);
  textBox = groupBox["State"];
  textBox["Click"](31, 8);
  textBox["wText"] =Driver.Value(6);
  textBox = groupBox["Zip"];
  textBox["Click"](24, 17);
  textBox["wText"] = Driver.Value(7);
  groupBox["WinFormsObject"](Driver.Value(8))["ClickButton"]();
  textBox = groupBox["CardNo"];
  textBox["Click"](19, 7);
  textBox["wText"] = Driver.Value(9);
  groupBox["ExpDate"]["wDate"] = Driver.Value(10);
}

function Checkpoint(Driver)
{
  aqObject.CheckProperty(Aliases["Orders"]["OrderForm"]["Group"]["Price"], "wText", cmpEqual, Driver.Value(11), false);
  aqObject.CheckProperty(Aliases["Orders"]["OrderForm"]["Group"]["Discount"], "wText", cmpEqual, Driver.Value(12), false);
  aqObject.CheckProperty(Aliases["Orders"]["OrderForm"]["Group"]["groupBox1"]["Total"], "wText", cmpEqual, Driver.Value(13), false);
}

function CloseForm(orderForm)
{
  orderForm["ButtonOK"]["ClickButton"]();
}

function CloseApplication(mainForm, orders)
{
  mainForm["Close"]();
  orders["dlgConfirmation"]["btnNo"]["ClickButton"]();
}

function Main()
{
  var orders, mainForm, orderForm, groupBox, Driver;

  Driver = DDT["ExcelDriver"]("../../TestBook.xlsx", "TestSheet", true);
  TestedApps["RunAll"]();
  orders = Aliases["Orders"];
  mainForm = orders["MainForm"];
  while(!Driver.EOF())
  {
    OpenForm(mainForm);
    orderForm = orders["OrderForm"];
    groupBox = orderForm["Group"];
    PopulateForm(groupBox,Driver);
    Checkpoint(Driver);
    CloseForm(orderForm);
    Driver["Next"]();
  }
  CloseApplication(mainForm, orders);
}

Prev     Next

See Also

Tutorial Home Page
DDTDriver Object

Highlight search results