Forum Discussion

saran's avatar
saran
New Contributor
7 years ago

Read and Write in Excel sheets using VBScripts

I am creating a framework using Excel Sheets for a Desktop application. I am new to TestComplete. I have seen the syntax from Help in Testcomplete. But still I am not able to bring up a solution. 

 

For example I have 5 testcases to be executed. I have created an excel with 2 sheets namely  Sheet1 and Sheet2 with 4 testcases with headings in Sheet1 as TestCases and Status. In sheet2, i have created Testcase ID, TestCase, Expected Result, Actual Result, Status, Screenshots, Start Time, End Time, Time Taken.

 

In sheet1, if the status column value is 1 then the Testcase will be executed. If it is 0 then it will not be executed.

In sheet2, the actual result should be PASS or FAIL. PASS should be in green color and FAIL should be in RED color. And if both the actual and expected are same then PASS should be mentioned in Status column.

 

And how to add screenshot path for the respective Testcase? Also, I would like to know how to fetch the start time and end time and compare both of them and calculate the total time taken.

 

I need a sample code to fetch details from the excel sheet and to write the same results in that excel sheet.

 

I know it is difficult for me at this stage, but I need your help guys. Awaiting for the answers soon.

 

I have attached the excel sheet for reference.

 

 

 

 

 

1 Reply

  • NisHera's avatar
    NisHera
    Valued Contributor

    The basic structure would be 

    1) Open up XL using DDT and read information(sheet 1) to variables what you have to run (One instance of TC can not open up several excel sheet at a given time)DDT drive

    2) Run your test running test

    3)  End of each test record your results handling results

     

    following links may also help...

    working with excel

    capturing images

     

    As you have understand this would be bit complex even for a experienced guy. Hence my advice is just start with what ever you have or you can. On the progress we (forum) can help with exact technical problems. 

     

    P.S.

    By the way why don't you use existing functionality of TC for do the same thing Eg Test_Items and  TC Logs ?