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

Holidayで自動テストの活用方法を検討し追加する #7

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ MonoBehaviour:
m_Key: ContentRoot
- m_AssemblyName: mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
m_ClassName: System.Boolean
m_Data: True
m_Data: False
m_Key: IsEnabled
- m_AssemblyName: mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
m_ClassName: System.String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
"Extreal.Core.StageNavigation",
"Extreal.Core.Common",
"Extreal.Integration.Multiplay.NGO",
"Extreal.Integration.Chat.Vivox",
"Extreal.SampleApp.Holiday.MultiplayCommon"
"Extreal.Integration.Chat.Vivox"
],
"includePlatforms": [
"Editor",
Expand Down
31 changes: 21 additions & 10 deletions Assets/Holiday.PerformanceTest/PerformanceTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,8 @@ private async UniTaskVoid StartTestAsync()
// Starts to download data and enters AvatarSelectionScreen
FindObjectOfType<Button>().onClick.Invoke();
await UniTask.WaitUntil(() =>
FindObjectOfType<Button>()?.gameObject.scene.name == SceneName.ConfirmationScreen.ToString()
|| FindObjectOfType<Button>()?.gameObject.scene.name == SceneName.AvatarSelectionScreen.ToString());
if (FindObjectOfType<Button>()?.gameObject.scene.name == SceneName.ConfirmationScreen.ToString())
ExistButtonOfSceneNamed(SceneName.ConfirmationScreen, SceneName.AvatarSelectionScreen));
if (ExistButtonOfSceneNamed(SceneName.ConfirmationScreen))
{
foreach (var button in FindObjectsOfType<Button>())
{
Expand All @@ -83,8 +82,7 @@ await UniTask.WaitUntil(() =>
break;
}
}
await UniTask.WaitUntil(() =>
FindObjectOfType<Button>()?.gameObject.scene.name == SceneName.AvatarSelectionScreen.ToString());
await UniTask.WaitUntil(() => ExistButtonOfSceneNamed(SceneName.AvatarSelectionScreen));
}

// Selects avatar
Expand All @@ -95,9 +93,8 @@ await UniTask.WaitUntil(() =>
// Enters VirtualSpace
FindObjectOfType<Button>().onClick.Invoke();
await UniTask.WaitUntil(() =>
FindObjectOfType<Button>()?.gameObject.scene.name == SceneName.ConfirmationScreen.ToString()
|| FindObjectOfType<Button>()?.gameObject.scene.name == SceneName.TextChatControl.ToString());
if (FindObjectOfType<Button>()?.gameObject.scene.name == SceneName.ConfirmationScreen.ToString())
ExistButtonOfSceneNamed(SceneName.ConfirmationScreen, SceneName.TextChatControl));
if (ExistButtonOfSceneNamed(SceneName.ConfirmationScreen))
{
foreach (var button in FindObjectsOfType<Button>())
{
Expand All @@ -107,8 +104,7 @@ await UniTask.WaitUntil(() =>
break;
}
}
await UniTask.WaitUntil(() =>
FindObjectOfType<Button>()?.gameObject.scene.name == SceneName.TextChatControl.ToString());
await UniTask.WaitUntil(() => ExistButtonOfSceneNamed(SceneName.TextChatControl));
}

var appControlScope = FindObjectOfType<ClientControlScope>();
Expand Down Expand Up @@ -227,6 +223,21 @@ await UniTask.WaitUntil(() =>
}
}

private static bool ExistButtonOfSceneNamed(params SceneName[] sceneNames)
{
foreach (var button in FindObjectsOfType<Button>())
{
foreach (var sceneName in sceneNames)
{
if (button.gameObject.scene.name == sceneName.ToString())
{
return true;
}
}
}
return false;
}

private bool InRange(Vector3 position)
=> movableRangeMin.x <= position.x && position.x <= movableRangeMax.x
&& movableRangeMin.z <= position.z && position.z <= movableRangeMax.z;
Expand Down
8 changes: 8 additions & 0 deletions Assets/Holiday.Tests.meta

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

38 changes: 38 additions & 0 deletions Assets/Holiday.Tests/Extreal.SampleApp.Holiday.Tests.asmdef
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"name": "Extreal.SampleApp.Holiday.Tests",
Copy link
Contributor

Choose a reason for hiding this comment

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

Holiday.TestsにPerformanceTestと今回のテストをまとめた方がAssets直下のディレクトリが増えなくて、全体を理解しやすそうと感じました。

"rootNamespace": "Extreal.SampleApp.Holiday.Tests",
"references": [
"UnityEngine.TestRunner",
"UnityEditor.TestRunner",
"Extreal.SampleApp.Holiday",
"Cinemachine",
"Unity.ResourceManager",
"Unity.Addressables",
"Unity.Collections",
"Unity.TextMeshPro",
"UniRx",
"UniTask",
"VContainer",
"Unity.Netcode.Runtime",
"VivoxUnity",
"StarterAsserts",
"Extreal.Core.Logging",
"Extreal.Core.StageNavigation",
"Extreal.Core.Common",
"Extreal.Integration.Multiplay.NGO",
"Extreal.Integration.Chat.Vivox"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": true,
"precompiledReferences": [
"nunit.framework.dll"
],
"autoReferenced": false,
"defineConstraints": [
"UNITY_INCLUDE_TESTS"
],
"versionDefines": [],
"noEngineReferences": false
}

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

Loading