Skip to content

Commit 68a767b

Browse files
authored
[Firebase AI] Refactor automated test structure (#1430)
* [Firebase AI] Refactor automated test structure * Update UIHandlerAutomated.cs * Update UIHandlerAutomated.cs * Revert "Update UIHandlerAutomated.cs" This reverts commit 7c85aae.
1 parent dfbbc65 commit 68a767b

File tree

1 file changed

+28
-15
lines changed

1 file changed

+28
-15
lines changed

firebaseai/testapp/Assets/Firebase/Sample/FirebaseAI/UIHandlerAutomated.cs

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -132,43 +132,56 @@ private async Task RetryTestWithExponentialBackoff(string testName, Func<Task> t
132132
protected override void Start()
133133
{
134134
// Set of tests that use multiple backends.
135-
Func<Backend, Task>[] multiBackendTests = {
135+
// When running on CI, these tests will be run on all devices
136+
Func<Backend, Task>[] basicMultiBackendTests = {
136137
TestCreateModel,
137138
TestBasicText,
138139
TestBasicImage,
139140
TestModelOptions,
140-
TestCountTokens,
141-
#if !(FIREBASE_RUNNING_FROM_CI && !UNITY_EDITOR)
142-
// Disabled from CI, because of rate limit issues
141+
TestCountTokens
142+
};
143+
// When running on CI, these tests are only run in the Editor
144+
Func<Backend, Task>[] editorMultiBackendTests = {
143145
TestMultipleCandidates,
144146
TestBasicTextStream,
145147
TestFunctionCallingAny,
146148
TestFunctionCallingNone,
147149
TestEnumSchemaResponse,
148150
TestAnyOfSchemaResponse,
149-
TestSearchGrounding,
150151
TestChatBasicTextNoHistory,
151152
TestChatBasicTextPriorHistory,
152153
TestChatFunctionCalling,
153154
TestChatBasicTextStream,
154-
TestYoutubeLink,
155-
TestGenerateImage,
156-
TestImagenGenerateImage,
157-
TestImagenGenerateImageOptions,
158155
TestThinkingBudget,
159-
TestIncludeThoughts,
160-
TestCodeExecution,
161-
TestUrlContext,
162156
TestTemplateGenerateContent,
163157
TestTemplateGenerateContentStream,
164-
TestTemplateImagenGenerateImage,
165158
TestJsonSchemaStructureOutput,
166159
TestTemplateChat,
167160
TestTemplateChatStreamAutoFunction,
168161
TestChatAutoFunctionCalling
169-
#endif
170162
};
171-
// Set of tests that only run the single time.
163+
// When running on CI, these tests aren't run since they are more flakey
164+
Func<Backend, Task>[] complexMultiBackendTests = {
165+
TestIncludeThoughts,
166+
TestYoutubeLink,
167+
TestGenerateImage,
168+
TestImagenGenerateImage,
169+
TestImagenGenerateImageOptions,
170+
TestSearchGrounding,
171+
TestCodeExecution,
172+
TestUrlContext,
173+
TestTemplateImagenGenerateImage,
174+
};
175+
// Construct the set of tests to run, based on the environment
176+
List<Func<Backend, Task>> multiBackendTests = new(basicMultiBackendTests);
177+
#if !(FIREBASE_RUNNING_FROM_CI && !UNITY_EDITOR)
178+
multiBackendTests.AddRange(editorMultiBackendTests);
179+
#endif
180+
#if !FIREBASE_RUNNING_FROM_CI
181+
multiBackendTests.AddRange(complexMultiBackendTests);
182+
#endif
183+
184+
// Set of tests that only run the single time, will be run on all devices.
172185
Func<Task>[] singleTests = {
173186
TestReadFile,
174187
TestReadSecureFile,

0 commit comments

Comments
 (0)