Forum Discussion
Are you using a data driver to drive all your scenarios? If so, and it's a CSV driver, you could have connection issues. The JET database engine behind the CSV driver has a maximum of 65 connections it can have open at a time. If it's always failing at certain scenarios, that seems to be where I'd look... make sure that you're closing connections no longer needed, freeing up objects, etc.
What do you mean by 65 connections? Are you saying that the testcomplete cannot handle reading from 65 CSV files for example? If so, we are ok as I am only reading from one CSV.
The issue is that the tool is not failing at specific scenarios. It is just failing at some random point. When testexecute failed, e.g. scenario 1. I will run it again on test complete, add a breakpoint and test over. The error will not happen again.
- Marsha_R6 years agoChampion Level 3
Microsoft is responsible for Jet, not TC. ;) 65 connections is the max at one time.
Yes you are only using one csv but if you make a connection in your testing loop and don't force close it at the end, then the first connection is still there the next time when you make the second connection and so on. You can pass up 65 really quickly. This could still look random if you have a close in some places and not in others. Make sure you have a close for every open.
- tristaanogre6 years agoEsteemed Contributor
What Marsha_R said...
...this still could potentially not be the case but it's starting to sound like it. We had problems at another company a few years ago with test scenarios seemingly failing with no rational explanation and no helpful exception language in the logs. So, this is worth investigating.
- RUDOLF_BOTHMA6 years agoCommunity Hero
This pseudo code might help identify if it is connections related
For DDT:
function OpenDriverObjectNoDisconnect(filename) { driverObj = DDT.CSVDriver(filename); while(!driverObj.EOF()) { //Do Stuff driverObj.Next(); } } function OpenDriverObjectWithDisconnect(filename) { driverObj = DDT.CSVDriver(filename); while(!driverObj.EOF()) { //Do Stuff driverObj.Next(); } //This is the important one: DDT.CloseDriver(driverObj.Name); } function Test() { for(vari=0;i<=100;i++) { OpenDriverObjectWithDisconnect(yourfilename); //Shouldn't error } for(var i=0I;i<=100;i++) { OpenDriverObjectNoDisconnect(yourfilename); //May error then you know it's connection related} }
ADO equivalent:
function OpenConnection(DNSName, UserID, UserPassword) { try { aCon = ADO.CreateConnection(); // Sets up the connection parameters aCon.ConnectionString = "Provider=MSDASQL.1;Persist Security Info=False;" + "Data Source=" + DNSName +"; User ID=" + UserID + "; Password=" + UserPassword + ";"; // Opens the connection aCon.Open(); Common.LogMessageVerbose("Connection Opened"); return aCon; } catch(e) { //Error handling return null; } } function CloseConnection(connection) { try { if(connection != null && connection.State != 0)
{ connection.Close(); Common.LogMessageVerbose("Connection Closed");
} return true; } catch(e) { return false; } } function Test() { for(var i=0;i<=100;i++) { connectionObj = OpenConnection(DNSName, UserID, UserPassword); CloseConnection(connectionObj ); //This should work } for(var i=0;i<=100;i++) { connectionObj = OpenConnection(DNSName, UserID, UserPassword); //If this fails, it's connection related} } }
Related Content
Recent Discussions
- 2 hours agoSvetaG