0

Hello I am using the following code and trying to write the results in the excel sheet column name result, but it's not writing the results in it, however, it will export the sheet but wouldn't write the result. Can you please help me with what I am missing here? All the help is much appreciated. Thanks.

DataTable.AddSheet "TestCases"
DataTable.AddSheet "TestSteps"

DataTable.ImportSheet "this is the excel sheet", "Tcases", "TestCases"
DataTable.ImportSheet "this is the excel sheet", "Tsteps", "TestSteps"

testcasecount = DataTable.GetSheet("TestCases").GetRowCount

For i = 1 To testcasecount

    DataTable.GetSheet("TestCases").SetCurrentRow (i)

    If DataTable.Value("Execution", "TestCases") = "Yes" Then

        stestcaseid = DataTable.GetSheet("TestCases").GetParameter("TestCaseID")
        teststepcount = DataTable.GetSheet("TestSteps").GetRowCount

        For j = 1 To teststepcount

            DataTable.GetSheet("TestSteps").SetCurrentRow (j)
            sid = DataTable.GetSheet("TestSteps").GetParameter("TestCaseID")

            If DataTable.GetSheet("TestSteps").GetParameter("TestCaseID") = stestcaseid Then

                Select Case DataTable.Value("Keyword", "TestSteps")
                    Case Browser()
                        sresult = Browser()
                End Select

                DataTable.Value("Result", "TestSteps") = sresult
            End If

            If sresult = "Pass" Then
                DataTable.Value("Result", "TestCases") = "Pass"
            End If

        Next

    End If

Next

DataTable.ExportSheet "this is the excel sheet", "TestCases"
DataTable.ExportSheet "this is the excel sheet", "TestSteps"

Function Browser()
    systemutil.Run "chrome.exe", "www.google.com"
    Browser = "Pass"
End Function
Étienne Laneville
  • 4,697
  • 5
  • 13
  • 29
Newbie
  • 13
  • 4
  • Welcome to Stack Overflow! As a basic way to troubleshoot this, you can add `MsgBox()` calls in your code to check the values you are working with. For example, you can check that `stestcaseid`, `sid` and `sresult` are what you expect them to be. Just add `MsgBox("Test Case: " & stestcaseid)` for example. – Étienne Laneville Oct 02 '19 at 19:01
  • the code works fine it even exports the excel sheet as well but somewhere it just doesn't write the results – Newbie Oct 07 '19 at 14:31

0 Answers0