alttester / alttester/AltTester-Unity-SDK

Cannot get correct result in Log file when run test from the command line

Abierto
#1,645 0 comentarios 0 reacciones 0 asignados Ver en GitHub
bug no version
Lenguaje dominante
C#
Estrellas
121
Forks
24
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

**In what language is the test written?**
C#

**What version of Unity are you using?**
20223.f1

**What version of AltTester® Unity SDK are you using?**
2.1.1

**On what device are you trying to run the test?**
Windows computer Command Line

**The OS from where you are running the test?**
Windows 11

### Summary

I can’t run the test and get a log file when running test from the command line like it was discribed in docs, although when I running test from the editor the log file is generated correctly.

### Steps to reproduce
Hello!
Help me please!
I can’t run the test and get a log file when running test from the command line like it was discribed in docs, although when I running test from the editor the log file is generated correctly.

In the example, EndlessRunnerSampleGame-master I made a SuccessTest() test - it always succeeds.
When I run the test in the editor, the test passes and a log file AltTester.log is generated containing the expected output:
2024-06-11 17:56:49.0931|INFO|Info
2024-06-11 17:56:49.0931|INFO|AltTester(R) logs are saved at: C:\Develop\TrashCat3\EndlessRunnerSampleGame-master\AltTester.log
2024-06-11 17:56:49.2582|INFO|=====!!!===!!!===!!!===!!!===!!! AFTER creating altDriver object
2024-06-11 17:56:49.2722|INFO|=====!!!===!!!===!!!===!!!===!!! Inside SuccessTest()

When run from the command line with the command:
"C:\Program Files\Unity\Hub\Editor\2022.3.22f1\Editor\Unity.exe" -projectPath C:\Develop\TrashCat3\EndlessRunnerSampleGame-master -executeMethod AltTester.AltTesterUnitySDK.Editor.AltTestRunner.RunTestFromCommandLine -tests AltTrashCatTests.SuccessTest -logFile logFile2.log -batchmode -quit

I get AltTester.log with shortened content. It only contains:
2024-06-11 18:14:47.9668|INFO|Info
2024-06-11 18:14:47.9914|INFO|AltTester(R) logs are saved at: C:\Develop\TrashCat3\EndlessRunnerSampleGame-master\AltTester.log

The log2.log file contains the lines:
2024-06-11 18:14:47.9668|Driver|INFO|Info
2024-06-11 18:14:47.9914|Driver|INFO|AltTester(R) logs are saved at: C:\Develop\TrashCat3\EndlessRunnerSampleGame-master\AltTester.log
2024-06-11 18:15:48.0278|Editor|INFO|==============> TEST AltTrashCatTests.SuccessTest: FAILED:ERROR(PARENT)

