diff --git a/src/AxaFrance.WebEngine.Doc/articles/webrunner.md b/src/AxaFrance.WebEngine.Doc/articles/webrunner.md index edd5219..05f0cef 100644 --- a/src/AxaFrance.WebEngine.Doc/articles/webrunner.md +++ b/src/AxaFrance.WebEngine.Doc/articles/webrunner.md @@ -68,40 +68,46 @@ WebRunner.exe "-a:AppProject.dll" "-data:Data.xml" "-env:Staging.xml" -platform: > Some parameters can be provided in the configuration file `appsettings.json` for C# and `application-properties.yml` for JAVA. please refer to [Test Configuration](appsettings.md) ### Commun parameters -##### -browser:\ +#### -browser:\ Specifies the browser on which to run test. see: . -##### -platform:\ +#### -platform:\ Specifies The platform for test execution: see: . Default value is `Windows`. -##### -outputDir:\ +#### -outputDir:\ Specifies the folder to store output of test execution and test report. This parameter is can be defined in `appsetting.json` for C# and `application-properties.yml` for JAVA. -##### -m + +#### -m Specifies the manual debug mode. Use this mode for debugging test scenarios locally. When the test is failed test will pause for manual intervention before clean-up process. -##### -junit:\ + +#### -junit:\ In additional of default XML report, generates a JUnit 2.6 compliant test report. Useful to publish test result to a Continuous Integration Platform -##### -showReport + +#### -html:\ +In additional of default XML report, generates a HTML test report. Test report will be generated in the given folder. HTML report contains also css, javascript and screenshot files. If you want the share the report, you have to copy the whole folder. + +#### -showReport Launches `Report Viewer` after test execution. ### Parameters for Mobile testing To run tests on Mobile device, `-platform`, you should specify the following arguments `Android` or `iOS`. -##### -grid:\ +#### -grid:\ Indicates the Selenium Grid to connect to device cloud. Default value is `http://localhost:4723/wd/hub` for local Appium Server If you are using cloud-based device cloud, please refer to service providers documentation. If the argument is provided, option `desktopGrid` will be automatically set to `true` -##### -desktopGrid +#### -desktopGrid This option activates the usage of Selenium Grid for Web Desktop tests. If the value is false, the framework only use selenium grid for mobile based tests. -##### -username:\ +#### -username:\ Indicates the username to be used for Selenium Grid authentication. -##### -password:\ +#### -password:\ Indicates the password to be used for Selenium Grid authentication. -##### -device:\ +#### -device:\ Indicates the device name for device selection. for example: `iPhone Xs`, `Huawei P30`. Refers your cloud provider. -##### -osVersion:\ +#### -osVersion:\ Indicate the version of the OS for device selection. for example: `14.1`, `9.0`. Refers your cloud provider. ### Where to find WebRunner package? diff --git a/src/AxaFrance.WebEngine.Runner/ParameterParser.cs b/src/AxaFrance.WebEngine.Runner/ParameterParser.cs index 919ea90..dfdaaae 100644 --- a/src/AxaFrance.WebEngine.Runner/ParameterParser.cs +++ b/src/AxaFrance.WebEngine.Runner/ParameterParser.cs @@ -74,6 +74,16 @@ private static void ParseReportOption(string[] args, Settings s) DebugLogger.WriteLine("[CONFIG] Generated JUnit Report: " + s.ReportSettings.JUnitReportPath); } + const string argHtml = "-html:"; + string html = args.FirstOrDefault(x => x.StartsWith(argHtml, StringComparison.OrdinalIgnoreCase)); + if (!string.IsNullOrEmpty(html)) + { + string outputPath = html.Replace(arg, string.Empty); + outputPath = outputPath.TrimEnd('\"'); + s.ReportSettings.HtmlReport = true; + s.ReportSettings.HtmlReportPath = outputPath; + DebugLogger.WriteLine("[CONFIG] Generated HTML Report: " + s.ReportSettings.HtmlReportPath); + } } diff --git a/src/AxaFrance.WebEngine.Runner/Program.cs b/src/AxaFrance.WebEngine.Runner/Program.cs index 8c15f32..9f5fee8 100644 --- a/src/AxaFrance.WebEngine.Runner/Program.cs +++ b/src/AxaFrance.WebEngine.Runner/Program.cs @@ -43,6 +43,12 @@ public static void Main(string[] args) DebugLogger.WriteLine("JUnit Report Generated: " + jReport); } + if (settings.ReportSettings.HtmlReport) + { + var htmlReport = ReportHelper.GenerateHtmlReport(result, settings.DataSourceName, settings.ReportSettings.HtmlReportPath); + DebugLogger.WriteLine("HTML Report Generated: " + htmlReport); + } + var reportPath = result.SaveAs(settings.LogDir, logFileName, false); DebugLogger.WriteLine("Report Generated: " + reportPath); try @@ -68,7 +74,7 @@ public static void Main(string[] args) private static void ShowHelpMessage() { Console.WriteLine("Parameter error."); - Console.WriteLine("Please refers to documentation: https://xxx.xxx.xxx/articles/webrunner.html"); + Console.WriteLine("Please refers to documentation: https://axafrance.github.io/webengine-dotnet/articles/webrunner.html"); } private static void Encrypt(string data) diff --git a/src/AxaFrance.WebEngine/ReportSettings.cs b/src/AxaFrance.WebEngine/ReportSettings.cs index 4e4cd33..0a88cdb 100644 --- a/src/AxaFrance.WebEngine/ReportSettings.cs +++ b/src/AxaFrance.WebEngine/ReportSettings.cs @@ -32,6 +32,16 @@ public class ReportSettings /// The location of the NUnit report. (default location will be ) /// public string NUnitReportPath { get; set; } + + /// + /// Indicates if a HTML report should be generated after test execution + /// + public bool HtmlReport { get; set; } + + /// + /// The location of the HTML report. (default location will be ) + /// + public string HtmlReportPath { get; set; } } }