Skip to content

Commit

Permalink
Multi Target Trx Issue : LogFilePrefix Parameter Added (#2140)
Browse files Browse the repository at this point in the history
* MultiTarget Trx Issue LogFilePrefix Parameter Added
  • Loading branch information
vagisha-nidhi authored Sep 11, 2019
1 parent fb76594 commit 32a75bd
Show file tree
Hide file tree
Showing 24 changed files with 283 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,23 @@ public static string GetTestResultsDirectory(RunConfiguration runConfiguration)
return resultsDirectory;
}

/// <summary>
/// Gets the target framework from the run configuration
/// </summary>
/// <param name="runConfiguration">Test run configuration</param>
/// <returns>Target Framework</returns>
public static Framework GetTargetFramework(RunConfiguration runConfiguration)
{
Framework targetFramework = null;
if (runConfiguration != null)
{
// It will get target framework from runsettings
targetFramework = runConfiguration.TargetFramework;
}

return targetFramework;
}

/// <summary>
/// Gets the solution directory from run configuration
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ internal class TestLoggerManager : ITestLoggerManager
/// </summary>
private string testRunDirectory;

/// <summary>
/// Target framework.
/// </summary>
private string targetFramework;

/// <summary>
/// Test Logger Events instance which will be passed to loggers when they are initialized.
/// </summary>
Expand Down Expand Up @@ -139,6 +144,7 @@ public void Initialize(string runSettings)

// Store test run directory. This runsettings is the final runsettings merging CLI args and runsettings.
this.testRunDirectory = GetResultsDirectory(runSettings);
this.targetFramework = GetTargetFramework(runSettings)?.Name;

var loggers = XmlRunSettingsUtilities.GetLoggerRunSettings(runSettings);

Expand Down Expand Up @@ -454,6 +460,33 @@ internal string GetResultsDirectory(string runSettings)
return resultsDirectory;
}

/// <summary>
/// Gets the target framework of the test run.
/// </summary>
/// <param name="runSettings">Test run settings.</param>
/// <returns>Target framework</returns>
internal Framework GetTargetFramework(string runSettings)
{
Framework targetFramework = null;
if (runSettings != null)
{
try
{
RunConfiguration runConfiguration = XmlRunSettingsUtilities.GetRunConfigurationNode(runSettings);
targetFramework = RunSettingsUtilities.GetTargetFramework(runConfiguration);
}
catch (SettingsException se)
{
if (EqtTrace.IsErrorEnabled)
{
EqtTrace.Error("TestLoggerManager.GetResultsDirectory: Unable to get the target framework: Error {0}", se);
}
}
}

return targetFramework;
}

/// <summary>
/// Enables sending of events to the loggers which are registered.
/// </summary>
Expand Down Expand Up @@ -582,9 +615,9 @@ private bool InitializeLogger(object logger, string extensionUri, Dictionary<str
}
catch (Exception ex)
{
var loggerUri = string.IsNullOrEmpty(extensionUri) ? logger.GetType().ToString() : extensionUri;
EqtTrace.Error(
"TestLoggerManager: Error while initializing logger: {0}, Exception details: {1}",
string.IsNullOrEmpty(extensionUri) ? logger.GetType().ToString() : extensionUri, ex);
"TestLoggerManager: Error while initializing logger: {0}, Exception details: {1}", loggerUri, ex);

this.messageLogger.SendMessage(
TestMessageLevel.Error,
Expand All @@ -594,7 +627,8 @@ private bool InitializeLogger(object logger, string extensionUri, Dictionary<str
string.IsNullOrEmpty(extensionUri) ? "type" : "uri",
string.IsNullOrEmpty(extensionUri) ? logger.GetType().ToString() : extensionUri,
ex));
return false;

throw new InvalidLoggerException($"Error while initializing logger: {loggerUri}, Exception details: {ex.Message}");
}

