-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix missing output attachments in NUnit adapter
- Loading branch information
Showing
2 changed files
with
42 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using System; | ||
using System.IO; | ||
using System.Linq; | ||
using Allure.Net.Commons; | ||
using NUnit.Allure.Attributes; | ||
using NUnit.Framework; | ||
|
||
namespace Allure.NUnit.Examples | ||
{ | ||
[AllureSuite("Tests - Output")] | ||
public class OutputTest : BaseTest | ||
{ | ||
private const string text = "This should go to console output attachment"; | ||
|
||
[Test] | ||
[Order(1)] | ||
public void WriteOutputTest() | ||
{ | ||
Console.WriteLine(text); | ||
} | ||
|
||
[Test] | ||
[Order(2)] | ||
public void OutputLogShouldExist() | ||
{ | ||
var resultsDir = AllureLifecycle.Instance.ResultsDirectory; | ||
var attachmentFiles = Directory.EnumerateFiles(resultsDir, "*.txt"); | ||
|
||
Assert.That(attachmentFiles.Any(file => File.ReadAllText(file).Contains(text))); | ||
} | ||
} | ||
} | ||
|
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