TestComplete 12.5 - Problem with posting image to testlog
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
TestComplete 12.5 - Problem with posting image to testlog
Hello,
I'm using Testcomplete 12.5 with vbScript. We had a function for writing log messages to the testlog, which gets a control as an argument and posts it in the Log.Error function as [picture] argument. In the object spy, it has a .Picture method. If I take the control by calling it with Aliases.controlName directly in the Log.Error function, it works.
The error message I get by accessing the Err.description attribute is: "Could not convert variant of type (ByRef Variant) into type (Dispatch)"
It worked in 12.4. Is there an error in TestComplete, or is there another way to post images of controls to the testlog? We have written a test framework with a lot of function, we are accessing Controls via variables all the time.
Best regards,
Christoph
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can you share the code that generates the error? It would be useful to see how you are implementing what you're doing.
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
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I am accessing the control like this:
Set TestTool = Aliases.TestTool
Set MyControl = TestTool.myControl
Then I use a method like: MyLog.LogMessage("An error occured", pmHigher, "", MyControl)
In this method I call the standard log function:
sub LogMessage(message, priority, attributes, control)
Dim MyImage
MyImage = control.Picture
Log.Error(message, priority, attributes, MyImage)
End Sub
I also get the error if I get the control by calling:
Set MyControl = TestTool.WaitAliasChild("myControl")
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Understanding that this used to work before... note that Log.Message has more parameters than you are using. So.... what you are passing in as priority is actually the parameter for "Additional Info", attribs is actuallyl priority, and where you have your control is actually the attribs.
What happens if you change your code to this:
sub LogMessage(message, priority, attributes, control) Dim MyImage MyImage = control.Picture Log.Error(message, "", priority, attributes, MyImage) End Sub
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
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi tristaanogre,
indeed my code already is like you suggested, I missed the 'additional Info' attribute in my example. I'm sorry.
Best regards
Christoph
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Christoph,
> MyLog.LogMessage("An error occured", pmHigher, "", MyControl)
> Log.Error(message, priority, attributes, MyImage)
Another note is that Attributes parameter for Log.Error is a structure and it is quite possible that the string that you pass as an actual argument cannot be converted to the required structure.
What if you change
MyLog.LogMessage("An error occured", pmHigher, "", MyControl)
to
MyLog.LogMessage("An error occured", pmHigher, Log.CreateNewAttributes(), MyControl)
?
/Alex [Community Champion]
____
[Community Champions] 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. Posts made by [Community Champions]
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.
The [Community Champion] signature is assigned on quarterly basis and is used with permission by SmartBear Software.
https://community.smartbear.com/t5/Community-Champions/About-the-Community-Champions-Program/gpm-p/252662
================================
