cancel
Showing results for 
Search instead for 
Did you mean: 

Verifying data in Excel file

SOLVED
Highlighted
Contributor

Re: Verifying data in Excel file

Feel so close, but I get another Unexpected token for the ">" in the if statement. I really need to learn some coding.

Highlighted
Community Hero

Re: Verifying data in Excel file

Replace "<>" with "!="

 

I used a variaty of different coding languages in my day to day so sometimes get the syntax mixed up.  Both of those combinations of symbols represent "not equal to" but for different scripting languages.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
Highlighted
Community Hero

Re: Verifying data in Excel file

Since you appear to be using some form of JavaScript, I can recommend

 

https://www.w3schools.com/js/default.asp

 

As well as 

 

https://community.smartbear.com/t5/TestComplete-General-Discussions/TestComplete-On-Demand-Video-Cou...

 

I know, also, that @LinoTadros did a "Scripting for TestComplete" course somewhere as well.  I can't find it at the moment but you might be able to search for that.

 


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
Highlighted
Contributor

Re: Verifying data in Excel file

Robert - thanks for the input. I am going to mess around with this now and see if what I can do with selecting the starting point. I assume that is the RecNo =. 

 

In case anyone comes across this with as little coding experience as I have this is the final version. Which contains the updates to editorial and bracketing errors.

 


function TestDriver()
{
var Driver;

// Creates the driver
// If you connect to an Excel 2007 sheet, use the following method call:
// Driver = DDT.ExcelDriver("C:\\MyFile.xlsx", "Sheet1", true);
TestDriver = DDT.ExcelDriver("C:\\Users\\mmau\\Downloads\\ControlAreaList.xlsx", "CA 1-1 (1)");
BaseDriver = DDT.ExcelDriver("C:\\Users\\mmau\\Downloads\\ControlAreaListBaseline4.6HazAnalysis.xlsx", "CA 1-1 (1)")


// Iterates through records
RecNo = 0;
while (!TestDriver.EOF() && !BaseDriver.EOF())
{
for (var i = 0; i < TestDriver.ColumnCount; i++) {
if (TestDriver.Value(i) != BaseDriver.Value(i)) {
Log.Warning("Test file column " + TestDriver.ColumnName(i) + " does not match baseline")
}
}
TestDriver.Next(); // Goes to the next record
BaseDriver.Next();
}

// Closes the driver
DDT.CloseDriver(TestDriver.Name);
DDT.CloseDriver(BaseDriver.Name);
}

New Here?
Join us and watch the welcome video:
Announcements
Join TechCorner Challenge!
Want a fun and easy way to learn TestComplete? Try solving weekly TechCorner challenges and get into the Leaderboard!

Challenge Status

How to execute remote test and obtain results via Test Runner REST API

Participate!

Comparing content of HTML table with Excel file data

Participate!

Compare HTML table with Excel file and correct data in the file

Participate!

Retrieve Data from a Web Page

Participate!
Top Kudoed Authors