The setup:
- calling BatchModeMethod from the command line (-executeMethod)
BatchModeMethod looks something like this:
public static async void BatchModeMethod()
{
Debug.Log("Inside BatchmodeMethod");
var api = ScriptableObject.CreateInstance<TestRunnerApi>();
api.RetrieveTestList(TestMode.EditMode, adaptor =>
{
Debug.Log("inside retrieveTestList callback");
});
var startTime = DateTime.Now;
while ((DateTime.Now - startTime).TotalSeconds < 10)
{
await Task.Yield();
}
Debug.Log("Waited for: " + (DateTime.Now - startTime).TotalSeconds + "sec");
}
The result
- the first and last logs are logged correctly, indicating that the method is called correctly and waits for 10sec before finishing
- BUT “inside retrieveTestList callback” is never logged, so the callback is never called.
- the same happend when you try to get callbacks from tests run this way
- BatchModeMethod works without problems if you run it in a manually started editor instance
So my question: how can I make the callbacks work in methods and editors called from commandline?