-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Petr Komissarov
committed
Mar 26, 2024
1 parent
0c9cd49
commit 6c556ac
Showing
39 changed files
with
1,009 additions
and
1,035 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
using Microsoft.Extensions.Logging; | ||
using TmsRunner.Client; | ||
using TmsRunner.Configuration; | ||
using TmsRunner.Models; | ||
using TmsRunner.Services; | ||
|
||
namespace TmsRunner; | ||
|
||
public class App(ILogger<App> logger, AdapterConfig adapterConfig, TmsSettings tmsSettings, ITmsClient tmsClient, FilterService filterService, Runner runner) | ||
{ | ||
public async Task<int> RunAsync() | ||
{ | ||
logger.LogInformation("Adapter works in {Mode} mode", tmsSettings.AdapterMode); | ||
logger.LogDebug("Parameters:"); | ||
logger.LogDebug("Runner Path: {Path}", adapterConfig.RunnerPath); | ||
logger.LogDebug("Test Assembly Path: {Path}", adapterConfig.TestAssemblyPath); | ||
logger.LogDebug("Test Adapter Path: {Path}", adapterConfig.TestAdapterPath); | ||
logger.LogDebug("Test Logger Path: {Path}", adapterConfig.LoggerPath); | ||
|
||
runner.InitialiseRunner(); | ||
var testCases = runner.DiscoverTests(); | ||
logger.LogInformation("Discovered Tests Count: {Count}", testCases.Count); | ||
|
||
if (testCases.Count == 0) | ||
{ | ||
logger.LogInformation("Can not found tests for run"); | ||
|
||
return 1; | ||
} | ||
|
||
switch (tmsSettings.AdapterMode) | ||
{ | ||
case 0: | ||
{ | ||
var testCaseForRun = await tmsClient.GetAutoTestsForRunAsync(tmsSettings.TestRunId).ConfigureAwait(false); | ||
testCases = filterService.FilterTestCases(adapterConfig.TestAssemblyPath, testCaseForRun, testCases); | ||
|
||
break; | ||
} | ||
case 2: | ||
{ | ||
tmsSettings.TestRunId = await tmsClient.CreateTestRunAsync().ConfigureAwait(false); | ||
|
||
if (!string.IsNullOrEmpty(adapterConfig.TmsLabelsOfTestsToRun)) | ||
{ | ||
testCases = filterService.FilterTestCasesByLabels(adapterConfig, testCases); | ||
} | ||
|
||
break; | ||
} | ||
} | ||
|
||
logger.LogInformation("Running tests: {Count}", testCases.Count); | ||
await runner.RunSelectedTestsAsync(testCases).ConfigureAwait(false); | ||
|
||
if (tmsSettings.AdapterMode == 2) | ||
{ | ||
logger.LogInformation("Test run {TestRunId} finished.", tmsSettings.TestRunId); | ||
} | ||
|
||
return 0; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.