Skip to content

Commit

Permalink
Added Acceptance Tests with SpecFlow
Browse files Browse the repository at this point in the history
  • Loading branch information
robertgreiner committed Jul 20, 2011
1 parent 01ed9bb commit c4deb0c
Show file tree
Hide file tree
Showing 6 changed files with 226 additions and 0 deletions.
21 changes: 21 additions & 0 deletions MouseAlive.AcceptanceTests/App.config
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="specFlow" type="TechTalk.SpecFlow.Configuration.ConfigurationSectionHandler, TechTalk.SpecFlow"/>
</configSections>

<!-- the following configuration represent the defaults -->
<specFlow>
<language feature="en-US" />

<unitTestProvider name="NUnit" />

<runtime detectAmbiguousMatches="true"
stopAtFirstError="false"
missingOrPendingStepsOutcome="Inconclusive" />

<trace traceSuccessfulSteps="true"
traceTimings="false"
minTracedDuration="0:0:0.1" />
</specFlow>
</configuration>
76 changes: 76 additions & 0 deletions MouseAlive.AcceptanceTests/MouseAlive.AcceptanceTests.csproj
@@ -0,0 +1,76 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{AF3E4F64-5C96-4055-B4A6-3ED747A0F762}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>MouseAlive.AcceptanceTests</RootNamespace>
<AssemblyName>MouseAlive.AcceptanceTests</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
<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|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<StartupObject />
</PropertyGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="MouseUtilities.feature">
<Generator>SpecFlowSingleFileGenerator</Generator>
<LastGenOutput>MouseUtilities.feature.cs</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<Compile Include="MouseUtilities.feature.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>MouseUtilities.feature</DependentUpon>
</Compile>
<Compile Include="MouseUtilitiesSteps.cs" />
</ItemGroup>
<ItemGroup>
<Reference Include="nunit.framework, Version=2.5.10.11092, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL" />
<Reference Include="System" />
<Reference Include="System.Drawing" />
<Reference Include="TechTalk.SpecFlow">
<HintPath>C:\Program Files (x86)\TechTalk\SpecFlow\TechTalk.SpecFlow.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\MouseAlive\MouseAlive.csproj">
<Project>{284DE1A9-7189-4B58-8573-81681A982F9F}</Project>
<Name>MouseAlive</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>
9 changes: 9 additions & 0 deletions MouseAlive.AcceptanceTests/MouseUtilities.feature
@@ -0,0 +1,9 @@
Feature: Mouse Utilities
In order to keep the screen saver from activating
As a remote support agent
I want to have the mouse moved for me automatically

Scenario: Move Mouse
Given I am working on a machine with MouseAlive
When a certain amount of time has elapsed
Then the mouse should move automatically
75 changes: 75 additions & 0 deletions MouseAlive.AcceptanceTests/MouseUtilities.feature.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 33 additions & 0 deletions MouseAlive.AcceptanceTests/MouseUtilitiesSteps.cs
@@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TechTalk.SpecFlow;
using NUnit.Framework;
using System.Drawing;

namespace MouseAlive.AcceptanceTests {
[Binding]
public class MouseUtilitiesSteps {

private Point point;

[Given("I am working on a machine with MouseAlive")]
public void GivenIAmWorkingOnAMachineWithMouseAlive() {
point = MouseUtilities.GetMousePosition();
}

[When("a certain amount of time has elapsed")]
public void WhenIAmAwayFromMyDesk() {
var oldPoint = point;
MouseUtilities.MoveMouse();

}

[Then("the mouse should move automatically")]
public void ThenTheMouseShouldMoveAutomaticallyOverATimeInterval() {
var newPoint = MouseUtilities.GetMousePosition();
Assert.AreNotEqual(point, newPoint);
}
}
}
12 changes: 12 additions & 0 deletions MouseAlive.sln
Expand Up @@ -5,6 +5,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MouseAlive", "MouseAlive\Mo
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MouseAlive.Tests", "MouseAlive.Tests\MouseAlive.Tests.csproj", "{49D09C41-50AE-4D6E-AA19-30CA7687AEEC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MouseAlive.AcceptanceTests", "MouseAlive.AcceptanceTests\MouseAlive.AcceptanceTests.csproj", "{AF3E4F64-5C96-4055-B4A6-3ED747A0F762}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -35,6 +37,16 @@ Global
{49D09C41-50AE-4D6E-AA19-30CA7687AEEC}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{49D09C41-50AE-4D6E-AA19-30CA7687AEEC}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{49D09C41-50AE-4D6E-AA19-30CA7687AEEC}.Release|x86.ActiveCfg = Release|Any CPU
{AF3E4F64-5C96-4055-B4A6-3ED747A0F762}.Debug|Any CPU.ActiveCfg = Debug|x86
{AF3E4F64-5C96-4055-B4A6-3ED747A0F762}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
{AF3E4F64-5C96-4055-B4A6-3ED747A0F762}.Debug|Mixed Platforms.Build.0 = Debug|x86
{AF3E4F64-5C96-4055-B4A6-3ED747A0F762}.Debug|x86.ActiveCfg = Debug|x86
{AF3E4F64-5C96-4055-B4A6-3ED747A0F762}.Debug|x86.Build.0 = Debug|x86
{AF3E4F64-5C96-4055-B4A6-3ED747A0F762}.Release|Any CPU.ActiveCfg = Release|x86
{AF3E4F64-5C96-4055-B4A6-3ED747A0F762}.Release|Mixed Platforms.ActiveCfg = Release|x86
{AF3E4F64-5C96-4055-B4A6-3ED747A0F762}.Release|Mixed Platforms.Build.0 = Release|x86
{AF3E4F64-5C96-4055-B4A6-3ED747A0F762}.Release|x86.ActiveCfg = Release|x86
{AF3E4F64-5C96-4055-B4A6-3ED747A0F762}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down

0 comments on commit c4deb0c

Please sign in to comment.