如何使用STRING LIST的值运行记录的测试?

时间:2018-11-28 11:37:18

标签: list automated-tests silktest silk-performer silk

我记录了一个测试用例Applikation,现在我想运行该测试用例,但不是使用: ------ CustomerSearch.Customers。在我的代码中选择(“ ARUNDEL,CLAUDE”)--------。

我想从STRING列表中获取客户(人员)。

------ CustomerSearch.Customers.Select(“” +列表中的客户(位置3))--------

STRING个客户列表= {...} “ ARUNDEL,CLAUDE” // 1 “ BUCCIGRAS,凯瑟琳” // 2 “罗宾·科恩” // 3 “ CORELLI,ARCANGELO” // 4 ........等

有人可以帮我吗? 我如何遍历列表并每次选择不同的对象

我如何分别编写一个函数以每次运行都使用一个人?这样我可以一遍又一遍地使用列表中的名字运行测试?

#use "FunktionGmo.t
#use "Test2.t"
# testcase Test1 ()
[ ] 
[ ] 
[ ] 
[-] recording
    [ ] GreenMountainOutpost.SetActive ()
    [ ] GreenMountainOutpost.Order.CustomerInformation.Pick ()
    [ ] CustomerInformation.SetActive ()
    [ ] CustomerInformation.DialogBox1.Search.Click ()
    [ ] CustomerSearch.SetActive ()
    [ ] // Kunde
    [ ] CustomerSearch.Customers.Select ("ARUNDEL, CLAUDE")
    [ ] CustomerSearch.Select.Click ()
    [ ] CustomerInformation.SetActive ()
    [ ] CustomerInformation.DialogBox1.PlaceOrder.Click ()
    [ ] PlaceOrder.SetActive ()
    [ ] PlaceOrder.DialogBox1.Search.Click ()
    [ ] ItemSearch.SetActive ()
    [ ] sleep(2)
    [ ] // Artikel
    [ ] ItemSearch.Items.Select ("3 PERSON DOME TENT")
    [ ] ItemSearch.Select.Click ()
    [ ] PlaceOrder.SetActive ()
    [ ] PlaceOrder.DialogBox1.Spin1.Increment ()
    [ ] PlaceOrder.DialogBox1.OrderItem.Click ()
    [ ] PlaceOrder.DialogBox1.CompleteOrder.Click ()
    [ ] CompleteOrder.SetActive ()
    [ ] CompleteOrder.DialogBox1.CardNumber.SetPosition (1, 1)
    [ ] // Kreditkartennummer
    [ ] CompleteOrder.DialogBox1.CardNumber.SetText ("111111-1111-11111")
    [ ] CompleteOrder.DialogBox1.ExpirationDate.SetPosition (1, 1)
    [ ] // Ablaufdatum der Kreditkarte
    [ ] CompleteOrder.DialogBox1.ExpirationDate.SetText ("02/20")
    [ ] CompleteOrder.DialogBox1.ProcessOrder.Click ()
    [ ] sleep(2)
    [ ] CompleteOrder.DialogBox1.Cancel.Click ()
    [ ] sleep(2)
    [ ] CustomerInformation.SetActive ()
    [ ] CustomerInformation.DialogBox1.Clear.Click ()

1 个答案:

答案 0 :(得分:0)

// Use "Filename" to work with the Data from the File.
use "Test2.inc"
use "FunktionGmo.t"
// Global Variable
string Name
string Artikel
string CardN
string Expi

testcase Test1 ()
// For each to loop through the list customers and take the same index from the other 3 lists.
int x = 1
for each Name in customers
    print(Name)
    Artikel = items[x]
    CardN = cardnumber[x]
    Expi = expirationdate[x]
    print(Artikel)
    print(CardN)
    print(Expi)
    print("----------------------")
    Bestellung (Name, Artikel, CardN, Expi)
    x++
_____________________________________________________________________________
Order:
use "Test2.inc"
use "Test3.t"
// Funktion für Bestelldaten
[+] // LIST OF STRING customers = {...} // List 1-14
[ ] // "ARUNDEL, CLAUDE"            // 1
[ ] // "BUCCIGRAS, CATHERINE"       // 2
[ ] // "COHEN, ROBIN"               // 3
[ ] // "CORELLI, ARCANGELO"     // 4
[ ] // "DURNFELD, PATRICIA"     // 5
[ ] // "GOLDSTEIN, MARTHA"          // 6
[ ] // "HARTMANN, JUDY"         // 7
[ ] // "JOHNSON, JAMES"         // 8 
[ ] // "JONES, RONALD"              // 9
[ ] // "LEYDON, THOMAS"         // 10
[ ] // "MURPHY, SONIA"              // 11
[ ] // "PERKINS, BOB"               // 12
[ ] // "ROBERTS, RANDY"         // 13
[ ] // "ROBERTSON, GUNNAR"          // 14

