【问题标题】:SpecFlow - The argument type 'System.MarshalByRefObject' cannot be converted into parameter type 'TechTalk.SpecRun.Common.Logging.ITestLogger'SpecFlow - 参数类型“System.MarshalByRefObject”无法转换为参数类型“TechTalk.SpecRun.Common.Logging.ITestLogger”
【发布时间】:2021-10-17 07:12:50
【问题描述】:

在 Visual Studio 2019 中,我可以在测试资源管理器中完美地构建和运行我的特定测试用例。但是我从命令行运行,它显示以下错误。

Discovered 1 tests
Thread#0: The argument type 'System.MarshalByRefObject' cannot be converted into parameter type 'TechTalk.SpecRun.Commo
Thread#1:
Thread#2:
100% (1/1) completed

Done.
TechTalk.SpecRun.Framework.SpecRunException: At least one test thread aborted. ---> System.Runtime.Remoting.RemotingException: The argument type 'System.MarshalByRefObject' cannot be converted into parameter type 'TechTalk.SpecRun.Common.Logging.ITestLogger'. ---> System.InvalidCastException: Object must implement IConvertible.
   at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)
   at System.Runtime.Remoting.Messaging.Message.CoerceArg(Object value, Type pt)
   --- End of inner exception stack trace ---

Server stack trace:
   at System.Runtime.Remoting.Messaging.Message.CoerceArg(Object value, Type pt)
   at System.Runtime.Remoting.Messaging.Message.CoerceArgs(MethodBase mb, Object[] args, ParameterInfo[] pi)
   at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)

Exception rethrown at [0]:
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at TechTalk.SpecRun.Framework.ITestAssemblyExecutor.Initialize(Int32 threadId, ITestExecutionManager executionManager, IAssemblyReference assemblyReference, ITestLogger logger, String testAssemblyFullPath, String testAssemblyConfigFilePath, TestExecutionConfiguration testExecutionConfiguration)
   at TechTalk.SpecRun.Framework.TestThread.InitializeTestThreadExecutor(IAssemblyReference testAssembly, ExecutionModelSettings executionModelSettings, String testTarget)
   at TechTalk.SpecRun.Framework.TestThread.GetThreadExecutorFor(TestItem testItem)
   at TechTalk.SpecRun.Framework.TestThread.Run(ITestExecutionManager executionManagerForRun)
   at TechTalk.SpecRun.Framework.AsyncTestThreadRunner.RunSync(TestExecutionManager executionManager)
   --- End of inner exception stack trace ---
Result: test framework error: At least one test thread aborted.
  Total: 1
  Succeeded: 0
  Ignored: 0
  Pending: 0
  Skipped: 1
  Failed: 0

我正在使用的版本:

  • .NET 框架:4.6.2
  • 规范流:2.2.1
  • SpecRun.Runner:1.6.3
  • SpecRun.SpecFlow:1.6.3
  • SpecRun.SpecFlow.2-2-0:1.6.3

命令:

SpecRun.exe run Default.srprofile /basefolder:C:\Development\Project\bin\Debug\Automation\TestAutomation.Specs\ /outputfolder:output /filter:"testpath:Scenario:Search+page+in+Automation"

我该如何解决这个问题?

【问题讨论】:

    标签: selenium-chromedriver visual-studio-2019 specflow specrun


    【解决方案1】:


    这是一个活跃的 SpecFlow 错误:
    https://github.com/SpecFlowOSS/SpecFlow/issues/1443

    最好的问候,
    下午

    【讨论】:

    • 我使用 VsTest 而不是 SpecRun.exe
    • 是的 Piotr,我也试过 VsTest。对于我的情况,我必须执行特定的场景测试用例。我使用 /tests 属性及其运行所有具有给定场景名称子字符串的测试用例。示例:如果假设我需要执行 "n1.n2.Add" (/tests:"n1.n2.Add") ,它的运行测试用例包含 "A.n2.Add"、"n1.n2.Sub"。另外,我试图在运行时从 trx 文件中获取测试用例名称,所以我不能使用 TestCategory 因为我们当时不知道类别。即使我尝试使用FullyQualifiedName,它也显示没有找到测试用例,即使它可用。有什么建议吗?
    • 仅供参考 @Piotr M. 在 app.config 中,我使用 specrun 作为单元测试提供程序。 <specFlow><unitTestProvider name="SpecRun" /><plugins><add name="SpecRun" /></plugins></specFlow>
    猜你喜欢
    • 2016-03-21
    • 2017-02-13
    • 2016-07-27
    • 2016-07-02
    • 2023-03-29
    • 2020-06-14
    • 1970-01-01
    • 1970-01-01
    • 2020-03-01
    相关资源
    最近更新 更多