Initial SpecFlow project and adjusting for x64 testing

Added bits from SpecFlow 1.2 install
Added lib/specflow libraries and nearly empty Spec test project
Updating Orchard.proj to use NUnit task and locate test projects by pattern instead of fixed list

--HG--
branch : dev
This commit is contained in:
Louis DeJardin
2010-04-05 13:30:02 -07:00
parent 6f63904d1c
commit 85a08396dd
22 changed files with 403 additions and 1 deletions

View File

@@ -11,6 +11,9 @@
<CompileFolder>$(BuildFolder)\Compile</CompileFolder>
<WebSitesFolder>$(CompileFolder)\_PublishedWebsites</WebSitesFolder>
<StageFolder>$(BuildFolder)\Stage</StageFolder>
<BuildPlatform Condition="$(ProgramW6432) != ''">x64</BuildPlatform>
<BuildPlatform Condition="$(BuildPlatform) == ''">x86</BuildPlatform>
</PropertyGroup>
<Import Project="$(LibFolder)\msbuild\MSBuild.Community.Tasks.Targets"/>
@@ -48,9 +51,29 @@
<!-- Testing -->
<Target Name ="Test">
<Exec Command="$(LibFolder)\nunit\nunit-console-x86.exe /xml=$(BuildFolder)\Orchard.Tests.xml $(CompileFolder)\Orchard.Core.Tests.dll $(CompileFolder)\Orchard.Tests.dll $(CompileFolder)\Orchard.Tests.Modules.dll $(CompileFolder)\Orchard.Web.Tests.dll $(CompileFolder)\MSBuild.Orchard.Tasks.Tests.dll" />
<CreateItem Include="$(CompileFolder)\*.Tests.*dll">
<Output TaskParameter="Include" ItemName="TestAssemblies" />
</CreateItem>
<!-- use x64 sqlite for tests depending on build platform -->
<Copy Condition="$(BuildPlatform) == 'x64'"
SourceFiles="$(LibFolder)\sqlite\x64\System.Data.SQLite.dll"
DestinationFiles="$(CompileFolder)\System.Data.SQLite.dll" />
<NUnit Assemblies="@(TestAssemblies)" ToolPath="$(LibFolder)\nunit" WorkingDirectory="$(CompileFolder)" OutputXmlFile="$(BuildFolder)\Orchard.Tests.xml" />
<!-- restore sqlite version if needed -->
<Copy Condition="$(BuildPlatform) == 'x64'"
SourceFiles="$(LibFolder)\sqlite\System.Data.SQLite.dll"
DestinationFiles="$(CompileFolder)\System.Data.SQLite.dll" />
</Target>
<Target Name ="Spec">
<CreateItem Include="$(CompileFolder)\*.Specs.dll">
<Output TaskParameter="Include" ItemName="SpecAssemblies" />
</CreateItem>
<NUnit Assemblies="@(SpecAssemblies)" ToolPath="$(LibFolder)\nunit" />
</Target>
<!-- Packaging -->

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,58 @@
<?xml version="1.0" encoding="utf-8" ?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="TechTalk.SpecFlow.tasks"/>
<!-- this setting is to workaround the bug in VS (does not detect changes during the pre-build event)
see: https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=423670&wa=wsignin1.0
-->
<PropertyGroup>
<UseHostCompilerIfAvailable>false</UseHostCompilerIfAvailable>
</PropertyGroup>
<PropertyGroup>
<ShowTrace Condition="'$(ShowTrace)'==''">false</ShowTrace>
<OverwriteReadOnlyFiles Condition="'$(OverwriteReadOnlyFiles)'==''">false</OverwriteReadOnlyFiles>
<ForceGeneration Condition="'$(ForceGeneration)'==''">false</ForceGeneration>
<VerboseOutput Condition="'$(VerboseOutput)'==''">false</VerboseOutput>
</PropertyGroup>
<PropertyGroup Condition="'$(BuildServerMode)' == ''">
<BuildServerMode Condition="'$(BuildingInsideVisualStudio)'=='true'">false</BuildServerMode>
<BuildServerMode Condition="'$(BuildingInsideVisualStudio)'!='true'">true</BuildServerMode>
</PropertyGroup>
<PropertyGroup>
<BuildDependsOn>
UpdateFeatureFilesInProject;
$(BuildDependsOn)
</BuildDependsOn>
<RebuildDependsOn>
SwitchToForceGenerate;
$(RebuildDependsOn)
</RebuildDependsOn>
</PropertyGroup>
<Target Name="SwitchToForceGenerate">
<PropertyGroup>
<ForceGeneration>true</ForceGeneration>
<OnlyUpdateIfChanged>true</OnlyUpdateIfChanged>
</PropertyGroup>
</Target>
<Target Name="UpdateFeatureFilesInProject">
<GenerateAll
ShowTrace="$(ShowTrace)"
BuildServerMode="$(BuildServerMode)"
OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
ProjectPath="$(MSBuildProjectFullPath)"
ForceGeneration="$(ForceGeneration)"
VerboseOutput="$(VerboseOutput)"
/>
</Target>
</Project>