[+] // LIST OF STRING  items = {...}        // List 1-14
[ ] // "3 PERSON DOME TENT"         // 1
[ ] // "EXTERNAL FRAME BACKPACK"        // 2
[ ] // "GLACIER SUN GLASSES"            // 3
[ ] // "PADDED SOCKS"                   // 4
[ ] // "3 PERSON DOME TENT"         // 5
[ ] // "EXTERNAL FRAME BACKPACK"        // 6
[ ] // "GLACIER SUN GLASSES"            // 7
[ ] // "PADDED SOCKS"                   // 8
[ ] // "3 PERSON DOME TENT"         // 9
[ ] // "EXTERNAL FRAME BACKPACK"        // 10
[ ] // "GLACIER SUN GLASSES"            // 11
[ ] // "PADDED SOCKS"                   // 12
[ ] // "GLACIER SUN GLASSES"            // 13
[ ] // "PADDED SOCKS"                   // 14
[ ] // 
[ ] // 
[+] // LIST OF STRING  cardnumber = {...}       // List 1-14
[ ] // "111111-1111-11111"          //1
[ ] // "222222-2222-22222"          //2
[ ] // "333333-3333-33333"          //3
[ ] // "444444-4444-44444"          //4
[ ] // "555555-5555-55555"          //5
[ ] // "666666-6666-66666"          //6
[ ] // "777777-7777-77777"          //7
[ ] // "888888-8888-88888"          //8
[ ] // "999999-9999-99999"          //9
[ ] // "000000-0000-00001"          //10
[ ] // "000000-0000-00011"          //11
[ ] // "000000-0000-00111"          //12
[ ] // "000000-0000-01111"          //13
[ ] // "000000-0000-11111"          //14
[ ] // 
[+] // LIST OF STRING  expirationdate = {...}   // List 1-14
[ ] // "01/19"          //1
[ ] // "02/20"          //2
[ ] // "03/21"          //3
[ ] // "04/21"          //4
[ ] // "05/20"          //5
[ ] // "06/19"          //6
[ ] // "06/20"          //7
[ ] // "06/21"          //8
[ ] // "08/21"          //9
[ ] // "09/20"          //10
[ ] // "09/19"          //11
[ ] // "05/20"          //12
[ ] // "07/21"          //13
[ ] // "03/19"          //14

[-] Bestellung (string Name, string Artikel, string CardN, string Expi)
[-] // print("Das ist der verwendete Name: {Name},{Artikel},{CardN},{Expi}")
    [ ] 
    [ ] 
    [-] recording
        [ ] GreenMountainOutpost.SetActive ()
        [ ] GreenMountainOutpost.Order.CustomerInformation.Pick ()
        [ ] CustomerInformation.SetActive ()
        [ ] CustomerInformation.DialogBox1.Search.Click () //20
        [ ] CustomerSearch.SetActive ()
        [ ] CustomerSearch.Customers.Select (""+Name)
        [ ] CustomerSearch.Select.Click ()
        [ ] CustomerInformation.SetActive ()
        [ ] CustomerInformation.DialogBox1.PlaceOrder.Click ()
        [ ] PlaceOrder.SetActive ()
        [ ] PlaceOrder.DialogBox1.Search.Click ()
        [ ] ItemSearch.SetActive ()
        [ ] ItemSearch.Items.Select (""+Artikel)
        [ ] ItemSearch.Select.Click ()
        [ ] PlaceOrder.SetActive ()
        [ ] PlaceOrder.DialogBox1.Spin1.Increment ()
        [ ] PlaceOrder.DialogBox1.Spin1.Increment ()
        [ ] PlaceOrder.DialogBox1.OrderItem.Click ()
        [ ] PlaceOrder.DialogBox1.CompleteOrder.Click ()
        [ ] CompleteOrder.SetActive ()
        [ ] sleep(2)
        [ ] CompleteOrder.DialogBox1.CardNumber.SetPosition (1, 1)
        [ ] CompleteOrder.DialogBox1.CardNumber.SetText (""+CardN)
        [ ] CompleteOrder.DialogBox1.ExpirationDate.SetPosition (1, 1)
        [ ] CompleteOrder.DialogBox1.ExpirationDate.SetText (""+Expi) //40
        [ ] sleep(2)
        [ ] CompleteOrder.DialogBox1.ProcessOrder.Click ()
        [ ] sleep(5)
        [ ] CompleteOrder.DialogBox1.Cancel.Click ()
        [ ] CustomerInformation.SetActive ()
        [ ] CustomerInformation.DialogBox1.Clear.Click ()
        [ ] CustomerInformation.Close ()