Last active
December 21, 2015 02:19
-
-
Save nicolaspanel/6234297 to your computer and use it in GitHub Desktop.
SpecFlow Tests configuration for VS 2012 Express
This file contains hidden or 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
<?xml version="1.0" encoding="utf-8"?> | |
<configuration> | |
<configSections> | |
<section name="specFlow" type="TechTalk.SpecFlow.Configuration.ConfigurationSectionHandler, TechTalk.SpecFlow" /> | |
</configSections> | |
<specFlow> | |
<!-- For additional details on SpecFlow configuration options see http://go.specflow.org/doc-config --> | |
<!-- use unit test provider SpecRun+NUnit or SpecRun+MsTest for being able to execute the tests with SpecRun and another provider --> | |
<unitTestProvider name="NUnit" /> | |
</specFlow> | |
</configuration> |
This file contains hidden or 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
:: Add to VS2012 Express external tool command | |
:: Title "Run SpecFlow Tests" | |
:: Arguments $(TargetName)$(TargetExt) $(ProjectDir)$(ProjectFileName) $(BinDir)TestResult.xml | |
:: %1 $(TargetName)$(TargetExt) => path to the dll, ex : C:\...\bin\debug\*.Specs.dll | |
:: %2 $(ProjectDir)$(ProjectFileName) => projectFile, ex : C:\...\*.Specs.csproj | |
:: Initial Directory: $(BinDir) | |
:: Note : Make sure "Use Output window" is checked | |
echo "param1 = %1" | |
echo "param2 = %2" | |
echo Starting to generate SpecFlow unit tests | |
SpecFlow generateAll %2 /force /verbose | |
if NOT %errorlevel% == 0 ( | |
echo "Error generate SpecFlow unit tests - %errorlevel%" | |
GOTO :exit | |
) | |
echo Finished generating SpecFlow unit tests. Start running... | |
nunit-console-x86 %1 | |
if NOT %errorlevel% == 0 ( | |
echo "Error running tests - %errorlevel%" | |
GOTO :exit | |
) | |
SpecFlow nunitexecutionreport %2 | |
if NOT %errorlevel% == 0 ( | |
echo "Error generating report - %errorlevel%" | |
GOTO :exit | |
) | |
:: display result in the browzer | |
TestResult.html | |
SpecFlow stepdefinitionreport %2 | |
if NOT %errorlevel% == 0 ( | |
echo "Error generating Step Definition reports - %errorlevel%" | |
GOTO :exit | |
) | |
StepDefinitionReport.html | |
echo Finished running SpecFlow unit tests. | |
:exit |
This file contains hidden or 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
Feature: test | |
In order to avoid silly mistakes | |
As a math idiot | |
I want to be told the sum of two numbers | |
@mytag | |
Scenario: Add two numbers | |
Given I have entered 50 into the calculator | |
And I have entered 70 into the calculator | |
When I press add | |
Then the result should be 120 on the screen |
This file contains hidden or 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
// ------------------------------------------------------------------------------ | |
// <auto-generated> | |
// This code was generated by SpecFlow (http://www.specflow.org/). | |
// SpecFlow Version:1.9.2.1 | |
// SpecFlow Generator Version:1.9.0.0 | |
// Runtime Version:4.0.30319.18052 | |
// | |
// Changes to this file may cause incorrect behavior and will be lost if | |
// the code is regenerated. | |
// </auto-generated> | |
// ------------------------------------------------------------------------------ | |
#region Designer generated code | |
#pragma warning disable | |
namespace ArduiNet.Tests.Features | |
{ | |
using TechTalk.SpecFlow; | |
[System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "1.9.2.1")] | |
[System.Runtime.CompilerServices.CompilerGeneratedAttribute()] | |
[NUnit.Framework.TestFixtureAttribute()] | |
[NUnit.Framework.DescriptionAttribute("test")] | |
public partial class TestFeature | |
{ | |
private static TechTalk.SpecFlow.ITestRunner testRunner; | |
#line 1 "test.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"), "test", "In order to avoid silly mistakes\r\nAs a math idiot\r\nI want to be told the sum of t" + | |
"wo numbers", ProgrammingLanguage.CSharp, ((string[])(null))); | |
testRunner.OnFeatureStart(featureInfo); | |
} | |
[NUnit.Framework.TestFixtureTearDownAttribute()] | |
public virtual void FeatureTearDown() | |
{ | |
testRunner.OnFeatureEnd(); | |
testRunner = null; | |
} | |
[NUnit.Framework.SetUpAttribute()] | |
public virtual void TestInitialize() | |
{ | |
} | |
[NUnit.Framework.TearDownAttribute()] | |
public virtual void ScenarioTearDown() | |
{ | |
testRunner.OnScenarioEnd(); | |
} | |
public virtual void ScenarioSetup(TechTalk.SpecFlow.ScenarioInfo scenarioInfo) | |
{ | |
testRunner.OnScenarioStart(scenarioInfo); | |
} | |
public virtual void ScenarioCleanup() | |
{ | |
testRunner.CollectScenarioErrors(); | |
} | |
[NUnit.Framework.TestAttribute()] | |
[NUnit.Framework.DescriptionAttribute("Add two numbers")] | |
[NUnit.Framework.CategoryAttribute("mytag")] | |
public virtual void AddTwoNumbers() | |
{ | |
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Add two numbers", new string[] { | |
"mytag"}); | |
#line 7 | |
this.ScenarioSetup(scenarioInfo); | |
#line 8 | |
testRunner.Given("I have entered 50 into the calculator", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given "); | |
#line 9 | |
testRunner.And("I have entered 70 into the calculator", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); | |
#line 10 | |
testRunner.When("I press add", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); | |
#line 11 | |
testRunner.Then("the result should be 120 on the screen", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); | |
#line hidden | |
this.ScenarioCleanup(); | |
} | |
} | |
} | |
#pragma warning restore | |
#endregion |
This file contains hidden or 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
<?xml version="1.0" encoding="utf-8" standalone="no"?> | |
<!--This file represents the results of running a test suite--> | |
<test-results name="C:\...\[my_project_name].Specs\bin\Debug\[my_project_name].Specs.dll" total="0" errors="0" failures="0" not-run="0" inconclusive="0" ignored="0" skipped="0" invalid="0"date="2013-08-14" time="19:28:59"> | |
<environment nunit-version="2.6.2.12296" clr-version="2.0.50727.5472" os-version="Microsoft Windows NT 6.1.7601 Service Pack 1" platform="Win32NT" cwd="C:\Program Files (x86)\NUnit 2.6.2\bin" machine-name="[my_user_name]" user="user" user-domain="[my_user_name]C" /> | |
<culture-info current-culture="fr-FR" current-uiculture="fr-FR" /> | |
<test-suite type="Assembly" name="C:\...\[my_project_name].Specs\bin\Debug\[my_project_name].Specs.dll" executed="True" result="Inconclusive" success="False" time="0.029" asserts="0" /> | |
</test-results> |
This file contains hidden or 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
using System; | |
using TechTalk.SpecFlow; | |
using NUnit.Framework; | |
namespace ArduiNet.Tests.Features | |
{ | |
[Binding] | |
public class TestSteps | |
{ | |
[Given(@"I have entered (.*) into the calculator")] | |
public void GivenIHaveEnteredIntoTheCalculator(int p0) | |
{ | |
} | |
[When(@"I press add")] | |
public void WhenIPressAdd() | |
{ | |
} | |
[Then(@"the result should be (.*) on the screen")] | |
public void ThenTheResultShouldBeOnTheScreen(int p0) | |
{ | |
Assert.IsTrue(true); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment