Forum Discussion

googleid_118035's avatar
googleid_118035
Contributor
12 years ago

Can anyone send me a VB script of following two functions.

Hi,



I am able to run test with following JS funtions, but now I need them in VB scripts

Here are the two functions.




function testRunner()


{


testcase = DDT.ExcelDriver("C:\\Dev_Chaminda\\Q2Soft\\ConX\\Test_Data.xlsx","Sheet1",true);


testcase.Name = "Test_Data"


testcase.DriveMethod("Unit2.commandBuilder")


}

 


function commandBuilder()


{


testcasedatadriver = DDT.DriverByName("Test_Data")


testAction = testcasedatadriver.Value("method name")


parameters = new Array();


for(i=1;i<testcasedatadriver.ColumnCount;i++)


{


if (testcasedatadriver.Value(i)==null)


break;


parameters.push(aqString.Quote(testcasedatadriver.Value(i).toString()));


}


command = testAction + "(" + parameters.join() + ");";


eval(command);


parameters = null;


}

  • gid_216's avatar
    gid_216
    Frequent Contributor
    HI Dev,



    Kidly check, below function may help




    Sub testRunner


      Set testcase = DDT.ExcelDriver("C:\\Dev_Chaminda\\Q2Soft\\ConX\\Test_Data.xlsx","Sheet1",true)


      testcase.Name = "Test_Data"


      testcase.DriveMethod("commandBuilder")


    End Sub


     


    Sub commandBuilder


      Dim parameters


      Set testcasedatadriver = DDT.DriverByName("Test_Data")


      testAction = testcasedatadriver.Value("method name")


      For i=1 To testcasedatadriver.ColumnCount


        If IsNull(testcasedatadriver.Value(i)) Then


          Exit For


        End If


        If IsArray(parameters) Then


          ReDim Preserve parameters(UBound(parameters) + 1)


        Else


          ReDim parameters(0)


        End If


        parameters(UBound(parameters)) = aqString.Quote(testcasedatadriver.Value(i).toString())


      Next


      command = testAction + "(" + Join(parameters) + ")"


      Execute(command)


    End Sub

     

  • paul_scroce's avatar
    paul_scroce
    Frequent Contributor
    Minor point but VB script would not need double backslash in the filepath string



    Set testcase = DDT.ExcelDriver("C:\Dev_Chaminda\Q2Soft\ConX\Test_Data.xlsx","Sheet1",true)