return true;
Expand All @@ -613,6 +647,7 @@ private Dictionary<string, string> UpdateLoggerParameters(Dictionary<string, str

// Add default logger parameters...
loggerParams[DefaultLoggerParameterNames.TestRunDirectory] = testRunDirectory;
loggerParams[DefaultLoggerParameterNames.TargetFramework] = targetFramework;
return loggerParams;
}

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -211,4 +211,7 @@ Error Details: {1}:{2}</value>
<data name="TrxLoggerResultsFileOverwriteWarning" xml:space="preserve">
<value>WARNING: Overwriting results file: {0}</value>
</data>
<data name="PrefixAndNameProvidedError" xml:space="preserve">
<value>The parameters LogFileName and LogFilePrefix cannot be used together. </value>
</data>
</root>
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,11 @@ Fehlerdetails: {1}: {2}</target>
<target state="translated">UPOZORNĚNÍ: Přepíše se soubor výsledků: {0}</target>
<note />
</trans-unit>
<trans-unit id="PrefixAndNameProvidedError">
<source>The parameters LogFileName and LogFilePrefix cannot be used together. </source>
<target state="new">The parameters LogFileName and LogFilePrefix cannot be given together. </target>
<note></note>
</trans-unit>
</body>
</file>
</xliff>
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,11 @@ Fehlerdetails: {1}: {2}</target>
<target state="translated">WARNUNG: Ergebnisdatei wird überschrieben: {0}</target>
<note />
</trans-unit>
<trans-unit id="PrefixAndNameProvidedError">
<source>The parameters LogFileName and LogFilePrefix cannot be used together. </source>
<target state="new">The parameters LogFileName and LogFilePrefix cannot be given together. </target>
<note></note>
</trans-unit>
</body>
</file>
</xliff>
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,11 @@ Fehlerdetails: {1}: {2}</target>
<target state="translated">ADVERTENCIA: Se sobrescribirá el archivo de resultados: {0}</target>
<note />
</trans-unit>
<trans-unit id="PrefixAndNameProvidedError">
<source>The parameters LogFileName and LogFilePrefix cannot be used together. </source>
<target state="new">The parameters LogFileName and LogFilePrefix cannot be given together. </target>
<note></note>
</trans-unit>
</body>
</file>
</xliff>
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,11 @@ Fehlerdetails: {1}: {2}</target>
<target state="translated">AVERTISSEMENT : Fichier de résultats en cours de remplacement : {0}</target>
<note />
</trans-unit>
<trans-unit id="PrefixAndNameProvidedError">
<source>The parameters LogFileName and LogFilePrefix cannot be used together. </source>
<target state="new">The parameters LogFileName and LogFilePrefix cannot be given together. </target>
<note></note>
</trans-unit>
</body>
</file>
</xliff>
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,11 @@ Fehlerdetails: {1}: {2}</target>
<target state="translated">AVVISO: il file dei risultati {0} verrà sovrascritto</target>
<note />
</trans-unit>
<trans-unit id="PrefixAndNameProvidedError">
<source>The parameters LogFileName and LogFilePrefix cannot be used together. </source>
<target state="new">The parameters LogFileName and LogFilePrefix cannot be given together. </target>
<note></note>
</trans-unit>
</body>
</file>
</xliff>
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,11 @@ Fehlerdetails: {1}: {2}</target>
<target state="translated">警告: 結果ファイルを上書きしています: {0}</target>
<note />
</trans-unit>
<trans-unit id="PrefixAndNameProvidedError">
<source>The parameters LogFileName and LogFilePrefix cannot be used together. </source>
<target state="new">The parameters LogFileName and LogFilePrefix cannot be given together. </target>
<note></note>
</trans-unit>
</body>
</file>
</xliff>
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,11 @@ Fehlerdetails: {1}: {2}</target>
<target state="translated">경고: 결과 파일을 덮어쓰는 중: {0}</target>
<note />
</trans-unit>
<trans-unit id="PrefixAndNameProvidedError">
<source>The parameters LogFileName and LogFilePrefix cannot be used together. </source>
<target state="new">The parameters LogFileName and LogFilePrefix cannot be given together. </target>
<note></note>
</trans-unit>
</body>
</file>
</xliff>
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,11 @@ Fehlerdetails: {1}: {2}</target>
<target state="translated">OSTRZEŻENIE: Plik wynikowy jest zastępowany: {0}</target>
<note />
</trans-unit>
<trans-unit id="PrefixAndNameProvidedError">
<source>The parameters LogFileName and LogFilePrefix cannot be used together. </source>
<target state="new">The parameters LogFileName and LogFilePrefix cannot be given together. </target>
<note></note>
</trans-unit>
</body>
</file>
</xliff>
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,11 @@ Fehlerdetails: {1}: {2}</target>
<target state="translated">AVISO: sobrescrevendo o arquivo de resultados: {0}</target>
<note />
</trans-unit>
<trans-unit id="PrefixAndNameProvidedError">
<source>The parameters LogFileName and LogFilePrefix cannot be used together. </source>
<target state="new">The parameters LogFileName and LogFilePrefix cannot be given together. </target>
<note></note>
</trans-unit>
</body>
</file>
</xliff>
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,11 @@ Fehlerdetails: {1}: {2}</target>
<target state="translated">Внимание! Перезапись файла с результатами: {0}</target>
<note />
</trans-unit>
<trans-unit id="PrefixAndNameProvidedError">
<source>The parameters LogFileName and LogFilePrefix cannot be used together. </source>
<target state="new">The parameters LogFileName and LogFilePrefix cannot be given together. </target>
<note></note>
</trans-unit>
</body>
</file>
</xliff>
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,11 @@ Fehlerdetails: {1}: {2}</target>
<target state="translated">UYARI: Sonuç dosyasının üzerine yazılıyor: {0}</target>
<note />
</trans-unit>
<trans-unit id="PrefixAndNameProvidedError">
<source>The parameters LogFileName and LogFilePrefix cannot be used together. </source>
<target state="new">The parameters LogFileName and LogFilePrefix cannot be given together. </target>
<note></note>
</trans-unit>
</body>
</file>
</xliff>
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,11 @@ Error Details: {1}:{2}</source>
<target state="new">WARNING: Overwriting results file: {0}</target>
<note></note>
</trans-unit>
<trans-unit id="PrefixAndNameProvidedError">
<source>The parameters LogFileName and LogFilePrefix cannot be used together. </source>
<target state="new">The parameters LogFileName and LogFilePrefix cannot be given together. </target>
<note></note>
</trans-unit>
</body>
</file>
</xliff>
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,11 @@ Fehlerdetails: {1}: {2}</target>
<target state="translated">警告: 正在覆盖结果文件: {0}</target>
<note />
</trans-unit>
<trans-unit id="PrefixAndNameProvidedError">
<source>The parameters LogFileName and LogFilePrefix cannot be used together. </source>
<target state="new">The parameters LogFileName and LogFilePrefix cannot be given together. </target>
<note></note>
</trans-unit>
</body>
</file>
</xliff>
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,11 @@ Fehlerdetails: {1}: {2}</target>
<target state="translated">警告: 將要覆寫結果檔案: {0}</target>
<note />
</trans-unit>
<trans-unit id="PrefixAndNameProvidedError">
<source>The parameters LogFileName and LogFilePrefix cannot be used together. </source>
<target state="new">The parameters LogFileName and LogFilePrefix cannot be given together. </target>
<note></note>
</trans-unit>
</body>
</file>
</xliff>
Loading

0 comments on commit 32a75bd

Please sign in to comment.