View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8" ?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<SpecFlowTasksPath Condition="'$(SpecFlowTasksPath)'==''">specflow.exe</SpecFlowTasksPath>
</PropertyGroup>
<PropertyGroup>
<!-- handle absolute / targets-relative tasks path -->
<__SpecFlowTasksFullPath>$(SpecFlowTasksPath)</__SpecFlowTasksFullPath>
<!-- handle relative tasks path -->
<__SpecFlowTasksFullPath Condition="Exists('$(MSBuildProjectDirectory)\$(SpecFlowTasksPath)')"
>$(MSBuildProjectDirectory)\$(SpecFlowTasksPath)</__SpecFlowTasksFullPath>
</PropertyGroup>
<UsingTask TaskName="TechTalk.SpecFlow.Tools.MsBuild.GenerateAll" AssemblyFile="$(__SpecFlowTasksFullPath)" />
</Project>

View File

@@ -0,0 +1,50 @@
1.2.0 - 2009/11/25
New features:
+ Generate #line pragmas to the output file (Issue 26)
+ Allow transformation of feature files from command-line and MsBuild (Issue 3)
+ Merge all command-line tool (generation, reports) to a single executable: specflow.exe
+ Support for Dutch and Swedish language
+ Support enumerations in step binding arguments (Issue 28)
Fixed issues:
+ MsTest does not refresh tests automatically (Issue 25)
+ Fixes in report localization
+ Non-string parameters for bindings are not converted using the feature language (Issue 26)
1.1.0 - 2009/11/11
New features:
+ Support for MsTest (Issue 4)
+ Finalize configuration (Issue 13)
+ Support German, French and Hungarian languages (Issue 5)
+ Add strong-name for specflow assemblies (Issue 2)
+ Allow scenario events to be instance methods (Issue 20)
+ More descriptive name for the scenario outline example tests than XYZ_Variant1 (Issue 18)
+ NUnit SpecFlow test execution report (Issue 23)
+ Step definition usage report (Issue 24)
Fixed issues:
+ Runtime: Remove direct dependency on nunit.framework.dll from the runtime (Issue 12)
+ Runtime: Binding methods with more than 4 parameters cannot be used (Issue 21)
+ Generator: Special language characters (e.g. accented letters) are removed when generating test method names (Issue 22)
1.0.2 - 2009/10/20
New features:
+ Runtime: allow non-static bindings
+ Runtime: support multiple step attributes on a single binding method
Fixed issues:
+ VS: Error message is displayed when you add a SpecFlow project item to your project.
+ Parser: mixed order of Given/When/Then is not supported
+ Runtime: the original phrasing of the keywords (Given/And/But) is not preserved
+ Generator: the generated test class has a "Fixture" suffix
+ Parser: specifying any "given" should be optional
1.0.1 - 2009/10/13
Initial publish on http://www.specflow.org

BIN
lib/specflow/specflow.exe Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
lib/sqlite/x64/test.exe Normal file

Binary file not shown.

View File

@@ -0,0 +1,8 @@
<configuration>
<system.data>
<DbProviderFactories>
<remove invariant="System.Data.SQLite"/>
<add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".Net Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" />
</DbProviderFactories>
</system.data>
</configuration>

View File

@@ -0,0 +1,40 @@
using NUnit.Framework;
using TechTalk.SpecFlow;
namespace Orchard.Specs.Bindings {
[Binding]
public class SanityCheck {
private bool _runSteps;
private bool _valueSet;
private int _value;
[Given("I have a scenario")]
public void GivenIHaveAScenario() {
}
[When("I run steps")]
public void WhenIRunSteps() {
_runSteps = true;
}
[When(@"they have values like ""(.*)""")]
public void WhenTheyHaveValuesLike(int value) {
Assert.That(_valueSet, Is.False);
_value = value;
_valueSet = true;
}
[Then("they run")]
public void ThenTheyRun() {
Assert.That(_runSteps, Is.True);
}
[Then("values like five are captured")]
public void ThenValuesLikeFiveAreCaptured() {
Assert.That(_valueSet, Is.True);
Assert.That(_value, Is.EqualTo(5));
}
}
}

View File

@@ -0,0 +1,78 @@
<?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>{7354DF37-934B-46CF-A13C-455D5F5F5413}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Orchard.Specs</RootNamespace>
<AssemblyName>Orchard.Specs</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</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="nunit.framework, Version=2.5.2.9222, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\lib\nunit\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="System" />
<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" />
<Reference Include="TechTalk.SpecFlow, Version=1.2.0.0, Culture=neutral, PublicKeyToken=0778194805d6db41, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\lib\specflow\TechTalk.SpecFlow.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="UsingSpecFlow.feature.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>UsingSpecFlow.feature</DependentUpon>
</Compile>
<Compile Include="Bindings\SanityCheck.cs" />
</ItemGroup>
<ItemGroup>
<None Include="UsingSpecFlow.feature">
<Generator>SpecFlowSingleFileGenerator</Generator>
<LastGenOutput>UsingSpecFlow.feature.cs</LastGenOutput>
</None>
</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>

