Skip to content

Commit 7376f4f

Browse files
author
pgilmorepf
committed
TestTitleData file location is now loaded from environment variable in UE4-BP and UE-CPP
Summary: TestTitleData file location is now loaded from environment variable in UE4-BP and UE-CPP fixes T2615 Test Plan: Manual Reviewers: Marco.Williams Maniphest Tasks: T2615 Differential Revision: https://phab.playfabdev.com/D3013
1 parent 2dc50d7 commit 7376f4f

File tree

3 files changed

+23
-6
lines changed

3 files changed

+23
-6
lines changed

targets/cpp-ue4/testingFiles/PlayFabApiTests.h

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -320,8 +320,17 @@ class PlayFabApiTestSuite : public FAutomationTestBase
320320
bool success = true;
321321

322322
FString jsonInput;
323-
TCHAR* filename = TEXT("C:\\depot\\pf-main\\tools\\SDKBuildScripts\\testTitleData.json");
324-
success &= FFileHelper::LoadFileToString(jsonInput, filename);
323+
FString filename = TEXT("testTitleData.json");
324+
325+
// Prefer to load path from environment variable, if present
326+
char* envPath = nullptr;
327+
size_t envPathStrLen;
328+
errno_t err = _dupenv_s(&envPath, &envPathStrLen, "PF_TEST_TITLE_DATA_JSON");
329+
if (err == 0)
330+
filename = FString(ANSI_TO_TCHAR(envPath));
331+
free(envPath); // It's OK to call free with NULL
332+
333+
success &= FFileHelper::LoadFileToString(jsonInput, *filename);
325334

326335
TSharedPtr<FJsonObject> jsonParsed = nullptr;
327336
if (success)
@@ -341,10 +350,10 @@ class PlayFabApiTestSuite : public FAutomationTestBase
341350
virtual FString GetBeautifiedTestName() const override { return "PlayFabApiTests"; }
342351
virtual void GetTests(TArray<FString>& OutBeautifiedNames, TArray <FString>& OutTestCommands) const override
343352
{
344-
for (const FString& TestName : TestFunctionNames)
353+
for (const FString& pfTestName : TestFunctionNames)
345354
{
346-
OutBeautifiedNames.Add(TestName);
347-
OutTestCommands.Add(TestName);
355+
OutBeautifiedNames.Add(pfTestName);
356+
OutTestCommands.Add(pfTestName);
348357
}
349358
}
350359

targets/cpp-unreal/templates/PfTestActor.cpp.ejs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,14 @@ bool APfTestActor::ClassSetup()
152152
playFabSettings->AdvertisingIdType = TEXT("");
153153
playFabSettings->AdvertisingIdValue = TEXT("");
154154

155+
// Prefer to load path from environment variable, if present
156+
char* envPath = nullptr;
157+
size_t envPathStrLen;
158+
errno_t err = _dupenv_s(&envPath, &envPathStrLen, "PF_TEST_TITLE_DATA_JSON");
159+
if (err == 0)
160+
TEST_TITLE_DATA_LOC = FString(ANSI_TO_TCHAR(envPath));
161+
free(envPath); // It's OK to call free with NULL
162+
155163
FString titleDataJson;
156164
if (FFileHelper::LoadFileToString(titleDataJson, *TEST_TITLE_DATA_LOC))
157165
{

targets/cpp-unreal/templates/PfTestActor.h.ejs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public:
112112
FString _outputSummary;
113113
// A bunch of constants: load these from testTitleData.json
114114
UPROPERTY()
115-
FString TEST_TITLE_DATA_LOC = "C:/depot/pf-main/tools/SDKBuildScripts/testTitleData.json";
115+
FString TEST_TITLE_DATA_LOC = "testTitleData.json";
116116
UPROPERTY()
117117
FString userEmail;
118118
UPROPERTY()

0 commit comments

Comments
 (0)