Я использую Coded UI & SpecFlow. Я использовал следующий шаблон, и раньше он работал нормально с последних 6 месяцев.
https://github.com/aqdasiftekhar/SpecFlowCodedUI/
У меня возникла следующая проблема за последние два дня, когда я пытаюсь восстановить файл функции.
Исключение в файле Feature.CS:
We could not find a data exchange file at the path BoDi.ObjectContainerException: Multiple public constructors with same maximum parameter count are not supported! TechTalk.SpecFlow.Utils.CodeDomHelper (resolution path: TechTalk.SpecFlow.CodedUI.MsTest.SpecFlowCodedUITestGenerator)
Please open an issue at https://github.com/techtalk/SpecFlow/issues/
Complete output:
BoDi.ObjectContainerException: Multiple public constructors with same maximum parameter count are not supported! TechTalk.SpecFlow.Utils.CodeDomHelper (resolution path: TechTalk.SpecFlow.CodedUI.MsTest.SpecFlowCodedUITestGenerator)
at BoDi.ObjectContainer.CreateObject(Type type, IEnumerable1 resolutionPath, RegistrationKey keyToResolve) at BoDi.ObjectContainer.TypeRegistration.Resolve(ObjectContainer container, RegistrationKey keyToResolve, IEnumerable1 resolutionPath)
at BoDi.ObjectContainer.CreateObjectFor(RegistrationKey keyToResolve, IEnumerable1 resolutionPath) at BoDi.ObjectContainer.Resolve(Type typeToResolve, IEnumerable1 resolutionPath, String name)
at BoDi.ObjectContainer.<>c__DisplayClass6.b__5(ParameterInfo p)
at System.Linq.Enumerable.WhereSelectArrayIterator2.MoveNext() at System.Linq.Buffer1..ctor(IEnumerable1 source) at System.Linq.Enumerable.ToArray[TSource](IEnumerable1 source)
at BoDi.ObjectContainer.ResolveArguments(IEnumerable1 parameters, RegistrationKey keyToResolve, IEnumerable1 resolutionPath)
at BoDi.ObjectContainer.CreateObject(Type type, IEnumerable1 resolutionPath, RegistrationKey keyToResolve) at BoDi.ObjectContainer.TypeRegistration.Resolve(ObjectContainer container, RegistrationKey keyToResolve, IEnumerable1 resolutionPath)
at BoDi.ObjectContainer.CreateObjectFor(RegistrationKey keyToResolve, IEnumerable1 resolutionPath) at BoDi.ObjectContainer.Resolve(Type typeToResolve, IEnumerable1 resolutionPath, String name)
at BoDi.ObjectContainer.Resolve[T](String name)
at TechTalk.SpecFlow.Generator.GeneratorContainerBuilder.CreateContainer(SpecFlowConfigurationHolder configurationHolder, ProjectSettings projectSettings)
at TechTalk.SpecFlow.Generator.TestGeneratorFactory.CreateGenerator(ProjectSettings projectSettings)
at TechTalk.SpecFlow.VisualStudio.CodeBehindGenerator.Actions.GenerateTestFileAction.GenerateTestFile(GenerateTestFileParameters opts)
Command: C:\Users\aqdas\AppData\Local\Microsoft\VisualStudio\15.0_4d3f9930\Extensions\5yaz3tdw.3ra\TechTalk.SpecFlow.VisualStudio.CodeBehindGenerator.exe
Parameters: GenerateTestFile --featurefile C:\Users\aqdas\AppData\Local\Temp\2\tmpF07B.tmp --outputdirectory C:\Users\aqdas\AppData\Local\Temp\2 --projectsettingsfile C:\Users\aqdas\AppData\Local\Temp\2\tmpF07A.tmp
Working Directory: C:\Users\aqdas\ProjectName\ProjectFolder\Project.TestFolder\packages\SpecFlow.2.1.0\tools
Мой файл конфигурации:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section
name="specFlow" type="TechTalk.SpecFlow.Configuration.ConfigurationSectionHandler, TechTalk.SpecFlow"/>
</configSections>
<specFlow>
<unitTestProvider name="MsTest"
generatorProvider="TechTalk.SpecFlow.CodedUI.MsTest.SpecFlowCodedUITestGenerator, TechTalk.SpecFlow.CodedUI.MsTest"
runtimeProvider="TechTalk.SpecFlow.UnitTestProvider.MsTestRuntimeProvider, TechTalk.SpecFlow" />
</specFlow>
</configuration>
Код генератора спецпотока:
namespace TechTalk.SpecFlow.CodedUI.MsTest
{
using System.CodeDom;
using TechTalk.SpecFlow.Generator.UnitTestProvider;
using TechTalk.SpecFlow.Utils;
public class SpecFlowCodedUITestGenerator : MsTestGeneratorProvider
{
public SpecFlowCodedUITestGenerator(CodeDomHelper codeDomHelper)
: base(codeDomHelper)
{
}
public override void SetTestClass(TechTalk.SpecFlow.Generator.TestClassGenerationContext generationContext, string featureTitle, string featureDescription)
{
base.SetTestClass(generationContext, featureTitle, featureDescription);
foreach (CodeAttributeDeclaration customAttribute in generationContext.TestClass.CustomAttributes)
{
if (customAttribute.Name == "Microsoft.VisualStudio.TestTools.UnitTesting.TestClassAttribute")
{
generationContext.TestClass.CustomAttributes.Remove(customAttribute);
break;
}
}
generationContext.TestClass.CustomAttributes.Add(new CodeAttributeDeclaration(new CodeTypeReference("Microsoft.VisualStudio.TestTools.UITesting.CodedUITestAttribute")));
}
}
}
Я разместил вопрос на GitHub Link https://github.com/techtalk/SpecFlow/issues/1262
Я использую
- Visual Studio 2017, версия 15.6.7
- Microsoft .NET Framework 4.6.1
- SpecFlow 2017.2.7 Расширение
- Specflow 2.0.1 Пакет NuGet
Я буду благодарен вам, если кто-нибудь сможет помочь мне решить эту проблему.
Привет.