Skip to content

Commit

Permalink
Added a property on ITestContext to pass the retry attempt count
Browse files Browse the repository at this point in the history
  • Loading branch information
mtscout6 committed Apr 30, 2013
1 parent ed4130b commit 6b97b8d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/StoryTeller.Testing/Engine/AutoPerformingTestContext.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using FubuCore;
using FubuCore.Conversion;
using FubuCore.Formatting;
using FubuCore.Util;
Expand All @@ -18,6 +17,11 @@ public IEnumerable<Type> StartupActionTypes
get { throw new NotImplementedException(); }
}

public int AttemptNumber
{
get { throw new NotImplementedException(); }
}

public object CurrentObject { get; set; }

public bool Matches(object expected, object actual)
Expand Down
1 change: 1 addition & 0 deletions src/StoryTeller/Domain/Test.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public Lifecycle Lifecycle
public string SuiteName { get; set; }
public Suite Parent { get; private set; }
public int NumberOfRetries { get; set; }
public int AtemptNumber { get; set; }
public void SetParent(Suite parent)
{
Parent = parent;
Expand Down
3 changes: 3 additions & 0 deletions src/StoryTeller/Engine/TestContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public interface IExceptionTarget
public interface ITestContext
{
IEnumerable<Type> StartupActionTypes { get; }
int AttemptNumber { get; }

object CurrentObject { get; set; }
IObjectConverter Finder { get; }
Expand Down Expand Up @@ -359,6 +360,8 @@ public IEnumerable<Type> StartupActionTypes
get { return StartupActionNames.Select(x => GetStartupType(x)); }
}

public int AttemptNumber { get { return Test.AtemptNumber; } }

public object CurrentObject { get; set; }

public void RunStep(IGrammar grammar, IStep step)
Expand Down
1 change: 1 addition & 0 deletions src/StoryTeller/Execution/ProjectTestRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ public void RunAll(Func<Hierarchy, IEnumerable<Test>> selectionFilter, Action<Te
{
Console.WriteLine("$$$$$$$$$$$$$$$$Previous pass failed -- retrying: {0}".ToFormat(t.GetStatus()));
}
t.AtemptNumber = numberOfRetries;
_engine.RunTest(t);
numberOfRetries++;
}
Expand Down

0 comments on commit 6b97b8d

Please sign in to comment.