You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
- Splitting OSSTests into two parts: OSSTests and OSSTestsCore. - This division allowed to make OSMcpTests, which includes Mcp support for tests. - OSSTests and OSMcpTests have their own DefaultEngine.ini from which they can get the necessary values for tests. #jira UE-194407 #rb michael.Kirzinger, stephen.ma [CL 31586645 by alex kasianchuk in ue5-main branch]
103 lines
3.7 KiB
C++
103 lines
3.7 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "TestHarness.h"
|
|
#include "TestDriver.h"
|
|
#include "Interfaces/OnlineIdentityInterface.h"
|
|
|
|
#include <catch2/catch_test_case_info.hpp>
|
|
#include <catch2/interfaces/catch_interfaces_registry_hub.hpp>
|
|
|
|
class OnlineSubsystemTestBase : public Catch::ITestInvoker
|
|
{
|
|
public:
|
|
void ConstructInternal(FString ServiceName);
|
|
virtual ~OnlineSubsystemTestBase();
|
|
protected:
|
|
|
|
OnlineSubsystemTestBase();
|
|
|
|
FString GetSubsystem() const;
|
|
FOnlineAccountCredentials GetCredentials(int LocalUserNum) const;
|
|
FTestPipeline& GetLoginPipeline(uint32 NumUsersToLogin = 1) const;
|
|
FTestPipeline& GetPipeline();
|
|
void RunToCompletion() const;
|
|
|
|
/* ITestInvoker */
|
|
virtual void invoke() const override = 0;
|
|
|
|
private:
|
|
FString Tags;
|
|
FString Subsystem;
|
|
// Catch's ITestInvoker is a const interface but we'll be changing stuff (emplacing steps into the driver, setting flags, etc.) so we make these mutable
|
|
mutable FTestDriver Driver;
|
|
mutable FTestPipeline Pipeline;
|
|
mutable uint32 NumLocalUsers = -1;
|
|
};
|
|
|
|
typedef OnlineSubsystemTestBase* (*OnlineSubsystemTestConstructor)();
|
|
|
|
class OnlineSubsystemAutoReg
|
|
{
|
|
private:
|
|
// TODO: This should poll some info from the tags and generate the list based on that
|
|
TArray<FString> GetApplicableSubsystems();
|
|
|
|
public:
|
|
struct FReportingSkippableTags
|
|
{
|
|
TArray<FString> MayFailTags;
|
|
TArray<FString> ShouldFailTags;
|
|
TArray<FString> DisableTestTags;
|
|
};
|
|
|
|
/*
|
|
* Helper function that calls CheckAllTagsIsIn(const TArray<FString>&, const TArray<FString>&);
|
|
*
|
|
* @param TestTags The array of test tags we wish to test against.
|
|
* @param RawTagString Comma seperated string of elemnets we wish to convert to an array.
|
|
*
|
|
* @return true if all elements of RawTagString prased as an comma sperated array is in TestTags.
|
|
*/
|
|
static bool CheckAllTagsIsIn(const TArray<FString>& TestTags, const FString& RawTagString);
|
|
|
|
|
|
/**
|
|
* Checks if every element of InputTags is in TestTags.
|
|
*
|
|
* @param TestTags The array of test tags we wish to test against.
|
|
* @param InputTags The array of tags we wish to see if all elements of are present in TestTags.
|
|
*
|
|
* @return true if all elements of InputTags is in TestTags.
|
|
*/
|
|
static bool CheckAllTagsIsIn(const TArray<FString>& TestTags, const TArray<FString>& InputTags);
|
|
|
|
static FString GenerateTags(const FString& ServiceName, const FReportingSkippableTags& SkippableTags, const TCHAR* InTag);
|
|
static bool ShouldDisableTest(const FString& ServiceName, const FReportingSkippableTags& SkippableTags, const TCHAR* InTag);
|
|
|
|
// This code is kept identical to Catch internals so that there is as little deviation from OSS_TESTS and Online_OSS_TESTS as possible
|
|
OnlineSubsystemAutoReg(OnlineSubsystemTestConstructor TestCtor, Catch::SourceLineInfo LineInfo, const char* Name, const char* Tags, const char* AddlOnlineInfo);
|
|
};
|
|
|
|
TArray<TFunction<void()>>* GetGlobalInitalizers();
|
|
|
|
|
|
// INTERNAL_CATCH_UNIQUE_NAME is what Catch uses to translate the name of the test into a unique identifier without any spaces
|
|
|
|
#define INTERNAL_ONLINESUBSYSTEM_TEST_CASE_NAMED(RegName, Name, Tags, ...)\
|
|
namespace {\
|
|
class PREPROCESSOR_JOIN(OnlineSubsystemTest_,RegName) : public OnlineSubsystemTestBase {\
|
|
protected:\
|
|
virtual void invoke() const override;\
|
|
};\
|
|
OnlineSubsystemTestBase* PREPROCESSOR_JOIN(Construct_,RegName) (){\
|
|
return new PREPROCESSOR_JOIN(OnlineSubsystemTest_,RegName) ();\
|
|
}\
|
|
OnlineSubsystemAutoReg RegName( PREPROCESSOR_JOIN(&Construct_,RegName) , CATCH_INTERNAL_LINEINFO , Name, Tags, "");\
|
|
}\
|
|
void PREPROCESSOR_JOIN(OnlineSubsystemTest_,RegName)::invoke() const\
|
|
|
|
#define ONLINESUBSYSTEM_TEST_CASE(Name, Tags, ...) \
|
|
INTERNAL_ONLINESUBSYSTEM_TEST_CASE_NAMED(INTERNAL_CATCH_UNIQUE_NAME(OnlineSubsystemRegistrar), Name, Tags, __VA_ARGS__)
|