Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support launch autopilot from Play Mode tests #36

Merged
merged 5 commits into from
Apr 3, 2024

Conversation

nowsprinting
Copy link
Contributor

@nowsprinting nowsprinting commented Mar 16, 2024

Changes

  • Add launcher from test
  • Refactor enum

Usage

Autopilot works within your test code using the async method LauncherFromTest.AutopilotAsync(string).
Specify the AutopilotSettings file path as the argument.

[Test]
public async Task LaunchAutopilotFromTest()
{
  await LauncherFromTest.AutopilotAsync("Assets/Path/To/AutopilotSettings.asset");
}

Note

If an error is detected in running, it will be output to LogError and the test will fail.

Warning

The default timeout for tests is 3 minutes. If the autopilot execution time exceeds 3 minutes, please specify the timeout time with the Timeout attribute.


Contribution License Agreement

@nowsprinting nowsprinting requested a review from a team as a code owner March 16, 2024 11:10
{
_logger.Log("Terminate autopilot");
_state.Reset();
_state.settings = null;
_state.exitCode = exitCode;
return; // Only terminate autopilot run if starting from play mode.
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nowsprinting Sorry for my late reply. Why launchFrom does not get reset in here? I think this is a breaking change.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Fixed with a7f2c65

Fix regression about AutopilotState after terminate

  • Revert to "reset AutopilotState in TerminateAsync"
  • Changed throw NUnit.Framework.AssertionException to be during in the TerminateAsync

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the autopilot run fails, the LogException will be output so that the test will fail.
I wrote a termination process just in case.

- Revert to "reset AutopilotState in TerminateAsync"
- Changed throw NUnit.Framework.AssertionException to be during in the TerminateAsync
@nowsprinting nowsprinting requested a review from Kuniwak April 2, 2024 10:03
Copy link
Member

@Kuniwak Kuniwak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Kuniwak Kuniwak merged commit 3d5defb into DeNA:master Apr 3, 2024
1 check passed
@nowsprinting nowsprinting deleted the feature/launch_from_test branch April 3, 2024 21:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants