NightOwl888 commented on code in PR #1021:
URL: https://github.com/apache/lucenenet/pull/1021#discussion_r1839317334
##########
src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs:
##########
@@ -929,23 +929,35 @@ public virtual void TearDown()
*/
TestResult result =
TestExecutionContext.CurrentContext.CurrentResult;
- string message;
+
if (result.ResultState == ResultState.Failure ||
result.ResultState == ResultState.Error)
{
- message = result.Message + $"\n\nTo reproduce this test
result:\n\n" +
- $"Option 1:\n\n" +
- $" Apply the following assembly-level attributes:\n\n" +
- $"[assembly:
Lucene.Net.Util.RandomSeed(\"{RandomizedContext.CurrentContext.RandomSeedAsHex}\")]\n"
+
- $"[assembly:
NUnit.Framework.SetCulture(\"{Thread.CurrentThread.CurrentCulture.Name}\")]\n\n"
+
- $"Option 2:\n\n" +
- $" Use the following .runsettings file:\n\n" +
- $"<RunSettings>\n" +
- $" <TestRunParameters>\n" +
- $" <Parameter name=\"tests:seed\"
value=\"{RandomizedContext.CurrentContext.RandomSeedAsHex}\" />\n" +
- $" <Parameter name=\"tests:culture\"
value=\"{Thread.CurrentThread.CurrentCulture.Name}\" />\n" +
- $" </TestRunParameters>\n" +
- $"</RunSettings>\n\n" +
- $"See the .runsettings documentation at:
https://docs.microsoft.com/en-us/visualstudio/test/configure-unit-tests-by-using-a-dot-runsettings-file.";
+ string message =
+ $$"""
+ {{result.Message}}
+
+ To reproduce this test result:
+
+ Option 1:
+
+ Apply the following assembly-level attributes:
+
+ [assembly:
Lucene.Net.Util.RandomSeed("{{RandomizedContext.CurrentContext.RandomSeedAsHex}}")]
+ [assembly:
NUnit.Framework.SetCulture("{{Thread.CurrentThread.CurrentCulture.Name}}")]
+
+ Option 2:
Review Comment:
Could we just add this as Option 3? The syntax of the `.runsettings` file is
hard to remember so I would rather not leave it out of the message entirely.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]