makh_dv
13 years agoOccasional Contributor
C# Extensions for Connected Application. TestComplete API roadmap.
Hello,
I probably miss some ability. However... using Connected Application with C#, we met following...
1.
Plenty dummy code like:
using tcVar = AutomatedQA.script.var;
namespace MyProject.TCFramework
{
public static class TcVarExtension
{
#region Properties
public static bool Exists(this tcVar alias)
{
return alias["Exists"];
}
public static bool Exists(this tcVar.VarDelegate alias)
{
return alias["Exists"];
}
public static bool Visible(this tcVar alias)
{
return alias["Visible"];
}
public static bool Visible(this tcVar.VarDelegate alias)
{
return alias["Visible"];
}
#endregion
#region Common Methods
public static void Click(this tcVar alias)
{
alias["Click"]();
}
public static void Click(this tcVar.VarDelegate alias)
{
alias["Click"]();
}
public static void ClickButton(this tcVar alias)
{
alias["ClickButton"]();
}
public static void ClickButton(this tcVar.VarDelegate alias)
{
alias["ClickButton"]();
}
#endregion
}
}
Is there any built in code for these and similar methods/properties, without need to invent wheel? What could you suggest?
2.
No Exceptions on calling TestComplete Api...
It looks that using
var someTcObject;
someTcObject.ClickButton(); //TcObject["ClickButton"]()
never throws exceptions to C#, if there were any problems with this clicks.
And we have to monitor Log.Error events and store them... we cannot just throw Exception because axEventControl subscribers in different thread, and throwing Exception does nothing to e.g. NUnit thread.
As a result on each call to TestComplete api, check were there any Errors, and throw exception to NUnit thread if they were any. It is implemented in meaning of "Guards"
And code become look like this:
public static void ClickButton(this tcVar alias)
{
alias["ClickButton"]();
TestCompleteGuard.Guard(); //throws exception if there are Errors in internal queue
}
public static void ClickButton(this tcVar.VarDelegate alias)
{
alias["ClickButton"]();
TestCompleteGuard.Guard(); //throws exception if there are Errors in internal queue
}
public static string ClrClassName(this tcVar alias)
{
return TestCompleteGuard.GuardString(alias["ClrClassName"]()); //throws exception if there are Errors in internal queue
}
public static string ClrClassName(this tcVar.VarDelegate alias)
{
return TestCompleteGuard.GuardString(alias["ClrClassName"]()); //throws exception if there are Errors in internal queue
}
I'm not sure that this is really how it should be used, thus is there way to trow native Exceptions if TestComplete calls are actually fail.
Is it used properly or some misunderstanding of API?
3.
Are there any plans to make more convenient use of TestComplete Api to stay in Dev IDE, without plenty of rakes in test code? :-)
I do like IDEs with a lot of refactoring abilities more than Scripted/Keyword environment that TestComplete IDE can provide.
Maybe this explains popularity of a free tools like Wati(R/N) and Selenium (except of cost factor), because you just need to add library, and start using It. For TestComplete API to have accurate code requires a lot of support-code before this can be reached. Please I want to understand it more, and if I wrong, please open my eyes.
There are not much info in the internet about Connected Application experience.
Idea: I don't think that using DLR (from .NET 4.0) will help to provide refactor abilities, however somewhere it can be useful at least porting code from JScript to C#.
I probably miss some ability. However... using Connected Application with C#, we met following...
1.
Plenty dummy code like:
using tcVar = AutomatedQA.script.var;
namespace MyProject.TCFramework
{
public static class TcVarExtension
{
#region Properties
public static bool Exists(this tcVar alias)
{
return alias["Exists"];
}
public static bool Exists(this tcVar.VarDelegate alias)
{
return alias["Exists"];
}
public static bool Visible(this tcVar alias)
{
return alias["Visible"];
}
public static bool Visible(this tcVar.VarDelegate alias)
{
return alias["Visible"];
}
#endregion
#region Common Methods
public static void Click(this tcVar alias)
{
alias["Click"]();
}
public static void Click(this tcVar.VarDelegate alias)
{
alias["Click"]();
}
public static void ClickButton(this tcVar alias)
{
alias["ClickButton"]();
}
public static void ClickButton(this tcVar.VarDelegate alias)
{
alias["ClickButton"]();
}
#endregion
}
}
Is there any built in code for these and similar methods/properties, without need to invent wheel? What could you suggest?
2.
No Exceptions on calling TestComplete Api...
It looks that using
var someTcObject;
someTcObject.ClickButton(); //TcObject["ClickButton"]()
never throws exceptions to C#, if there were any problems with this clicks.
And we have to monitor Log.Error events and store them... we cannot just throw Exception because axEventControl subscribers in different thread, and throwing Exception does nothing to e.g. NUnit thread.
As a result on each call to TestComplete api, check were there any Errors, and throw exception to NUnit thread if they were any. It is implemented in meaning of "Guards"
And code become look like this:
public static void ClickButton(this tcVar alias)
{
alias["ClickButton"]();
TestCompleteGuard.Guard(); //throws exception if there are Errors in internal queue
}
public static void ClickButton(this tcVar.VarDelegate alias)
{
alias["ClickButton"]();
TestCompleteGuard.Guard(); //throws exception if there are Errors in internal queue
}
public static string ClrClassName(this tcVar alias)
{
return TestCompleteGuard.GuardString(alias["ClrClassName"]()); //throws exception if there are Errors in internal queue
}
public static string ClrClassName(this tcVar.VarDelegate alias)
{
return TestCompleteGuard.GuardString(alias["ClrClassName"]()); //throws exception if there are Errors in internal queue
}
I'm not sure that this is really how it should be used, thus is there way to trow native Exceptions if TestComplete calls are actually fail.
Is it used properly or some misunderstanding of API?
3.
Are there any plans to make more convenient use of TestComplete Api to stay in Dev IDE, without plenty of rakes in test code? :-)
I do like IDEs with a lot of refactoring abilities more than Scripted/Keyword environment that TestComplete IDE can provide.
Maybe this explains popularity of a free tools like Wati(R/N) and Selenium (except of cost factor), because you just need to add library, and start using It. For TestComplete API to have accurate code requires a lot of support-code before this can be reached. Please I want to understand it more, and if I wrong, please open my eyes.
There are not much info in the internet about Connected Application experience.
Idea: I don't think that using DLR (from .NET 4.0) will help to provide refactor abilities, however somewhere it can be useful at least porting code from JScript to C#.