Added basic Specflow tests for Lists.

--HG--
branch : dev
This commit is contained in:
Dave Reed
2011-03-17 18:17:44 -07:00
parent a1925e9644
commit c048ab2aeb
4 changed files with 192 additions and 1 deletions

View File

@@ -0,0 +1,37 @@
Feature: Lists
In order to add new lists to my site
As an administrator
I want to create lists
Scenario: I can create a new list
Given I have installed Orchard
When I go to "Admin/Contents/Create/List"
And I fill in
| name | value |
| Routable.Title | MyList |
And I hit "Save"
And I go to "Admin/Contents/List/List"
Then I should see "MyList"
Scenario: I can add content items to a list
Given I have installed Orchard
And I have a containable content type "MyType"
When I go to "Admin/Contents/Create/List"
And I fill in
| name | value |
| Routable.Title | MyList |
And I hit "Save"
And I go to "Admin/Contents/List/List"
Then I should see "MyList"
When I follow "Contained Items"
Then I should see "The 'MyList' List has no content items."
When I follow "Create New Content" where href has ReturnUrl
Then I should see "MyType"
When I follow "MyType" where href has ReturnUrl
And I fill in
| name | value |
| Routable.Title | MyContentItem |
And I hit "Save"
And I am redirected
Then I should see "Manage Content for MyList"
And I should see "MyContentItem"

145
src/Orchard.Specs/Lists.feature.cs generated Normal file
View File

@@ -0,0 +1,145 @@
// ------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by SpecFlow (http://www.specflow.org/).
// SpecFlow Version:1.4.0.0
// Runtime Version:4.0.30319.1
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
// ------------------------------------------------------------------------------
#region Designer generated code
namespace Orchard.Specs
{
using TechTalk.SpecFlow;
[System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "1.4.0.0")]
[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[NUnit.Framework.TestFixtureAttribute()]
[NUnit.Framework.DescriptionAttribute("Lists")]
public partial class ListsFeature
{
private static TechTalk.SpecFlow.ITestRunner testRunner;
#line 1 "Lists.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"), "Lists", "In order to add new lists to my site\nAs an administrator\nI want to create lists", GenerationTargetLanguage.CSharp, ((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("I can create a new list")]
public virtual void ICanCreateANewList()
{
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("I can create a new list", ((string[])(null)));
#line 6
this.ScenarioSetup(scenarioInfo);
#line 7
testRunner.Given("I have installed Orchard");
#line 8
testRunner.When("I go to \"Admin/Contents/Create/List\"");
#line hidden
TechTalk.SpecFlow.Table table1 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table1.AddRow(new string[] {
"Routable.Title",
"MyList"});
#line 9
testRunner.And("I fill in", ((string)(null)), table1);
#line 12
testRunner.And("I hit \"Save\"");
#line 13
testRunner.And("I go to \"Admin/Contents/List/List\"");
#line 14
testRunner.Then("I should see \"MyList\"");
#line hidden
testRunner.CollectScenarioErrors();
}
[NUnit.Framework.TestAttribute()]
[NUnit.Framework.DescriptionAttribute("I can add content items to a list")]
public virtual void ICanAddContentItemsToAList()
{
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("I can add content items to a list", ((string[])(null)));
#line 16
this.ScenarioSetup(scenarioInfo);
#line 17
testRunner.Given("I have installed Orchard");
#line 18
testRunner.And("I have a containable content type \"MyType\"");
#line 19
testRunner.When("I go to \"Admin/Contents/Create/List\"");
#line hidden
TechTalk.SpecFlow.Table table2 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table2.AddRow(new string[] {
"Routable.Title",
"MyList"});
#line 20
testRunner.And("I fill in", ((string)(null)), table2);
#line 23
testRunner.And("I hit \"Save\"");
#line 24
testRunner.And("I go to \"Admin/Contents/List/List\"");
#line 25
testRunner.Then("I should see \"MyList\"");
#line 26
testRunner.When("I follow \"Contained Items\"");
#line 27
testRunner.Then("I should see \"The \'MyList\' List has no content items.\"");
#line 28
testRunner.When("I follow \"Create New Content\" where href has ReturnUrl");
#line 29
testRunner.Then("I should see \"MyType\"");
#line 30
testRunner.When("I follow \"MyType\" where href has ReturnUrl");
#line hidden
TechTalk.SpecFlow.Table table3 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table3.AddRow(new string[] {
"Routable.Title",
"MyContentItem"});
#line 31
testRunner.And("I fill in", ((string)(null)), table3);
#line 34
testRunner.And("I hit \"Save\"");
#line 35
testRunner.And("I am redirected");
#line 36
testRunner.Then("I should see \"Manage Content for MyList\"");
#line 37
testRunner.And("I should see \"MyContentItem\"");
#line hidden
testRunner.CollectScenarioErrors();
}
}
}
#endregion

View File

@@ -161,6 +161,11 @@
<Compile Include="Hosting\RequestExtensions.cs" />
<Compile Include="Hosting\RequestDetails.cs" />
<Compile Include="Hosting\Simple.Web\Global.asax.cs" />
<Compile Include="Lists.feature.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Lists.feature</DependentUpon>
</Compile>
<Compile Include="Media.feature.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
@@ -260,6 +265,10 @@
<Generator>SpecFlowSingleFileGenerator</Generator>
<LastGenOutput>ContentTypes.feature.cs</LastGenOutput>
</None>
<None Include="Lists.feature">
<Generator>SpecFlowSingleFileGenerator</Generator>
<LastGenOutput>Lists.feature.cs</LastGenOutput>
</None>
<None Include="PermissionModel.feature">
<Generator>SpecFlowSingleFileGenerator</Generator>
<LastGenOutput>PermissionModel.feature.cs</LastGenOutput>