我有一個測試框架,我們打算使用Codedui以及specflow。我已經安裝的工具分開過,但我目前在與這兩個工具運行specflow測試得到一個錯誤裝在一起:Visual Studio 2017 SpecFlow和CodedUI程序集無法加載
[10/12/2017 12:02:00 AM Informational] ------ Discover test started ------
[10/12/2017 12:02:01 AM Informational] NUnit Adapter 3.8.0.0: Test discovery starting
[10/12/2017 12:02:01 AM Informational] NUnit Adapter 3.8.0.0: Test discovery complete
[10/12/2017 12:02:01 AM Informational] NUnit VS Adapter 2.1.1.0 discovering tests is started
[10/12/2017 12:02:01 AM Warning] Dependent Assembly Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a of C:\Users\*****\documents\visual studio 2017\Projects\*****\*****\bin\Debug\*****.dll not found. Can be ignored if not a NUnit project.
[10/12/2017 12:02:01 AM Informational] NUnit VS Adapter 2.1.1.0 discovering test is finished
[10/12/2017 12:02:01 AM Informational] ========== Discover test finished: 2 found (0:00:00.2788078) ==========
[10/12/2017 12:02:01 AM Informational] ------ Run test started ------
[10/12/2017 12:02:01 AM Informational] NUnit Adapter 3.8.0.0: Test execution started
[10/12/2017 12:02:01 AM Informational] Running selected tests in C:\Users\******\documents\visual studio 2017\Projects\******\******\bin\Debug\******.dll
[10/12/2017 12:02:01 AM Informational] NUnit3TestExecutor converted 1 of 1 NUnit test cases
[10/12/2017 12:02:01 AM Warning] TearDown failed for test fixture ******.Specflow.Features.SpecFlowFeature1Feature
[10/12/2017 12:02:01 AM Warning] System.IO.FileNotFoundException : Could not load file or assembly 'Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
TearDown : System.NullReferenceException : Object reference not set to an instance of an object.
[10/12/2017 12:02:01 AM Warning] at System.ModuleHandle.ResolveType(RuntimeModule module, Int32 typeToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount, ObjectHandleOnStack type)
at System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule module, Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext)
at System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
at System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord caRecord, MetadataImport scope, Assembly& lastAptcaOkAssembly, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, Object[] attributes, IList derivedAttributes, RuntimeType& attributeType, IRuntimeMethodInfo& ctor, Boolean& ctorHasParameters, Boolean& isVarArg)
at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent)
at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeType type, RuntimeType caType, Boolean inherit)
at System.RuntimeType.GetCustomAttributes(Type attributeType, Boolean inherit)
at TechTalk.SpecFlow.Bindings.Discovery.RuntimeBindingRegistryBuilder.BuildBindingsFromType(Type type)
at TechTalk.SpecFlow.Bindings.Discovery.RuntimeBindingRegistryBuilder.BuildBindingsFromAssembly(Assembly assembly)
at TechTalk.SpecFlow.TestRunnerManager.BuildBindingRegistry(IEnumerable`1 bindingAssemblies)
at TechTalk.SpecFlow.TestRunnerManager.InitializeBindingRegistry(ITestRunner testRunner)
at TechTalk.SpecFlow.TestRunnerManager.CreateTestRunner(Int32 threadId)
at TechTalk.SpecFlow.TestRunnerManager.GetTestRunner(Int32 threadId)
at TechTalk.SpecFlow.TestRunnerManager.GetTestRunner(Assembly testAssembly, Nullable`1 managedThreadId)
at *****.Specflow.Features.SpecFlowFeature1Feature.FeatureSetup()
--TearDown
at *****.Specflow.Features.SpecFlowFeature1Feature.FeatureTearDown()
[10/12/2017 12:02:01 AM Informational] NUnit Adapter 3.8.0.0: Test execution complete
[10/12/2017 12:02:02 AM Informational] ========== Run test finished: 1 run (0:00:00.7393256) ==========
我檢查了引用,好像「失蹤」參考Microsoft.VisualStudio.QualityTools.CodedUITestFramework列在我的參考資料中。還有什麼可能是這個問題?
您是否嘗試解決缺失參考周圍的問題..如果不是這樣,那麼建議您先執行此操作.. –