单元测试适配器抛出异常:对象必须实现IConvertible..in BDD specflow框架

时间:2015-06-12 06:48:47

标签: c# dynamics-crm bdd

我是自动化测试和开发基于specflow的框架的新手,用于测试基于CRM的应用程序。

我必须在Chrome浏览器上测试该应用程序,并且我正在创建一个变量,如下所示:

protected readonly var Browser =  BrChrome;

protected static var BrChrome
{
    get { return Connect.Sys["Browser"]("chrome"); }
}

然后使用这个BrChrome我会访问其他网页对象(使用AssertObjectPresent),将其视为父对象。

当我在Visusual Studio中运行测试时,我收到以下错误:

"Unit Test Adapter threw exception: 
Object must implement IConvertible....."

调试时我在上面的代码中获得了Exception,其中声明了Chrome浏览器。

System.Exception was unhandled by user code
   Message=Cannot create ActiveX component.
   Source=Microsoft.VisualBasic

   StackTrace:
    at Microsoft.VisualBasic.Interaction.CreateObject(String ProgId, String ServerName)
    at AutomatedQA.script.var.GetObjectAlternative(String Name, String AlternativeName)
    at AutomatedQA.TestComplete.Connect.TBaseTCClass.GetTestCompleteIntegration()
    at AutomatedQA.TestComplete.Connect.TBaseTCClass.GetTestCompleteObjectByName(String Name)
    at AutomatedQA.TestComplete.Connect.SysClass.Init()
    at AutomatedQA.script.var.get_Item(String name, var[] args)
    at X.Y.TestAutomation.Utility.TestCompleteMethods.get_BrChrome() in F:\Visual Studio 2010\Projects\X.Y.Automation\Barclays.OneEvent.TestAutomation.Utility\TestCompleteMethods.cs:line 43
    at X.Y.TestAutomation.Utility.TestCompleteMethods..ctor() in F:\Visual Studio 2010\Projects\X.Y.Automation\X.Y.TestAutomation.Utility\TestCompleteMethods.cs:line 33     
    at X.Y.TestAutomation.Utility.Env..ctor()
    at X.Y.TestAutomation.OneEventHooks.BeforeFeature() in F:\Visual Studio 2010\Projects\X.Y.Automation\X.Y.Automation\YHooks.cs:line 28
    at lambda_method(Closure , IContextManager )

  InnerException:"

1 个答案:

答案 0 :(得分:0)

当我在具有测试代理VS2012版本的计算机上安装VS 2015后运行分布式编码ui测试时,我得到了相同的错误消息“单元测试适配器抛出异常:对象必须实现IConvertible”。重新安装测试代理VS2012后错误消失。