From 2b38d85943db974fb53b9a1f2a5ba4bb1b56c718 Mon Sep 17 00:00:00 2001
From: Anton Bagliy <taccessviolation@gmail.com>
Date: Thu, 29 Aug 2019 18:05:47 +0300
Subject: [PATCH] FIX: running NUnit report analyzer with path from travis env.
 var #55

---
 .travis.yml                  | 16 ++++++++--------
 NunitReportParser/Program.cs | 12 +++++++++++-
 2 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index e08e6c4..1a2ca80 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -10,18 +10,18 @@ install:
 script:
   - msbuild /p:TargetFrameworkVersion="v4.0"
   - nunit-console -labels TestSimpleLexer/bin/Debug/TestSimpleLexer.dll
-  - mono NunitReportParser/bin/Debug/NunitReportParser.exe
+  - mono NunitReportParser/bin/Debug/NunitReportParser.exe ${TRAVIS_BUILD_DIR}
   - nunit-console -labels TestLexer/bin/Debug/TestLexer.dll
-  - mono NunitReportParser/bin/Debug/NunitReportParser.exe
+  - mono NunitReportParser/bin/Debug/NunitReportParser.exe ${TRAVIS_BUILD_DIR}
   - nunit-console -labels TestGeneratedLexer/bin/Debug/TestGeneratedLexer.dll
-  - mono NunitReportParser/bin/Debug/NunitReportParser.exe
+  - mono NunitReportParser/bin/Debug/NunitReportParser.exe ${TRAVIS_BUILD_DIR}
   - nunit-console -labels TestDescentParser/bin/Debug/TestDescentParser.dll
-  - mono NunitReportParser/bin/Debug/NunitReportParser.exe
+  - mono NunitReportParser/bin/Debug/NunitReportParser.exe ${TRAVIS_BUILD_DIR}
   - nunit-console -labels TestGeneratedParser/bin/Debug/TestGeneratedParser.dll
-  - mono NunitReportParser/bin/Debug/NunitReportParser.exe
+  - mono NunitReportParser/bin/Debug/NunitReportParser.exe ${TRAVIS_BUILD_DIR}
   - nunit-console -labels TestASTParser/bin/Debug/TestASTParser.dll
-  - mono NunitReportParser/bin/Debug/NunitReportParser.exe
+  - mono NunitReportParser/bin/Debug/NunitReportParser.exe ${TRAVIS_BUILD_DIR}
   - nunit-console -labels TestVisitors/bin/Debug/TestVisitors.dll
-  - mono NunitReportParser/bin/Debug/NunitReportParser.exe
+  - mono NunitReportParser/bin/Debug/NunitReportParser.exe ${TRAVIS_BUILD_DIR}
   - nunit-console -labels TestCodeGenerator/bin/Debug/TestCodeGenerator.dll
-  - mono NunitReportParser/bin/Debug/NunitReportParser.exe
+  - mono NunitReportParser/bin/Debug/NunitReportParser.exe ${TRAVIS_BUILD_DIR}
diff --git a/NunitReportParser/Program.cs b/NunitReportParser/Program.cs
index 23aef4c..63870c5 100644
--- a/NunitReportParser/Program.cs
+++ b/NunitReportParser/Program.cs
@@ -73,8 +73,18 @@ namespace NunitReport
         
         static void Main(string[] args)
         {
+            string basePath = "";
             XmlDocument doc = new XmlDocument();
-            doc.Load(@"../../../TestResult.xml");
+            if(args.Length > 0) {
+                basePath = args[0];
+                doc.Load(basePath+@"/TestResult.xml");
+            }
+            else
+            {
+                doc.Load(@"../../../TestResult.xml");
+            }
+            
+            
 
             // XmlNodeList nodes = doc.DocumentElement.SelectNodes("test-run/test-suite"); 
             XmlNodeList nodes = doc.DocumentElement.ChildNodes;
-- 
GitLab