-
Notifications
You must be signed in to change notification settings - Fork 323
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Co-authored-by: Jakub Jareš <me@jakubjares.com>
- Loading branch information
1 parent
e0cf151
commit c1ee51a
Showing
8 changed files
with
113 additions
and
21 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
14 changes: 14 additions & 0 deletions
14
test/TestAssets/NonDll.TestAdapter/NonDll.TestAdapter.csproj
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<!-- Imports Common TestAssets props. --> | ||
<Import Project="..\..\..\scripts\build\TestAssets.props" /> | ||
|
||
<PropertyGroup> | ||
<TargetFrameworks>netstandard2.0</TargetFrameworks> | ||
<LangVersion>latest</LangVersion> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\..\src\Microsoft.TestPlatform.ObjectModel\Microsoft.TestPlatform.ObjectModel.csproj" /> | ||
</ItemGroup> | ||
</Project> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
|
||
using Microsoft.VisualStudio.TestPlatform.ObjectModel; | ||
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter; | ||
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging; | ||
|
||
namespace NonDll.TestAdapter; | ||
[FileExtension(".js")] | ||
[DefaultExecutorUri(Uri)] | ||
[ExtensionUri(Uri)] | ||
public class TestAdapter : ITestExecutor, ITestDiscoverer | ||
{ | ||
public const string Uri = "executor://nondll.testadapter"; | ||
|
||
public void DiscoverTests(IEnumerable<string> sources, IDiscoveryContext discoveryContext, | ||
IMessageLogger logger, ITestCaseDiscoverySink discoverySink) | ||
{ | ||
var count = 1; | ||
foreach (var source in sources) | ||
{ | ||
TestCase testCase = new() | ||
{ | ||
Source = source, | ||
CodeFilePath = source, | ||
DisplayName = $"Test{count++}", | ||
ExecutorUri = new Uri(Uri), | ||
}; | ||
discoverySink.SendTestCase(testCase); | ||
} | ||
} | ||
|
||
public void Cancel() | ||
{ | ||
} | ||
|
||
public void RunTests(IEnumerable<TestCase> tests, IRunContext runContext, IFrameworkHandle frameworkHandle) | ||
{ | ||
foreach (var test in tests) | ||
{ | ||
TestResult testResult = new(test) | ||
{ | ||
Outcome = TestOutcome.Passed, | ||
}; | ||
frameworkHandle.RecordResult(testResult); | ||
} | ||
} | ||
|
||
public void RunTests(IEnumerable<string> sources, IRunContext runContext, IFrameworkHandle frameworkHandle) | ||
{ | ||
var count = 1; | ||
foreach (var source in sources) | ||
{ | ||
TestCase testCase = new() | ||
{ | ||
Source = source, | ||
CodeFilePath = source, | ||
DisplayName = $"Test{count++}", | ||
ExecutorUri = new Uri(Uri), | ||
}; | ||
TestResult testResult = new(testCase) | ||
{ | ||
Outcome = TestOutcome.Passed, | ||
}; | ||
frameworkHandle.RecordResult(testResult); | ||
} | ||
} | ||
} |
This file contains 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