-
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a test to check the issue in #514
- Loading branch information
Cédric L. Charlier
committed
Sep 7, 2019
1 parent
0b7d641
commit 3e37143
Showing
6 changed files
with
151 additions
and
4 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,3 @@ | ||
fileSut;fileAssert | ||
..\csv\001.csv;..\txt\001.txt | ||
..\csv\002.csv;..\txt\002.txt |
42 changes: 42 additions & 0 deletions
42
NBi.Testing/Acceptance/GenbiL/Resources/ResultSetFile.expected.nbits
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,42 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<testSuite xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://NBi/TestSuite"> | ||
<settings /> | ||
<test name="Compare '..\csv\001.csv' to '..\txt\001.txt'"> | ||
<system-under-test> | ||
<result-set> | ||
<file> | ||
<path>..\csv\001.csv</path> | ||
</file> | ||
</result-set> | ||
</system-under-test> | ||
<assert> | ||
<equal-to> | ||
<result-set> | ||
<file> | ||
<path>..\txt\001.txt</path> | ||
<parser name="myTextParser" /> | ||
</file> | ||
</result-set> | ||
</equal-to> | ||
</assert> | ||
</test> | ||
<test name="Compare '..\csv\002.csv' to '..\txt\002.txt'"> | ||
<system-under-test> | ||
<result-set> | ||
<file> | ||
<path>..\csv\002.csv</path> | ||
</file> | ||
</result-set> | ||
</system-under-test> | ||
<assert> | ||
<equal-to> | ||
<result-set> | ||
<file> | ||
<path>..\txt\002.txt</path> | ||
<parser name="myTextParser" /> | ||
</file> | ||
</result-set> | ||
</equal-to> | ||
</assert> | ||
</test> | ||
</testSuite> |
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,6 @@ | ||
case load file 'Acceptance\GenbiL\Resources\ResultSetFile.csv'; | ||
|
||
template load file 'Acceptance\GenbiL\Resources\ResultSetFile.nbitt'; | ||
suite generate; | ||
suite save as 'Acceptance\GenbiL\Resources\ResultSetFile.nbits'; | ||
|
10 changes: 10 additions & 0 deletions
10
NBi.Testing/Acceptance/GenbiL/Resources/ResultSetFile.nbitt
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,10 @@ | ||
<test name="Compare '$fileSut$' to '$fileAssert$'"> | ||
<system-under-test> | ||
<result-set file="$fileSut$" /> | ||
</system-under-test> | ||
<assert> | ||
<equal-to> | ||
<result-set file="$fileAssert$!myTextParse" /> | ||
</equal-to> | ||
</assert> | ||
</test> |
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,73 @@ | ||
using System; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Text.RegularExpressions; | ||
using NBi.GenbiL; | ||
using NUnit.Framework; | ||
|
||
namespace NBi.Testing.Acceptance.GenbiL | ||
{ | ||
[TestFixture] | ||
public class ResultSetFileTest | ||
{ | ||
private const string TEST_SUITE_NAME="ResultSetFile"; | ||
private string DefinitionFilename { get => $"Acceptance\\GenbiL\\Resources\\{TEST_SUITE_NAME}.genbil"; } | ||
private string TargetFilename { get => $"Acceptance\\GenbiL\\Resources\\{TEST_SUITE_NAME}.nbits"; } | ||
private string ExpectedFilename { get => $"Acceptance\\GenbiL\\Resources\\{TEST_SUITE_NAME}.expected.nbits"; } | ||
|
||
#region SetUp & TearDown | ||
//Called only at instance creation | ||
[TestFixtureSetUp] | ||
public void SetupMethods() | ||
{ | ||
|
||
} | ||
|
||
//Called only at instance destruction | ||
[TestFixtureTearDown] | ||
public void TearDownMethods() | ||
{ | ||
|
||
} | ||
|
||
//Called before each test | ||
[SetUp] | ||
public void SetupTest() | ||
{ | ||
if (File.Exists(TargetFilename)) | ||
File.Delete(TargetFilename); | ||
} | ||
|
||
//Called after each test | ||
[TearDown] | ||
public void TearDownTest() | ||
{ | ||
//if (File.Exists(TargetFilename)) | ||
// File.Delete(TargetFilename); | ||
} | ||
#endregion | ||
|
||
[Test] | ||
public void Execute_Group_FileGenerated() | ||
{ | ||
var generator = new TestSuiteGenerator(); | ||
generator.Load(DefinitionFilename); | ||
generator.Execute(); | ||
|
||
Assert.That(File.Exists(TargetFilename)); | ||
} | ||
|
||
[Test] | ||
public void Execute_Group_ExpectedContent() | ||
{ | ||
var generator = new TestSuiteGenerator(); | ||
generator.Load(DefinitionFilename); | ||
generator.Execute(); | ||
|
||
var expected = File.ReadAllText(ExpectedFilename); | ||
var actual = File.ReadAllText(TargetFilename); | ||
actual = Regex.Replace(actual, @"(\s*)<edition(.*)/>", "", RegexOptions.Multiline); | ||
Assert.That(actual, Is.EqualTo(expected)); | ||
} | ||
} | ||
} |
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