-
Notifications
You must be signed in to change notification settings - Fork 750
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
.feature files are working like expected in silverlight projects
added "mstest.silverlight" generator
- Loading branch information
Showing
7 changed files
with
348 additions
and
199 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,100 +1,101 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProductVersion>9.0.30729</ProductVersion> | ||
<SchemaVersion>2.0</SchemaVersion> | ||
<ProjectGuid>{453D8014-B6CD-4E86-80A8-D59F59092334}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>TechTalk.SpecFlow.Generator</RootNamespace> | ||
<AssemblyName>TechTalk.SpecFlow.Generator</AssemblyName> | ||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
<SignAssembly>true</SignAssembly> | ||
<AssemblyOriginatorKeyFile>..\specflow.snk</AssemblyOriginatorKeyFile> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>bin\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\Release\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="Microsoft.Build.Engine" /> | ||
<Reference Include="System" /> | ||
<Reference Include="System.configuration" /> | ||
<Reference Include="System.Core"> | ||
<RequiredTargetFramework>3.5</RequiredTargetFramework> | ||
</Reference> | ||
<Reference Include="System.Xml.Linq"> | ||
<RequiredTargetFramework>3.5</RequiredTargetFramework> | ||
</Reference> | ||
<Reference Include="System.Data.DataSetExtensions"> | ||
<RequiredTargetFramework>3.5</RequiredTargetFramework> | ||
</Reference> | ||
<Reference Include="System.Data" /> | ||
<Reference Include="System.Xml" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="..\Runtime\Configuration\ConfigDefaults.cs"> | ||
<Link>Configuration\ConfigDefaults.cs</Link> | ||
</Compile> | ||
<Compile Include="..\Runtime\Configuration\ConfigurationSectionHandler.cs"> | ||
<Link>Configuration\ConfigurationSectionHandler.cs</Link> | ||
</Compile> | ||
<Compile Include="..\Runtime\Configuration\ConfigurationServices.cs"> | ||
<Link>Configuration\ConfigurationServices.cs</Link> | ||
</Compile> | ||
<Compile Include="..\Runtime\Configuration\MissingOrPendingStepsOutcome.cs"> | ||
<Link>Configuration\MissingOrPendingStepsOutcome.cs</Link> | ||
</Compile> | ||
<Compile Include="..\Runtime\StringExtensions.cs"> | ||
<Link>StringExtensions.cs</Link> | ||
</Compile> | ||
<Compile Include="..\VersionInfo.cs"> | ||
<Link>VersionInfo.cs</Link> | ||
</Compile> | ||
<Compile Include="BatchGenerator.cs" /> | ||
<Compile Include="CodeDomHelper.cs" /> | ||
<Compile Include="Configuration\GeneratorConfiguration.cs" /> | ||
<Compile Include="Configuration\GeneratorConfigurationReader.cs" /> | ||
<Compile Include="Configuration\MsBuildProjectReader.cs" /> | ||
<Compile Include="Configuration\SpecFlowProject.cs" /> | ||
<Compile Include="UnitTestConverter\ISpecFlowUnitTestConverter.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
<Compile Include="SpecFlowGenerator.cs" /> | ||
<Compile Include="SpecFlowUnitTestConverter.cs" /> | ||
<Compile Include="UnitTestProvider\MbUnitTestGeneratorProvider.cs" /> | ||
<Compile Include="UnitTestProvider\XUnitTestGeneratorProvider.cs" /> | ||
<Compile Include="UnitTestProvider\IUnitTestGeneratorProvider.cs" /> | ||
<Compile Include="UnitTestProvider\MsTestGeneratorProvider.cs" /> | ||
<Compile Include="UnitTestProvider\NUnitTestConverter.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\Parser\TechTalk.SpecFlow.Parser.csproj"> | ||
<Project>{7CCEF6D6-FC17-422E-9BED-EDD752B6496F}</Project> | ||
<Name>TechTalk.SpecFlow.Parser</Name> | ||
</ProjectReference> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProductVersion>9.0.30729</ProductVersion> | ||
<SchemaVersion>2.0</SchemaVersion> | ||
<ProjectGuid>{453D8014-B6CD-4E86-80A8-D59F59092334}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>TechTalk.SpecFlow.Generator</RootNamespace> | ||
<AssemblyName>TechTalk.SpecFlow.Generator</AssemblyName> | ||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
<SignAssembly>true</SignAssembly> | ||
<AssemblyOriginatorKeyFile>..\specflow.snk</AssemblyOriginatorKeyFile> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>bin\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\Release\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="Microsoft.Build.Engine" /> | ||
<Reference Include="System" /> | ||
<Reference Include="System.configuration" /> | ||
<Reference Include="System.Core"> | ||
<RequiredTargetFramework>3.5</RequiredTargetFramework> | ||
</Reference> | ||
<Reference Include="System.Xml.Linq"> | ||
<RequiredTargetFramework>3.5</RequiredTargetFramework> | ||
</Reference> | ||
<Reference Include="System.Data.DataSetExtensions"> | ||
<RequiredTargetFramework>3.5</RequiredTargetFramework> | ||
</Reference> | ||
<Reference Include="System.Data" /> | ||
<Reference Include="System.Xml" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="..\Runtime\Configuration\ConfigDefaults.cs"> | ||
<Link>Configuration\ConfigDefaults.cs</Link> | ||
</Compile> | ||
<Compile Include="..\Runtime\Configuration\ConfigurationSectionHandler.cs"> | ||
<Link>Configuration\ConfigurationSectionHandler.cs</Link> | ||
</Compile> | ||
<Compile Include="..\Runtime\Configuration\ConfigurationServices.cs"> | ||
<Link>Configuration\ConfigurationServices.cs</Link> | ||
</Compile> | ||
<Compile Include="..\Runtime\Configuration\MissingOrPendingStepsOutcome.cs"> | ||
<Link>Configuration\MissingOrPendingStepsOutcome.cs</Link> | ||
</Compile> | ||
<Compile Include="..\Runtime\StringExtensions.cs"> | ||
<Link>StringExtensions.cs</Link> | ||
</Compile> | ||
<Compile Include="..\VersionInfo.cs"> | ||
<Link>VersionInfo.cs</Link> | ||
</Compile> | ||
<Compile Include="BatchGenerator.cs" /> | ||
<Compile Include="CodeDomHelper.cs" /> | ||
<Compile Include="Configuration\GeneratorConfiguration.cs" /> | ||
<Compile Include="Configuration\GeneratorConfigurationReader.cs" /> | ||
<Compile Include="Configuration\MsBuildProjectReader.cs" /> | ||
<Compile Include="Configuration\SpecFlowProject.cs" /> | ||
<Compile Include="UnitTestConverter\ISpecFlowUnitTestConverter.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
<Compile Include="SpecFlowGenerator.cs" /> | ||
<Compile Include="SpecFlowUnitTestConverter.cs" /> | ||
<Compile Include="UnitTestProvider\MsTestSilverlightGeneratorProvider.cs" /> | ||
<Compile Include="UnitTestProvider\MbUnitTestGeneratorProvider.cs" /> | ||
<Compile Include="UnitTestProvider\XUnitTestGeneratorProvider.cs" /> | ||
<Compile Include="UnitTestProvider\IUnitTestGeneratorProvider.cs" /> | ||
<Compile Include="UnitTestProvider\MsTestGeneratorProvider.cs" /> | ||
<Compile Include="UnitTestProvider\NUnitTestConverter.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\Parser\TechTalk.SpecFlow.Parser.csproj"> | ||
<Project>{7CCEF6D6-FC17-422E-9BED-EDD752B6496F}</Project> | ||
<Name>TechTalk.SpecFlow.Parser</Name> | ||
</ProjectReference> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. | ||
Other similar extension points exist, see Microsoft.Common.targets. | ||
<Target Name="BeforeBuild"> | ||
</Target> | ||
<Target Name="AfterBuild"> | ||
</Target> | ||
--> | ||
--> | ||
</Project> |
124 changes: 124 additions & 0 deletions
124
Generator/UnitTestProvider/MsTestSilverlightGeneratorProvider.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
using System.CodeDom; | ||
using System.Collections.Generic; | ||
|
||
namespace TechTalk.SpecFlow.Generator.UnitTestProvider | ||
{ | ||
// TODO: it's an ugly copy-paste of MsTestGeneratorProvider - we should consider refactoring the generator creation to support custom factories. | ||
public class MsTestSilverlightGeneratorProvider : IUnitTestGeneratorProvider | ||
{ | ||
private const string TESTFIXTURE_ATTR = "Microsoft.VisualStudio.TestTools.UnitTesting.TestClassAttribute"; | ||
private const string TEST_ATTR = "Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute"; | ||
private const string PROPERTY_ATTR = "Microsoft.VisualStudio.TestTools.UnitTesting.TestPropertyAttribute"; | ||
private const string TESTFIXTURESETUP_ATTR = "Microsoft.VisualStudio.TestTools.UnitTesting.ClassInitializeAttribute"; | ||
private const string TESTFIXTURETEARDOWN_ATTR = "Microsoft.VisualStudio.TestTools.UnitTesting.ClassCleanupAttribute"; | ||
private const string TESTSETUP_ATTR = "Microsoft.VisualStudio.TestTools.UnitTesting.TestInitializeAttribute"; | ||
private const string TESTTEARDOWN_ATTR = "Microsoft.VisualStudio.TestTools.UnitTesting.TestCleanupAttribute"; | ||
private const string IGNORE_ATTR = "Microsoft.VisualStudio.TestTools.UnitTesting.IgnoreAttribute"; | ||
private const string DESCRIPTION_ATTR = "Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute"; | ||
|
||
private const string FEATURE_TITILE_PROPERTY_NAME = "FeatureTitle"; | ||
private const string FEATURE_TITILE_KEY = "FeatureTitle"; | ||
|
||
private const string TESTCONTEXT_TYPE = "Microsoft.VisualStudio.TestTools.UnitTesting.TestContext"; | ||
|
||
private CodeTypeDeclaration currentTestTypeDeclaration = null; | ||
|
||
public void SetTestFixture(CodeTypeDeclaration typeDeclaration, string title, string description) | ||
{ | ||
typeDeclaration.CustomAttributes.Add( | ||
new CodeAttributeDeclaration( | ||
new CodeTypeReference(TESTFIXTURE_ATTR))); | ||
|
||
//as in mstest, you cannot mark classes with the description attribute, we | ||
//just remember the feature title, and we will apply it for each test method | ||
typeDeclaration.UserData[FEATURE_TITILE_KEY] = title; | ||
|
||
currentTestTypeDeclaration = typeDeclaration; | ||
} | ||
|
||
private void SetDescription(CodeAttributeDeclarationCollection customAttributes, string description) | ||
{ | ||
customAttributes.Add( | ||
new CodeAttributeDeclaration( | ||
new CodeTypeReference(DESCRIPTION_ATTR), | ||
new CodeAttributeArgument( | ||
new CodePrimitiveExpression(description)))); | ||
} | ||
|
||
private void SetProperty(CodeAttributeDeclarationCollection customAttributes, string name, string value) | ||
{ | ||
customAttributes.Add( | ||
new CodeAttributeDeclaration( | ||
new CodeTypeReference(PROPERTY_ATTR), | ||
new CodeAttributeArgument( | ||
new CodePrimitiveExpression(name)), | ||
new CodeAttributeArgument( | ||
new CodePrimitiveExpression(value)))); | ||
} | ||
|
||
public void SetTestFixtureCategories(CodeTypeDeclaration typeDeclaration, IEnumerable<string> categories) | ||
{ | ||
//MsTest does not support caregories... :( | ||
} | ||
|
||
public void SetTest(CodeMemberMethod memberMethod, string title) | ||
{ | ||
memberMethod.CustomAttributes.Add( | ||
new CodeAttributeDeclaration( | ||
new CodeTypeReference(TEST_ATTR))); | ||
|
||
SetDescription(memberMethod.CustomAttributes, title); | ||
|
||
if (currentTestTypeDeclaration == null) | ||
return; | ||
|
||
string featureTitle = currentTestTypeDeclaration.UserData[FEATURE_TITILE_KEY] as string; | ||
if (featureTitle != null) | ||
SetProperty(memberMethod.CustomAttributes, FEATURE_TITILE_PROPERTY_NAME, featureTitle); | ||
} | ||
|
||
public void SetTestCategories(CodeMemberMethod memberMethod, IEnumerable<string> categories) | ||
{ | ||
//MsTest does not support caregories... :( | ||
} | ||
|
||
public void SetTestSetup(CodeMemberMethod memberMethod) | ||
{ | ||
memberMethod.CustomAttributes.Add( | ||
new CodeAttributeDeclaration( | ||
new CodeTypeReference(TESTSETUP_ATTR))); | ||
} | ||
|
||
public void SetTestFixtureSetup(CodeMemberMethod memberMethod) | ||
{ | ||
memberMethod.Attributes |= MemberAttributes.Static; | ||
|
||
memberMethod.CustomAttributes.Add( | ||
new CodeAttributeDeclaration( | ||
new CodeTypeReference(TESTFIXTURESETUP_ATTR))); | ||
} | ||
|
||
public void SetTestFixtureTearDown(CodeMemberMethod memberMethod) | ||
{ | ||
memberMethod.Attributes |= MemberAttributes.Static; | ||
|
||
memberMethod.CustomAttributes.Add( | ||
new CodeAttributeDeclaration( | ||
new CodeTypeReference(TESTFIXTURETEARDOWN_ATTR))); | ||
} | ||
|
||
public void SetTestTearDown(CodeMemberMethod memberMethod) | ||
{ | ||
memberMethod.CustomAttributes.Add( | ||
new CodeAttributeDeclaration( | ||
new CodeTypeReference(TESTTEARDOWN_ATTR))); | ||
} | ||
|
||
public void SetIgnore(CodeTypeMember codeTypeMember) | ||
{ | ||
codeTypeMember.CustomAttributes.Add( | ||
new CodeAttributeDeclaration( | ||
new CodeTypeReference(IGNORE_ATTR))); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,16 @@ | ||
<?xml version='1.0' encoding='UTF-8'?> | ||
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> | ||
<Fragment> | ||
<ComponentGroup Id="Product.Generated"> | ||
<ComponentGroupRef Id="TechTalk.SpecFlow.Generator.Binaries" /> | ||
<ComponentGroupRef Id="TechTalk.SpecFlow.Parser.Binaries" /> | ||
<ComponentGroupRef Id="TechTalk.SpecFlow.Reporting.Binaries" /> | ||
<ComponentGroupRef Id="TechTalk.SpecFlow.Binaries" /> | ||
<ComponentGroupRef Id="TechTalk.SpecFlow.Tools.Binaries" /> | ||
<ComponentGroupRef Id="TechTalk.SpecFlow.VsIntegration.Binaries" /> | ||
</ComponentGroup> | ||
</Fragment> | ||
<?xml version='1.0' encoding='UTF-8'?> | ||
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> | ||
<Fragment> | ||
<ComponentGroup Id="Product.Generated"> | ||
<ComponentGroupRef Id="TechTalk.SpecFlow.Generator.Binaries" /> | ||
<ComponentGroupRef Id="TechTalk.SpecFlow.Parser.Binaries" /> | ||
<ComponentGroupRef Id="TechTalk.SpecFlow.Reporting.Binaries" /> | ||
<ComponentGroupRef Id="TechTalk.SpecFlow.Silverlight.Binaries" /> | ||
<ComponentGroupRef Id="TechTalk.SpecFlow.Silverlight.Content" /> | ||
<ComponentGroupRef Id="TechTalk.SpecFlow.Silverlight.Satellites" /> | ||
<ComponentGroupRef Id="TechTalk.SpecFlow.Binaries" /> | ||
<ComponentGroupRef Id="TechTalk.SpecFlow.Tools.Binaries" /> | ||
<ComponentGroupRef Id="TechTalk.SpecFlow.VsIntegration.Binaries" /> | ||
</ComponentGroup> | ||
</Fragment> | ||
</Wix> |
Oops, something went wrong.