Skip to content

Commit 308f6b2

Browse files
authored
Merge pull request #179 from Nfactor26/test-execution-details-on-pixel-run-console
Test execution progress and results on console
2 parents 6b9b05c + 31c029e commit 308f6b2

File tree

3 files changed

+19
-6
lines changed

3 files changed

+19
-6
lines changed

src/Pixel.Automation.Test.Runner/Commands/ExecuteAdhocTestCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public override async Task<int> ExecuteAsync(CommandContext context, AdhocTestSe
7979
}
8080
else
8181
{
82-
await projectManager.RunAllAsync(sessionTemplate.Selector);
82+
await projectManager.RunAllAsync(sessionTemplate.Selector, console);
8383
}
8484
return 0;
8585
}

src/Pixel.Automation.Test.Runner/Commands/ExecuteTestFromTemplateCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public override async Task<int> ExecuteAsync(CommandContext context, ExecuteTest
5353
}
5454
else
5555
{
56-
await projectManager.RunAllAsync(sessionTemplate.Selector);
56+
await projectManager.RunAllAsync(sessionTemplate.Selector, console);
5757
}
5858
return 0;
5959
}

src/Pixel.Automation.Test.Runner/ProjectManager.cs

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ public async Task ListAllAsync(string selector, IAnsiConsole console)
276276
}
277277
}
278278

279-
public async Task RunAllAsync(string selector)
279+
public async Task RunAllAsync(string selector, IAnsiConsole console)
280280
{
281281
TestSession testSession = new TestSession(this.sessionTemplate, this.targetVersion.Version.ToString());
282282
List<Persistence.Core.Models.TestResult> testResults = new List<Persistence.Core.Models.TestResult>();
@@ -288,13 +288,16 @@ public async Task RunAllAsync(string selector)
288288
await this.testSelector.Initialize(selector);
289289
await this.testRunner.SetUpEnvironment();
290290

291+
console.MarkupLine($"[blue]{this.automationProject.Name} - {this.targetVersion}[/]");
291292
foreach (var testFixture in this.availableFixtures)
292293
{
293-
if(testFixture.IsMuted)
294-
{
294+
console.MarkupLine($" - [cyan3]{testFixture.DisplayName}[/]");
295+
296+
if (testFixture.IsMuted)
297+
{
295298
continue;
296299
}
297-
300+
298301
var fixtureFiles = this.projectFileSystem.GetTestFixtureFiles(testFixture);
299302
testFixture.TestFixtureEntity = this.Load<Entity>(fixtureFiles.ProcessFile);
300303
testFixture.TestFixtureEntity.Name = testFixture.DisplayName;
@@ -304,6 +307,7 @@ public async Task RunAllAsync(string selector)
304307
{
305308
if (!testSelector.CanRunTest(testFixture, testCase))
306309
{
310+
console.MarkupLine($" - [yellow]{testCase.DisplayName}[/]");
307311
continue;
308312
}
309313

@@ -313,6 +317,15 @@ public async Task RunAllAsync(string selector)
313317
testResult.ExecutionOrder = ++counter;
314318
await sessionClient.AddResultAsync(testResult);
315319
testResults.Add(testResult);
320+
if(testResult.Result == Persistence.Core.Enums.TestStatus.Success)
321+
{
322+
console.MarkupLine($" - [green]{testCase.DisplayName}[/]");
323+
}
324+
else
325+
{
326+
console.MarkupLine($" - [red]{testCase.DisplayName}[/]");
327+
console.MarkupLine($" [red]{testResult.FailureDetails.Exception} - {testResult.FailureDetails.Message}[/]");
328+
}
316329
}
317330

318331
}

0 commit comments

Comments
 (0)