And under each of these lines it seems to show the exception stack. For example for:
2024-06-11 18:14:47.9668|Driver|INFO|Info
UnityEngine.StackTraceUtility:ExtractStackTrace ()
UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
UnityEngine.Logger:Log (UnityEngine.LogType,object)
UnityEngine.Debug:Log (object)
AltTester.AltTesterUnitySDK.Driver.Logging.UnityTarget:Write (NLog.LogEventInfo) (at Assets/AltTester/Runtime/AltDriver/Logging/UnityTarget.cs:50)
NLog.Targets.Target:Write (NLog.Common.AsyncLogEventInfo)
NLog.Targets.Target:WriteAsyncThreadSafe (NLog.Common.AsyncLogEventInfo)
NLog.Targets.Target:WriteAsyncLogEvent (NLog.Common.AsyncLogEventInfo)
NLog.LoggerImpl:WriteToTargetWithFilterChain (NLog.Targets.Target,NLog.Filters.FilterResult,NLog.LogEventInfo,NLog.Common.AsyncContinuation)
NLog.LoggerImpl:Write (System.Type,NLog.Internal.TargetWithFilterChain,NLog.LogEventInfo,NLog.LogFactory)
NLog.Logger:WriteToTargets (NLog.LogEventInfo,NLog.Internal.TargetWithFilterChain)
NLog.Logger:WriteToTargets (NLog.LogLevel,System.IFormatProvider,NLog.LogLevel)
NLog.Logger:Info (NLog.LogLevel)
AltTester.AltTesterUnitySDK.Driver.Logging.DriverLogManager:SetupAltDriverLogging (System.Collections.Generic.Dictionary`2) (at Assets/AltTester/Runtime/AltDriver/Logging/DriverLogManager.cs:43)
AltTester.AltTesterUnitySDK.Driver.AltDriver:.ctor (string,int,string,bool,int,string,string,string,string,string) (at Assets/AltTester/Runtime/AltDriver/AltDriver.cs:60)
AltTrashCatTests:SetUp () (at Assets/AltTester/Editor/Tests/AltTrashCatTests.cs:14)
System.Reflection.RuntimeMethodInfo:Invoke (object,System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo)
System.Reflection.MethodBase:Invoke (object,object[])
NUnit.Framework.Internal.Reflect:InvokeMethod (System.Reflection.MethodInfo,object,object[])
NUnit.Framework.Internal.Reflect:InvokeMethod (System.Reflection.MethodInfo,object)
NUnit.Framework.Internal.Commands.SetUpTearDownItem:RunNonAsyncMethod (System.Reflection.MethodInfo,NUnit.Framework.Internal.ITestExecutionContext)
NUnit.Framework.Internal.Commands.SetUpTearDownItem:RunSetUpOrTearDownMethod (NUnit.Framework.Internal.ITestExecutionContext,System.Reflection.MethodInfo)
NUnit.Framework.Internal.Commands.SetUpTearDownItem:RunSetUp (NUnit.Framework.Internal.ITestExecutionContext)
NUnit.Framework.Internal.Commands.OneTimeSetUpCommand:Execute (NUnit.Framework.Internal.ITestExecutionContext)
NUnit.Framework.Internal.Execution.CompositeWorkItem:PerformOneTimeSetUp ()
NUnit.Framework.Internal.Execution.CompositeWorkItem:PerformWork ()
NUnit.Framework.Internal.Execution.WorkItem:RunTest ()
NUnit.Framework.Internal.Execution.WorkItem:Execute ()
NUnit.Framework.Internal.Execution.SimpleWorkItemDispatcher:Dispatch (NUnit.Framework.Internal.Execution.WorkItem)
NUnit.Framework.Internal.Execution.CompositeWorkItem:RunChildren ()
NUnit.Framework.Internal.Execution.CompositeWorkItem:PerformWork ()
NUnit.Framework.Internal.Execution.WorkItem:RunTest ()
NUnit.Framework.Internal.Execution.WorkItem:Execute ()
NUnit.Framework.Internal.Execution.SimpleWorkItemDispatcher:RunnerThreadProc ()
System.Threading.ThreadHelper:ThreadStart_Context (object)
System.Threading.ExecutionContext:RunInternal (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool)
System.Threading.ExecutionContext:Run (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool)
System.Threading.ExecutionContext:Run (System.Threading.ExecutionContext,System.Threading.ContextCallback,object)
System.Threading.ThreadHelper:ThreadStart ()
(Filename: Assets/AltTester/Runtime/AltDriver/Logging/UnityTarget.cs Line: 50)

Please help me get the correct log file when running test from the command line

### Relevant logs and/or screenshots
The AltTrashCatTests.log is script file AltTrashCatTests.sc

[AltTester_RunFromCommandLine.log](https://github.com/user-attachments/files/15791852/AltTester_RunFromCommandLine.log)
[AltTester_RunInEditor.log](https://github.com/user-attachments/files/15791853/AltTester_RunInEditor.log)
[logFile2_RunFromCommandLine.log](https://github.com/user-attachments/files/15791884/logFile2_RunFromCommandLine.log)
[AltTrashCatTests.log](https://github.com/user-attachments/files/15791923/AltTrashCatTests.log)

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.