cancel
Showing results for 
Search instead for 
Did you mean: 

“An exception occurred while the element specified in the test item was being executed"

Occasional Contributor

“An exception occurred while the element specified in the test item was being executed"

Hi,

 

I am currently lost as Testcomplete is not showing me where the error is happening. 

 

The error (Please see attached) is happening intermittently. 

 

The 'Execute Tests' test item is where all my code is. There are a bunch of reusable codes which are driven depending on the data being picked up. 

 

Can someone please point me in the right direction? 

 

Thanks,

Stephane

 

13 REPLIES 13
Community Hero

Re: “An exception occurred while the element specified in the test item was being executed"

The error is rather non-specific.  So, without more knowledge of what the code being executed consists of, could be hard to debug.  Is it possible for you to share what code is being executed by that test item?  It sounds like there is some sort of exception that is occurring in attempting to execute that code initially and, because it's in a Test Item, there might not be exception handling around it.


Robert Martin
[Community Expert Group]
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
Extensions available
Occasional Contributor

Re: “An exception occurred while the element specified in the test item was being executed"

Hi Robert, 

 

It will be difficult to share the code and this is why it is the issue as well. 

 

That 'Execute Test' test item is the main script which calls functions from another 10 test items.

 

Any other options?

 

 

 

 

Community Hero

Re: “An exception occurred while the element specified in the test item was being executed"

Not really... an exception occurred... without knowing the code, there's no real way of letting you know what to look out with any level of accuracy.

 

So... things to watch for as non-specific items:

 

1) Check parameters and make sure that anything that is a "required" parmetre for a function/method actually has proper values

2) Variable names/method names -> If there were any recent edits, make sure that anything renamed has been properly renamed globally

3) Try wrapping your entire method being called by "Execute Tests" in appropriate try/catch/finally logic to trap the EXACT exception and write it out to the log.  This might give you insight as to what specific items to look at.


Robert Martin
[Community Expert Group]
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
Extensions available
Community Hero

Re: “An exception occurred while the element specified in the test item was being executed"

You can also put some breakpoints in and maybe Watch some variables as well.  Use Debug to step through the code to get a more specific idea of where things are failing.  

Community Hero

Re: “An exception occurred while the element specified in the test item was being executed"

Hi Stephane,

 

One more thing: attached error is a message from TestExecute itself. What is the error posted to the test log? (The contents of both, error message and extended info pane is relevant.)

 

Regards,
Alex
[Community Expert Group]
____
[Community Expert Group] members are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Postings made by [Community Expert Group] members
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
[Community Expert Group] signature is used with permission by SmartBear Software.
http://smartbear.com/forums/f83/t86934/community-experts/
================================
Occasional Contributor

Re: “An exception occurred while the element specified in the test item was being executed"

Hi,

 

Thank you all for your suggestions. 

 

The Test Execute test item is the full regression pack which takes 2 hour to run, mostly because the scenarios are data driven but it will be impossible for me to put the code on the forum. 

 

I tried to add breakpoints and ran the full regression pack but this did not turn out well. 

  • The error happened on Scenario 22 but when I run scenario 22 on its own, the test passed. 
  • I ran the remaining tests where i got the error on scenario 34. I ran 34 and 35 and as expected the tests passed again. 
  • I checked the logs which does not show anything. I can see only the actions that test complete performed and the logs just stopped there without any error/details. 

Any other suggestion I should be considering? 

Community Hero

Re: “An exception occurred while the element specified in the test item was being executed"

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.


Robert Martin
[Community Expert Group]
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
Extensions available
Occasional Contributor

Re: “An exception occurred while the element specified in the test item was being executed"

 

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. 

 

 

Community Hero

Re: “An exception occurred while the element specified in the test item was being executed"

Microsoft is responsible for Jet, not TC.  Smiley Wink     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.

New Here?
Join us and watch the welcome video:
Top Kudoed Authors