View File

@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Orchard.Specs")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("Orchard.Specs")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2010")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("c33d89c4-824c-4859-bd89-695aa1efd17b")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,11 @@
Feature: Using SpecFlow
In order to test Orchard
As a developer or contributor
I want to define scenarios that ensure functionality
Scenario: Spec flow generates and runs via nunit
Given I have a scenario
When I run steps
And they have values like "5"
Then they run
And values like five are captured

View File

@@ -0,0 +1,74 @@
// ------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by SpecFlow (http://www.specflow.org/).
// SpecFlow Version:1.2.0.0
// Runtime Version:2.0.50727.4927
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
// ------------------------------------------------------------------------------
namespace Orchard.Specs
{
using TechTalk.SpecFlow;
[NUnit.Framework.TestFixtureAttribute()]
[NUnit.Framework.DescriptionAttribute("Using SpecFlow")]
public partial class UsingSpecFlowFeature
{
private static TechTalk.SpecFlow.ITestRunner testRunner;
#line 1 "UsingSpecFlow.feature"
#line hidden
[NUnit.Framework.TestFixtureSetUpAttribute()]
public virtual void FeatureSetup()
{
testRunner = TechTalk.SpecFlow.TestRunnerManager.GetTestRunner();
TechTalk.SpecFlow.FeatureInfo featureInfo = new TechTalk.SpecFlow.FeatureInfo(new System.Globalization.CultureInfo("en-US"), "Using SpecFlow", "In order to test Orchard\r\nAs a developer or contributor\r\nI want to define scenari" +
"os that ensure functionality", ((string[])(null)));
testRunner.OnFeatureStart(featureInfo);
}
[NUnit.Framework.TestFixtureTearDownAttribute()]
public virtual void FeatureTearDown()
{
testRunner.OnFeatureEnd();
testRunner = null;
}
public virtual void ScenarioSetup(TechTalk.SpecFlow.ScenarioInfo scenarioInfo)
{
testRunner.OnScenarioStart(scenarioInfo);
}
[NUnit.Framework.TearDownAttribute()]
public virtual void ScenarioTearDown()
{
testRunner.OnScenarioEnd();
}
[NUnit.Framework.TestAttribute()]
[NUnit.Framework.DescriptionAttribute("Spec flow generates and runs via nunit")]
public virtual void SpecFlowGeneratesAndRunsViaNunit()
{
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Spec flow generates and runs via nunit", ((string[])(null)));
#line 6
this.ScenarioSetup(scenarioInfo);
#line 7
testRunner.Given("I have a scenario");
#line 8
testRunner.When("I run steps");
#line 9
testRunner.And("they have values like \"5\"");
#line 10
testRunner.Then("they run");
#line 11
testRunner.And("values like five are captured");
#line hidden
testRunner.CollectScenarioErrors();
}
}
}

View File

@@ -51,6 +51,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Futures", "Futures", "{E75A
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Futures.Widgets", "Orchard.Web\Modules\Futures.Widgets\Futures.Widgets.csproj", "{E65E5633-C0FF-453C-A906-481C14F969D6}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.Specs", "Orchard.Specs\Orchard.Specs.csproj", "{7354DF37-934B-46CF-A13C-455D5F5F5413}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -141,6 +143,10 @@ Global
{E65E5633-C0FF-453C-A906-481C14F969D6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E65E5633-C0FF-453C-A906-481C14F969D6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E65E5633-C0FF-453C-A906-481C14F969D6}.Release|Any CPU.Build.0 = Release|Any CPU
{7354DF37-934B-46CF-A13C-455D5F5F5413}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7354DF37-934B-46CF-A13C-455D5F5F5413}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7354DF37-934B-46CF-A13C-455D5F5F5413}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7354DF37-934B-46CF-A13C-455D5F5F5413}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -150,6 +156,7 @@ Global
{6CB3EB30-F725-45C0-9742-42599BA8E8D2} = {74E681ED-FECC-4034-B9BD-01B0BB1BDECA}
{2FC1D9C8-446D-4414-B252-5E9FBE61EB63} = {74E681ED-FECC-4034-B9BD-01B0BB1BDECA}
{ABC826D4-2FA1-4F2F-87DE-E6095F653810} = {74E681ED-FECC-4034-B9BD-01B0BB1BDECA}
{7354DF37-934B-46CF-A13C-455D5F5F5413} = {74E681ED-FECC-4034-B9BD-01B0BB1BDECA}
{954CA994-D204-468B-9D69-51F6AD3E1C29} = {E9C9F120-07BA-4DFB-B9C3-3AFB9D44C9D5}
{D9A7B330-CD22-4DA1-A95A-8DE1982AD8EB} = {E9C9F120-07BA-4DFB-B9C3-3AFB9D44C9D5}
{79AED36E-ABD0-4747-93D3-8722B042454B} = {E9C9F120-07BA-4DFB-B9C3-3AFB9D44C9D5}