.NET Connected.TestedApps["Items"]("appName") execute well in TC IDE, but giving null exception in C
This code execute successfully in TC-IDE
function Test1()
{
var appName = "TestApp";
var appObj = TestedApps["Items"](appName);
if (appObj != null)
{
Log["Message"](appObj["ItemName"]);
Log["Message"](appObj["FullFileName"]);
}
}
but giving null exception in C# ConnectedApp:
using tcVar = AutomatedQA.script.var;
using AutomatedQA.TestComplete;
public static void StartApp(string AppName)
{
tcVar app = AppNAme;
tcVar appObj = Connect.TestedApps["Items"](app);
if (appObj != null)
{
tcVar str = "The project contains following TestedApps: " + objApp["FileName"];
Connect.Log["Message"](str);
str = "Full Name with Path of Application: " + objApp["FullFileName"];
}
}
What is wrong with my code. I had write the same code using VBScripts in TC-IDE, it runs OK, but same error if i tried to run in VB.NET connected app.
An early response will be appreciated.
Hi,
Well, I don't know all your details, but my personal opinion is "Why not to provide a client with TestComplete project that already does what is needed?".
While providing TestComplete project to the client you may warn them that if they change something in test code this will be on their own and you will not support this. What you will support is their change requests in response to which they will get updated TestComplete project.
Or your expectation was not to support provided .dll?
What you are trying to implement sounds to me like connected self-testing application where TestComplete is supposed to act as this self-testing application. Not sure to what extent this is supported in TestComplete.
Slightly different approach that you may consider: when your test code is running, it may call Sys.OleObject("TestComplete.Application") and get an access to the COM object of the current TestComplete instance. This COM object provides some child objects like Integration and others (if I remember their names correctly) that can be used from test code.
The problem is that these child objects are not well documented and it will not be easy to figure out how this or that can be done. If ever can.
I would recommend to ask Support for their comments directly via the https://support.smartbear.com/message/?prod=TestComplete form and reference this thread.