c# - 单元测试适配器抛出异常 : Object must implement IConvertible. .in BDD specflow 框架

标签 c# dynamics-crm bdd

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

我必须在 Chrome 浏览器上测试应用程序,我正在创建一个变量来访问浏览器:

protected readonly var Browser =  BrChrome;

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

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

当我在 Visual Studio 中运行测试时,出现以下错误:

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

在调试时,我在上面声明 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:"

最佳答案

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

关于c# - 单元测试适配器抛出异常 : Object must implement IConvertible. .in BDD specflow 框架,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30796914/

相关文章:

c# - DispatcherTimer 的毫秒间隔

c# - ASP.NET 内联脚本

c# - C# : What are technical reasons to prefer///or/** 中的文档注释

c# - LinqToCRM 未正确转换

json - 如何在 Karate 中将 Json 对象转换为 Json 数组?

unit-testing - 使用 BDD 风格的 "When"命名测试类及其维护结果

java - 具有两个不同类的 Cucumber DataTable

c# - 如何在 Web Core API 中调试启动?

c# - 更新自定义工作流程事件中创建的记录 -CRM -C#

javascript - 使用 Web API 将实体列表填充到 HTML 页面加载的下拉列表中