Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Adding Filters to the IFrameworkRunner interface

  • Loading branch information...
commit 7666ee79da4ec0a60b03ec9768296791b54bafd6 1 parent 67a89a2
@codereflection authored
View
4 src/Giles.Core/AppDomains/GilesAppDomainRunner.cs
@@ -13,13 +13,13 @@ namespace Giles.Core.AppDomains
public class GilesAppDomainRunner : MarshalByRefObject
{
public IEnumerable<SessionResults> Run(string testAssemblyPath)
- {
+ {
var testAssembly = Assembly.LoadFrom(testAssemblyPath);
var testFrameworkRunner = new TestFrameworkResolver().Resolve(testAssembly).ToList();
var result = new List<SessionResults>();
- testFrameworkRunner.ForEach(x => result.Add(x.RunAssembly(testAssembly)));
+ testFrameworkRunner.ForEach(x => result.Add(x.RunAssembly(testAssembly, new[] { "Teh.Tests.TestTheClassThatDoesReturnsSomething" })));
return result;
}
}
View
2  src/Giles.Core/Runners/IFrameworkRunner.cs
@@ -5,7 +5,7 @@ namespace Giles.Core.Runners
{
public interface IFrameworkRunner
{
- SessionResults RunAssembly(Assembly assembly);
+ SessionResults RunAssembly(Assembly assembly, IEnumerable<string> filters);
/// <summary>
/// Returns a list of assemblies which the test runner implementation requires to run
View
13 src/Runners/Giles.Runner.Machine.Specifications/MSpecRunner.cs
@@ -9,13 +9,16 @@ namespace Giles.Runner.Machine.Specifications
{
public class MSpecRunner : IFrameworkRunner
{
+ IEnumerable<string> filters;
+
public IEnumerable<string> RequiredAssemblies()
{
return new[] { Assembly.GetAssembly(typeof(MSpecRunner)).Location, "ImpromptuInterface.dll" };
}
- public SessionResults RunAssembly(Assembly assembly)
+ public SessionResults RunAssembly(Assembly assembly, IEnumerable<string> filters)
{
+ this.filters = filters;
var mspecAssembly = LoadMSpec(assembly);
MSpecTypes.Types = mspecAssembly.GetExportedTypes();
@@ -26,7 +29,7 @@ public SessionResults RunAssembly(Assembly assembly)
return sessionResults;
}
- private static dynamic GetRunner(SessionResults sessionResults)
+ private dynamic GetRunner(SessionResults sessionResults)
{
dynamic dynamicRunListener = GetMSpecRunListener(sessionResults);
@@ -34,10 +37,12 @@ private static dynamic GetRunner(SessionResults sessionResults)
return Activator.CreateInstance(appDomainRunnerType, dynamicRunListener, GetRunOptions());
}
- static dynamic GetRunOptions()
+ dynamic GetRunOptions()
{
var runOptionsType = MSpecTypes.Types.First(x => x.Name == "RunOptions");
- return Activator.CreateInstance(runOptionsType, new string[] { }, new string[] { }, new string[] { });
+ var includeTags = new string[] { };
+ var excludeTags = new string[] { };
+ return Activator.CreateInstance(runOptionsType, includeTags, excludeTags, filters);
}
private static object GetMSpecRunListener(SessionResults sessionResults)
View
2  src/Runners/Giles.Runner.NUnit/NUnitRunner.cs
@@ -7,7 +7,7 @@ namespace Giles.Runner.NUnit
{
public class NUnitRunner : IFrameworkRunner
{
- public SessionResults RunAssembly(Assembly assembly)
+ public SessionResults RunAssembly(Assembly assembly, IEnumerable<string> filters)
{
var remoteTestRunner = new RemoteTestRunner(0);
var package = SetupTestPackager(assembly);
View
2  src/Runners/Giles.Runner.XUnit/XunitTestRunner.cs
@@ -6,7 +6,7 @@
namespace Giles.Runner.Xunit {
public class XunitTestRunner : IFrameworkRunner {
- public SessionResults RunAssembly(Assembly assembly) {
+ public SessionResults RunAssembly(Assembly assembly, IEnumerable<string> filters) {
var sessionResults = new SessionResults();
var logger = new GilesXunitLogger();
using (var exWrapper = new XunitFx.ExecutorWrapper(new Uri(assembly.CodeBase).LocalPath, null, false)) {
Please sign in to comment.
Something went wrong with that request. Please try again.