Permalink
Browse files

Upgraded to new VS11 beta

  • Loading branch information...
poobah committed Mar 7, 2012
1 parent f72a28f commit c87ef7654155ffe5f994c3f92fa3918d08a813ad
@@ -1,6 +1,7 @@
using System.Collections.Generic;
using Gallio.Loader;
using Microsoft.VisualStudio.TestPlatform.ObjectModel;
+using Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter;
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging;
namespace TestPlatform.Gallio
@@ -22,6 +23,7 @@ public class GallioAdapter : ITestDiscoverer, ITestExecutor
public GallioAdapter()
{
+
LoaderManager.InitializeAndSetupRuntimeIfNeeded();
testIdProperty = TestProperty.Register("Gallio.TestId", "Test id", typeof(string), typeof(TestCase));
@@ -34,26 +36,27 @@ public GallioAdapter()
testRunner = new TestRunner(cachingTestCaseFactory, testResultFactory, testIdProperty);
}
- public void DiscoverTests(IEnumerable<string> sources, IMessageLogger logger, ITestCaseDiscoverySink discoverySink)
+
+ public void RunTests(IEnumerable<TestCase> tests, IRunContext runContext, IFrameworkHandle frameworkHandle)
{
- testExplorer.DiscoverTests(sources, logger, discoverySink);
+ cachingTestCaseFactory.AddTestCases(tests);
+ testRunner.RunTests(tests, runContext, frameworkHandle);
}
- public void Cancel()
+ public void RunTests(IEnumerable<string> sources, IRunContext runContext, IFrameworkHandle frameworkHandle)
{
- testRunner.Cancel();
+ testCaseFactory.AddSources(sources);
+ testRunner.RunTests(sources, runContext, frameworkHandle);
}
- public void RunTests(IEnumerable<string> sources, IRunContext runContext, ITestExecutionRecorder testExecutionRecorder)
+ public void Cancel()
{
- testCaseFactory.AddSources(sources);
- testRunner.RunTests(sources, runContext, testExecutionRecorder);
+ testRunner.Cancel();
}
- public void RunTests(IEnumerable<TestCase> tests, IRunContext runContext, ITestExecutionRecorder testExecutionRecorder)
+ public void DiscoverTests(IEnumerable<string> sources, IDiscoveryContext discoveryContext, IMessageLogger logger, ITestCaseDiscoverySink discoverySink)
{
- cachingTestCaseFactory.AddTestCases(tests);
- testRunner.RunTests(tests, runContext, testExecutionRecorder);
+ testExplorer.DiscoverTests(sources, logger, discoverySink);
}
}
}
@@ -37,11 +37,9 @@
<Reference Include="Gallio">
<HintPath>C:\Program Files\Gallio\bin\Gallio.dll</HintPath>
</Reference>
- <Reference Include="Microsoft.VisualStudio.TestPlatform.Core">
- <HintPath>C:\Program Files\Microsoft Visual Studio 11.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\Microsoft.VisualStudio.TestPlatform.Core.dll</HintPath>
- </Reference>
- <Reference Include="Microsoft.VisualStudio.TestPlatform.ObjectModel">
- <HintPath>C:\Program Files\Microsoft Visual Studio 11.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\Microsoft.VisualStudio.TestPlatform.ObjectModel.dll</HintPath>
+ <Reference Include="Microsoft.VisualStudio.TestPlatform.ObjectModel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\Libs\Microsoft.VisualStudio.TestPlatform.ObjectModel.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
@@ -19,12 +19,11 @@ public TestCaseFactory(TestProperty testIdProperty)
public TestCase GetTestCase(TestData testData)
{
- var testCase = new TestCase(testData.FullName, new Uri(GallioAdapter.ExecutorUri))
+ var testCase = new TestCase(testData.FullName, new Uri(GallioAdapter.ExecutorUri), GetSource(testData))
{
CodeFilePath = testData.CodeLocation.Path,
LineNumber = testData.CodeLocation.Line,
- DisplayName = testData.CodeReference.MemberName,
- Source = GetSource(testData),
+ DisplayName = testData.CodeReference.MemberName
};
testCase.SetPropertyValue(testIdProperty, testData.Id);
@@ -10,7 +10,7 @@
using Gallio.Runtime;
using Gallio.Runtime.Logging;
using Gallio.Runtime.ProgressMonitoring;
-using Microsoft.VisualStudio.TestPlatform.ObjectModel;
+using Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter;
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging;
namespace TestPlatform.Gallio
@@ -16,7 +16,6 @@ public TestResult BuildTestResult(TestData testData, TestStepRun testStepRun, Te
var testResult = new TestResult(testCase)
{
DisplayName = testData.Name,
- ErrorLineNumber = testData.CodeLocation.Line,
StartTime = testStepRun.StartTime,
EndTime = testStepRun.EndTime,
Duration = testStepRun.Result.Duration,
@@ -3,6 +3,7 @@
using Gallio.Model.Filters;
using Gallio.Runner;
using Microsoft.VisualStudio.TestPlatform.ObjectModel;
+using Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter;
namespace TestPlatform.Gallio
{
@@ -25,7 +26,7 @@ public void Cancel()
launcher.Cancel();
}
- public void RunTests(IEnumerable<string> sources, IRunContext runContext, ITestExecutionRecorder testExecutionRecorder)
+ public void RunTests(IEnumerable<string> sources, IRunContext runContext, IFrameworkHandle testExecutionRecorder)
{
launcher = new TestLauncher();
@@ -37,7 +38,7 @@ public void RunTests(IEnumerable<string> sources, IRunContext runContext, ITestE
RunTests(runContext, testExecutionRecorder);
}
- private void RunTests(IRunContext runContext, ITestExecutionRecorder testExecutionRecorder)
+ private void RunTests(IRunContext runContext, IFrameworkHandle testExecutionRecorder)
{
if (runContext.InIsolation)
launcher.TestProject.TestRunnerFactoryName = StandardTestRunnerFactoryNames.IsolatedAppDomain;
@@ -48,7 +49,7 @@ private void RunTests(IRunContext runContext, ITestExecutionRecorder testExecuti
launcher.Run();
}
- public void RunTests(IEnumerable<TestCase> tests, IRunContext runContext, ITestExecutionRecorder testExecutionRecorder)
+ public void RunTests(IEnumerable<TestCase> tests, IRunContext runContext, IFrameworkHandle testExecutionRecorder)
{
launcher = new TestLauncher();
@@ -1,11 +1,12 @@
using Gallio.Runner.Events;
using Gallio.Runner.Extensions;
using Microsoft.VisualStudio.TestPlatform.ObjectModel;
+using Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter;
-namespace TestPlatform.Gallio
-{
- internal class VSTestWindowExtension : TestRunnerExtension
- {
+namespace TestPlatform.Gallio
+{
+ internal class VSTestWindowExtension : TestRunnerExtension
+ {
private readonly ITestExecutionRecorder executionRecorder;
private readonly ITestCaseFactory testCaseFactory;
private readonly ITestResultFactory testResultFactory;
@@ -18,38 +19,38 @@ public VSTestWindowExtension(ITestExecutionRecorder executionRecorder, ITestCase
}
private void LogTestCaseFinished(TestStepFinishedEventArgs e)
- {
- var testCase = testCaseFactory.GetTestCase(e.Test);
-
- var testResult = testResultFactory.BuildTestResult(e.Test, e.TestStepRun, testCase);
-
+ {
+ var testCase = testCaseFactory.GetTestCase(e.Test);
+
+ var testResult = testResultFactory.BuildTestResult(e.Test, e.TestStepRun, testCase);
+
executionRecorder.RecordEnd(testCase, testResult.Outcome);
- executionRecorder.RecordResult(testResult);
- }
-
- private void LogTestCaseStarted(TestStepStartedEventArgs e)
- {
- var testCase = testCaseFactory.GetTestCase(e.Test);
- executionRecorder.RecordStart(testCase);
+ executionRecorder.RecordResult(testResult);
+ }
+
+ private void LogTestCaseStarted(TestStepStartedEventArgs e)
+ {
+ var testCase = testCaseFactory.GetTestCase(e.Test);
+ executionRecorder.RecordStart(testCase);
}
- protected override void Initialize()
- {
- Events.TestStepStarted += delegate(object sender, TestStepStartedEventArgs e)
- {
- if (e.TestStepRun.Step.IsTestCase)
- {
- LogTestCaseStarted(e);
- }
- };
-
- Events.TestStepFinished += delegate(object sender, TestStepFinishedEventArgs e)
- {
- if (e.TestStepRun.Step.IsTestCase)
- {
- LogTestCaseFinished(e);
- }
- };
- }
- }
-}
+ protected override void Initialize()
+ {
+ Events.TestStepStarted += delegate(object sender, TestStepStartedEventArgs e)
+ {
+ if (e.TestStepRun.Step.IsTestCase)
+ {
+ LogTestCaseStarted(e);
+ }
+ };
+
+ Events.TestStepFinished += delegate(object sender, TestStepFinishedEventArgs e)
+ {
+ if (e.TestStepRun.Step.IsTestCase)
+ {
+ LogTestCaseFinished(e);
+ }
+ };
+ }
+ }
+}

0 comments on commit c87ef76

Please sign in to comment.