Skip to content

Commit 1586eb5

Browse files
committed
Feature: make input type case insensitive, add comments, update readme
1 parent cc8861b commit 1586eb5

File tree

4 files changed

+16
-6
lines changed

4 files changed

+16
-6
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ liquid [options]
4646

4747
**--inputs [inputs]** Array of formatted configuration strings for test report inputs, with configurations separated by a semicolon
4848
- **File=file-name;** The path of the input file.
49+
- **Format=report-format;** Optional input report format, case insensitive, supported values are `Trx` of `JUnit`. Defaults to `Trx`.
4950
- **GroupTitle=group-title;** Optional title to group reports under, test runs with the same group title will be merged.
5051
- **TestPrefix=test-prefix;** Optional test suffix, if provided test origination for the provided report will have the suffix appended to its name.
5152

src/LiquidTestReports.Core/Mappers/JUnitMapper.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,17 @@
77

88
namespace LiquidTestReports.Core.Mappers
99
{
10+
/// <summary>
11+
/// Mapping for deserialised JUnit types to drop model types
12+
/// </summary>
1013
public static class JUnitMapper
1114
{
15+
/// <summary>
16+
/// Maps result types from JUnit into instance of drop models with configuration
17+
/// </summary>
18+
/// <param name="source">Instance of test results from deserialised JUnit input</param>
19+
/// <param name="destination">Instance to map and merge results into</param>
20+
/// <param name="inputConfiguration">User configured input for current source</param>
1221
public static void Map(Testsuites source, TestRunDrop destination, ReportInput inputConfiguration = null)
1322
{
1423
foreach (var testsuite in source.Testsuite)

src/LiquidTestReports.Core/Models/ReportInput.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public ReportInput(string inputString)
5454

5555
if (parameters.TryGetValue(nameof(Format), out var format))
5656
{
57-
Format = Enum.TryParse<InputFormatType>(format, out var formatType)
57+
Format = Enum.TryParse<InputFormatType>(format, true, out var formatType)
5858
? formatType
5959
: InputFormatType.Unknown;
6060
}

test/LiquidTestReports.Cli.Tests/ProgramTests.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,16 +98,16 @@ public void Main_WithTitle_GeneratesReport()
9898
public void Main_JUnitWithTitle_GeneratesReport()
9999
{
100100
//Arrange
101-
var title = "My JUnit + TRX Tests";
101+
var title = "My Full Stack Test Report (JUnit + TRX)";
102102
var titleTest = "junitTest.md";
103103
var destinationReport = new FileInfo(Path.Combine(_outputFolder, titleTest));
104104
var files = new List<ReportInput>();
105105

106-
foreach (var file in new DirectoryInfo(Path.Combine(Environment.CurrentDirectory, _inputJUnitDirectory)).GetFiles("*netcoreapp3.1-junit-sample.xml"))
107-
files.Add(new ReportInput($"File={file};Format=JUnit;TestSuffix= (JUnit)"));
106+
foreach (var file in new DirectoryInfo(Path.Combine(Environment.CurrentDirectory, _inputJUnitDirectory)).GetFiles("xUnit-netcoreapp3.1-junit-sample.xml"))
107+
files.Add(new ReportInput($"File={file};Format=JUnit;GroupTitle=JUnit Tests"));
108108

109-
foreach (var file in new DirectoryInfo(Path.Combine(Environment.CurrentDirectory, _inputTrxDirectory)).GetFiles("*netcoreapp3.1-sample.xml"))
110-
files.Add(new ReportInput($"File={file};Format=Trx;TestSuffix= (Trx)"));
109+
foreach (var file in new DirectoryInfo(Path.Combine(Environment.CurrentDirectory, _inputTrxDirectory)).GetFiles("xUnit-netcoreapp3.1-sample.trx"))
110+
files.Add(new ReportInput($"File={file};Format=Trx;GroupTitle=Trx Tests"));
111111

112112
// Act
113113
Program.Main(files.ToArray(), destinationReport, title);

0 commit comments

Comments
 (0)