6#include "Async/Async.h"
7#include "Async/Future.h"
8#include "Containers/Array.h"
9#include "Containers/Map.h"
10#include "Containers/Queue.h"
11#include "Containers/Set.h"
12#include "Containers/UnrealString.h"
13#include "Delegates/Delegate.h"
14#include "Delegates/DelegateBase.h"
15#include "Delegates/DelegateInstancesImpl.h"
16#include "Delegates/IDelegateInstance.h"
17#include "GenericPlatform/GenericPlatformStackWalk.h"
18#include "HAL/CriticalSection.h"
19#include "HAL/LowLevelMemTracker.h"
20#include "HAL/PlatformProcess.h"
21#include "HAL/PlatformStackWalk.h"
22#include "HAL/PlatformTime.h"
23#include "HAL/ThreadSafeBool.h"
24#include "Internationalization/Regex.h"
25#include "Logging/LogVerbosity.h"
26#include "Math/Color.h"
27#include "Math/Color.h"
28#include "Math/MathFwd.h"
29#include "Math/Rotator.h"
30#include "Math/UnrealMathUtility.h"
31#include "Math/Vector.h"
32#include "Misc/AssertionMacros.h"
33#include "Misc/AutomationEvent.h"
34#include "Misc/Build.h"
36#include "Misc/CString.h"
37#include "Misc/DateTime.h"
38#include "Misc/FeedbackContext.h"
40#include "Misc/Optional.h"
41#include "Misc/OutputDevice.h"
42#include "Misc/Timespan.h"
43#include "Templates/Function.h"
44#include "Templates/SharedPointer.h"
45#include "Templates/UnrealTemplate.h"
46#include "UObject/NameTypes.h"
53#ifndef WITH_AUTOMATION_TESTS
54 #define WITH_AUTOMATION_TESTS (WITH_DEV_AUTOMATION_TESTS || WITH_PERF_AUTOMATION_TESTS)
58#define SAFE_GETSTACK(VariableName, IgnoreCount, MaxDepth)
59 TArray<FProgramCounterSymbolInfo> VariableName = FPlatformStackWalk::GetStack(IgnoreCount, MaxDepth);
60 if (VariableName.Num() == 0
)
63 FProgramCounterSymbolInfo& Info = VariableName.Emplace_GetRef();
64 TCString<ANSICHAR>::Strcpy(Info.Filename, FProgramCounterSymbolInfo::MAX_NAME_LENGTH, "Unknown");
69
70
71
79 EditorContext = 0x00000001,
81 ClientContext = 0x00000002,
83 ServerContext = 0x00000004,
85 CommandletContext = 0x00000008,
86 ApplicationContextMask = EditorContext | ClientContext | ServerContext | CommandletContext,
90 NonNullRHI = 0x00000100,
92 RequiresUser = 0x00000200,
93 FeatureMask = NonNullRHI | RequiresUser,
97 Disabled = 0x00010000,
101 CriticalPriority = 0x00100000,
103 HighPriority = 0x00200000,
105 HighPriorityAndAbove = CriticalPriority | HighPriority,
107 MediumPriority = 0x00400000,
109 MediumPriorityAndAbove = CriticalPriority | HighPriority | MediumPriority,
111 LowPriority = 0x00800000,
112 PriorityMask = CriticalPriority | HighPriority | MediumPriority | LowPriority,
116 SmokeFilter = 0x01000000,
118 EngineFilter = 0x02000000,
120 ProductFilter = 0x04000000,
122 PerfFilter = 0x08000000,
124 StressFilter = 0x10000000,
126 NegativeFilter = 0x20000000,
127 FilterMask = SmokeFilter | EngineFilter | ProductFilter | PerfFilter | StressFilter | NegativeFilter
134 static auto FlagMap = GetTestFlagsMap();
135 if (FlagMap.Contains(Name))
137 return FlagMap[Name];
159 return TEXT(
"Contains");
161 return TEXT(
"Exact");
163 return TEXT(
"Unknown");
223 return ContextStack.Num() ? ContextStack.Top() : EmptyContext;
228 ContextStack.Push(Context);
233 if ( ContextStack.Num() > 0 )
279
280
281
282
283
284
285
303
304
305
306
313
314
315
316
323
324
325
326
333
334
335
336
343
344
345
346
349 return TestParameter;
353
354
355
356
363
364
365
366
373
374
375
376
383
384
385
386
393
394
395
396
403
404
411
412
419
420
421
422
429
430
431
432
440
441
442
443
446 DisplayName = InDisplayName;
450
451
452
453
495
496
504
505
510
511
547
548
557 if (!Future.IsValid())
559 Future = Async(EAsyncExecution::Thread, MoveTemp(Function));
562 return Future.IsReady();
580
581
589
590
591
592
610
611
612
619
620
795
796
797
798
799
841
842
843
844
849
850
851
852
856
857
858
859
860
861
862
863
864
865
869
870
871
872
876
877
878
879
883
884
885
886
890
891
892
893
894
895
899
900
901
902
906
907
911
912
913
914
915
919
920
921
922
926
927
928
929
933
934
935
936
940
941
945
946
949 return LatentCommands.IsEmpty();
953
954
958
959
960
961
962
966
967
968
969
973
974
978
979
984
985
989
990
994
995
1012
1013
1014
1015
1019
1020
1047
1048
1049
1050
1051
1055
1056
1057
1058
1065
1066
1067
1068
1069
1072 CurTest = InAutomationTest;
1096 DestinationContext =
nullptr;
1101
1102
1103
1104
1105
1112
1113
1114
1115
1122
1123
1124
1125
1126
1127
1130 CurTest = InAutomationTest;
1134
1135
1136
1137
1138
1141 DestinationContext = InDestinationContext;
1158
1159
1160
1161
1162
1166
1167
1168
1169
1170
1174
1175
1176
1177
1178
1247
1248
1249
1250
1264 FAutomationTestFramework::Get().UnregisterAutomationTest( TestName );
1268
1269
1270
1271
1281
1282
1289
1290
1291
1292
1299
1300
1301
1302
1306
1307
1308
1309
1310
1314
1315
1316
1317
1318
1319
1323
1324
1325
1326
1327
1328
1332
1333
1334
1335
1339
1340
1341
1342
1343 virtual void AddInfo(
const FString& InLogItem, int32 StackOffset = 0,
bool bCaptureStack =
false);
1346
1347
1348
1349
1353
1354
1355
1356
1360
1361
1362
1363
1364
1365
1369
1370
1371
1372
1373
1377
1378
1379
1380
1384
1385
1386
1387
1391
1392
1393
1394
1398
1399
1400
1401
1405
1406
1410
1411
1412 UE_DEPRECATED(5.1,
"Use AddError(msg) instead to change the state of the test to a failure.")
1416
1417
1418 UE_DEPRECATED(5.1,
"Use GetLastExecutionSuccessState instead.")
1422
1423
1424
1425
1426
1430
1431
1435
1436
1440
1441
1442
1443
1444
1445
1446
1447
1448
1452
1453
1454
1455
1456
1457
1458
1459
1463
1464
1465
1466
1467
1471
1472
1473
1474
1475
1476
1477
1478
1482
1483
1484
1485
1497
1498
1499
1500
1507
1508
1509
1510
1514
1515
1516
1517
1521
1522
1523
1524
1528
1529
1532 TSharedRef<IAutomationLatentCommand> CommandPtr = MakeShareable(NewCommand);
1533 FAutomationTestFramework::Get().EnqueueLatentCommand(CommandPtr);
1537
1538
1541 TSharedRef<IAutomationNetworkCommand> CommandPtr = MakeShareable(NewCommand);
1542 FAutomationTestFramework::Get().EnqueueNetworkCommand(CommandPtr);
1565 ExecutionInfo.PushContext(Context);
1570 ExecutionInfo.PopContext();
1575 bool TestEqual(
const TCHAR* What,
const int32 Actual,
const int32 Expected);
1576 bool TestEqual(
const TCHAR* What,
const int64 Actual,
const int64 Expected);
1578 bool TestEqual(
const TCHAR* What,
const SIZE_T Actual,
const SIZE_T Expected);
1587 bool TestEqual(
const TCHAR* What,
const TCHAR* Actual,
const TCHAR* Expected);
1607 return TestEqual(*What, Actual, Expected, Tolerance);
1612 return TestEqual(*What, Actual, Expected, Tolerance);
1656
1657
1658
1659
1660
1661
1662
1663
1664 template<
typename ValueType>
1665 bool TestEqual(
const TCHAR* What,
const ValueType& Actual,
const ValueType& Expected)
1675 template<
typename ValueType>
1683
1684
1685
1686
1687
1688
1689
1698
1699
1700
1701
1702
1703
1704
1705 template<
typename ValueType>
bool TestInvalid(
const TCHAR* Description,
const TSharedPtr<ValueType>& SharedPointer)
1715 template<
typename ValueType>
bool TestInvalid(
const FString& Description,
const TSharedPtr<ValueType>& SharedPointer)
1721
1722
1723
1724
1725
1726
1727
1728
1729 template<
typename ValueType>
bool TestNotEqual(
const TCHAR* Description,
const ValueType& Actual,
const ValueType& Expected)
1739 template<
typename ValueType>
bool TestNotEqual(
const FString& Description,
const ValueType& Actual,
const ValueType& Expected)
1745
1746
1747
1748
1749
1750
1751
1752 template<
typename ValueType>
bool TestNotNull(
const TCHAR* What,
const ValueType* Pointer)
1768
1769
1770
1771
1772
1773
1774
1775
1776 template<
typename ValueType>
bool TestNotSame(
const TCHAR* Description,
const ValueType& Actual,
const ValueType& Expected)
1786 template<
typename ValueType>
bool TestNotSame(
const FString& Description,
const ValueType& Actual,
const ValueType& Expected)
1792
1793
1794
1795
1796
1797
1798
1807
1808
1809
1810
1811
1812
1813
1814
1815 template<
typename ValueType>
bool TestSame(
const TCHAR* Description,
const ValueType& Actual,
const ValueType& Expected)
1825 template<
typename ValueType>
bool TestSame(
const FString& Description,
const ValueType& Actual,
const ValueType& Expected)
1831
1832
1833
1834
1835
1836
1837
1846 #define TestTrueExpr(Expression) TestTrue(TEXT(#Expression), Expression)
1849
1850
1851
1852
1853
1854
1855
1856 template<
typename ValueType>
bool TestValid(
const TCHAR* Description,
const TSharedPtr<ValueType>& SharedPointer)
1866 template<
typename ValueType>
bool TestValid(
const FString& Description,
const TSharedPtr<ValueType>& SharedPointer)
1873
1874
1875
1876
1877
1878 virtual void GetTests(TArray<FString>& OutBeautifiedNames, TArray <FString>& OutTestCommands)
const = 0;
1881
1882
1883
1884
1885
1889
1890
1924
1925
1926
1927
1928
1932
1933
1934
1935
1957 TestIdToExecute = Parameters;
1962 virtual void GetTests(TArray<FString>& OutBeautifiedNames, TArray <FString>& OutTestCommands)
const override
1971 OutBeautifiedNames.Append(BeautifiedNames);
1972 OutTestCommands.Append(TestCommands);
1983 check(bBaseRunTestRan);
1989 check(bBaseRunTestRan);
1993 int32 OriginalBeforeEachCount = BeforeEachStack.Num();
1994 int32 OriginalAfterEachCount = AfterEachStack.Num();
1998 check(OriginalBeforeEachCount <= BeforeEachStack.Num());
1999 if (OriginalBeforeEachCount != BeforeEachStack.Num())
2001 BeforeEachStack.Pop();
2004 check(OriginalAfterEachCount <= AfterEachStack.Num());
2005 if (OriginalAfterEachCount != AfterEachStack.Num())
2007 AfterEachStack.Pop();
2015 check(bBaseRunTestRan);
2019 void It(
const FString& InDescription, TFunction<
void()> DoWork)
2021 check(bBaseRunTestRan);
2027 BeautifiedNames.Add(GetDescription());
2030 TestCommands.Add(GetDescription());
2033 else if (TestIdToExecute.IsEmpty() || GetDescription() == TestIdToExecute)
2035 for (int32 Index = 0; Index < BeforeEachStack.Num(); Index++)
2037 BeforeEachStack[Index]();
2042 for (int32 Index = AfterEachStack.Num() - 1; Index >= 0; Index--)
2044 AfterEachStack[Index]();
2053 BeforeEachStack.Push(DoWork);
2058 AfterEachStack.Push(DoWork);
2065 Description.Add(InDescription);
2070 Description.RemoveAt(Description.Num() - 1);
2076 for (int32 Index = 0; Index < Description.Num(); ++Index)
2078 if (Description[Index].IsEmpty())
2083 if (CompleteDescription.IsEmpty())
2085 CompleteDescription = Description[Index];
2087 else if (FChar::IsWhitespace(CompleteDescription[CompleteDescription.Len() - 1]) || FChar::IsWhitespace(Description[Index][0]))
2089 if (bIsDiscoveryMode)
2091 CompleteDescription = CompleteDescription +
TEXT(
".") + Description[Index];
2095 CompleteDescription = CompleteDescription + Description[Index];
2100 if (bIsDiscoveryMode)
2102 CompleteDescription = FString::Printf(
TEXT(
"%s.%s"), *CompleteDescription, *Description[Index]);
2106 CompleteDescription = FString::Printf(
TEXT(
"%s %s"), *CompleteDescription, *Description[Index]);
2111 return CompleteDescription;
2190 Predicate(FDoneDelegate::CreateSP(
this, &FUntilDoneLatentCommand::Done));
2254 if (!Future.IsValid())
2261 Future = Async(Execution, [
this]() {
2262 Predicate(FDoneDelegate::CreateRaw(
this, &FAsyncUntilDoneLatentCommand::Done));
2294 Future = TFuture<
void>();
2328 if (!Future.IsValid())
2335 Future = Async(Execution, [
this]() {
2369 Future = TFuture<
void>();
2436 DefinitionScopeStack.Push(RootDefinitionScope.ToSharedRef());
2445 const TSharedRef<FSpec>* SpecToRun = IdToSpecMap.Find(InParameters);
2446 if (SpecToRun !=
nullptr)
2448 for (int32 Index = 0; Index < (*SpecToRun)->Commands.Num(); ++Index)
2450 FAutomationTestFramework::GetInstance().EnqueueLatentCommand((*SpecToRun)->Commands[Index]);
2456 TArray<TSharedRef<FSpec>> Specs;
2457 IdToSpecMap.GenerateValueArray(Specs);
2459 for (int32 SpecIndex = 0; SpecIndex < Specs.Num(); SpecIndex++)
2461 for (int32 CommandIndex = 0; CommandIndex < Specs[SpecIndex]->Commands.Num(); ++CommandIndex)
2463 FAutomationTestFramework::GetInstance().EnqueueLatentCommand(Specs[SpecIndex]->Commands[CommandIndex]);
2484 if (TestId.StartsWith(TestName +
TEXT(
" ")))
2486 TestId = InTestName.RightChop(TestName.Len() + 1);
2489 const TSharedRef<FSpec>* Spec = IdToSpecMap.Find(TestId);
2490 if (Spec !=
nullptr)
2492 return (*Spec)->Filename;
2501 if (TestId.StartsWith(TestName +
TEXT(
" ")))
2503 TestId = InTestName.RightChop(TestName.Len() + 1);
2506 const TSharedRef<FSpec>* Spec = IdToSpecMap.Find(TestId);
2507 if (Spec !=
nullptr)
2509 return (*Spec)->LineNumber;
2515 virtual void GetTests(TArray<FString>& OutBeautifiedNames, TArray<FString>& OutTestCommands)
const override
2519 TArray<TSharedRef<FSpec>> Specs;
2520 IdToSpecMap.GenerateValueArray(Specs);
2522 for (int32 Index = 0; Index < Specs.Num(); Index++)
2524 OutTestCommands.Push(Specs[Index]->Id);
2525 OutBeautifiedNames.Push(Specs[Index]->Description);
2537 const TSharedRef<FSpecDefinitionScope> ParentScope = DefinitionScopeStack.Last();
2538 const TSharedRef<FSpecDefinitionScope> NewScope = MakeShareable(
new FSpecDefinitionScope());
2539 NewScope->Description = InDescription;
2540 ParentScope->Children.Push(NewScope);
2542 DefinitionScopeStack.Push(NewScope);
2546 DefinitionScopeStack.Pop();
2548 if (NewScope->It.Num() == 0 && NewScope->Children.Num() == 0)
2550 ParentScope->Children.Remove(NewScope);
2559 void xIt(
const FString& InDescription, EAsyncExecution Execution, TFunction<
void()> DoWork)
2564 void xIt(
const FString& InDescription, EAsyncExecution Execution,
const FTimespan& Timeout, TFunction<
void()> DoWork)
2579 void xLatentIt(
const FString& InDescription, EAsyncExecution Execution, TFunction<
void(
const FDoneDelegate&)> DoWork)
2584 void xLatentIt(
const FString& InDescription, EAsyncExecution Execution,
const FTimespan& Timeout, TFunction<
void(
const FDoneDelegate&)> DoWork)
2589 void It(
const FString& InDescription, TFunction<
void()> DoWork)
2591 const TSharedRef<FSpecDefinitionScope> CurrentScope = DefinitionScopeStack.Last();
2595 CurrentScope->It.Push(MakeShareable(
new FSpecIt(GetDescription(), GetId(), Stack[0].Filename, Stack[0].LineNumber, MakeShareable(
new FSingleExecuteLatentCommand(
this, DoWork, bEnableSkipIfError)))));
2599 void It(
const FString& InDescription, EAsyncExecution Execution, TFunction<
void()> DoWork)
2601 const TSharedRef<FSpecDefinitionScope> CurrentScope = DefinitionScopeStack.Last();
2605 CurrentScope->It.Push(MakeShareable(
new FSpecIt(GetDescription(), GetId(), Stack[0].Filename, Stack[0].LineNumber, MakeShareable(
new FAsyncLatentCommand(
this, Execution, DoWork, DefaultTimeout, bEnableSkipIfError)))));
2609 void It(
const FString& InDescription, EAsyncExecution Execution,
const FTimespan& Timeout, TFunction<
void()> DoWork)
2611 const TSharedRef<FSpecDefinitionScope> CurrentScope = DefinitionScopeStack.Last();
2615 CurrentScope->It.Push(MakeShareable(
new FSpecIt(GetDescription(), GetId(), Stack[0].Filename, Stack[0].LineNumber, MakeShareable(
new FAsyncLatentCommand(
this, Execution, DoWork, Timeout, bEnableSkipIfError)))));
2621 const TSharedRef<FSpecDefinitionScope> CurrentScope = DefinitionScopeStack.Last();
2625 CurrentScope->It.Push(MakeShareable(
new FSpecIt(GetDescription(), GetId(), Stack[0].Filename, Stack[0].LineNumber, MakeShareable(
new FUntilDoneLatentCommand(
this, DoWork, DefaultTimeout, bEnableSkipIfError)))));
2631 const TSharedRef<FSpecDefinitionScope> CurrentScope = DefinitionScopeStack.Last();
2635 CurrentScope->It.Push(MakeShareable(
new FSpecIt(GetDescription(), GetId(), Stack[0].Filename, Stack[0].LineNumber, MakeShareable(
new FUntilDoneLatentCommand(
this, DoWork, Timeout, bEnableSkipIfError)))));
2639 void LatentIt(
const FString& InDescription, EAsyncExecution Execution, TFunction<
void(
const FDoneDelegate&)> DoWork)
2641 const TSharedRef<FSpecDefinitionScope> CurrentScope = DefinitionScopeStack.Last();
2645 CurrentScope->It.Push(MakeShareable(
new FSpecIt(GetDescription(), GetId(), Stack[0].Filename, Stack[0].LineNumber, MakeShareable(
new FAsyncUntilDoneLatentCommand(
this, Execution, DoWork, DefaultTimeout, bEnableSkipIfError)))));
2649 void LatentIt(
const FString& InDescription, EAsyncExecution Execution,
const FTimespan& Timeout, TFunction<
void(
const FDoneDelegate&)> DoWork)
2651 const TSharedRef<FSpecDefinitionScope> CurrentScope = DefinitionScopeStack.Last();
2655 CurrentScope->It.Push(MakeShareable(
new FSpecIt(GetDescription(), GetId(), Stack[0].Filename, Stack[0].LineNumber, MakeShareable(
new FAsyncUntilDoneLatentCommand(
this, Execution, DoWork, Timeout, bEnableSkipIfError)))));
2696 const TSharedRef<FSpecDefinitionScope> CurrentScope = DefinitionScopeStack.Last();
2697 CurrentScope->BeforeEach.Push(MakeShareable(
new FSingleExecuteLatentCommand(
this, DoWork, bEnableSkipIfError)));
2700 void BeforeEach(EAsyncExecution Execution, TFunction<
void()> DoWork)
2702 const TSharedRef<FSpecDefinitionScope> CurrentScope = DefinitionScopeStack.Last();
2703 CurrentScope->BeforeEach.Push(MakeShareable(
new FAsyncLatentCommand(
this, Execution, DoWork, DefaultTimeout, bEnableSkipIfError)));
2708 const TSharedRef<FSpecDefinitionScope> CurrentScope = DefinitionScopeStack.Last();
2709 CurrentScope->BeforeEach.Push(MakeShareable(
new FAsyncLatentCommand(
this, Execution, DoWork, Timeout, bEnableSkipIfError)));
2714 const TSharedRef<FSpecDefinitionScope> CurrentScope = DefinitionScopeStack.Last();
2715 CurrentScope->BeforeEach.Push(MakeShareable(
new FUntilDoneLatentCommand(
this, DoWork, DefaultTimeout, bEnableSkipIfError)));
2720 const TSharedRef<FSpecDefinitionScope> CurrentScope = DefinitionScopeStack.Last();
2721 CurrentScope->BeforeEach.Push(MakeShareable(
new FUntilDoneLatentCommand(
this, DoWork, Timeout, bEnableSkipIfError)));
2726 const TSharedRef<FSpecDefinitionScope> CurrentScope = DefinitionScopeStack.Last();
2727 CurrentScope->BeforeEach.Push(MakeShareable(
new FAsyncUntilDoneLatentCommand(
this, Execution, DoWork, DefaultTimeout, bEnableSkipIfError)));
2732 const TSharedRef<FSpecDefinitionScope> CurrentScope = DefinitionScopeStack.Last();
2733 CurrentScope->BeforeEach.Push(MakeShareable(
new FAsyncUntilDoneLatentCommand(
this, Execution, DoWork, Timeout, bEnableSkipIfError)));
2741 void xAfterEach(EAsyncExecution Execution, TFunction<
void()> DoWork)
2773 const TSharedRef<FSpecDefinitionScope> CurrentScope = DefinitionScopeStack.Last();
2774 CurrentScope->AfterEach.Push(MakeShareable(
new FSingleExecuteLatentCommand(
this, DoWork)));
2777 void AfterEach(EAsyncExecution Execution, TFunction<
void()> DoWork)
2779 const TSharedRef<FSpecDefinitionScope> CurrentScope = DefinitionScopeStack.Last();
2780 CurrentScope->AfterEach.Push(MakeShareable(
new FAsyncLatentCommand(
this, Execution, DoWork, DefaultTimeout)));
2785 const TSharedRef<FSpecDefinitionScope> CurrentScope = DefinitionScopeStack.Last();
2786 CurrentScope->AfterEach.Push(MakeShareable(
new FAsyncLatentCommand(
this, Execution, DoWork, Timeout)));
2791 const TSharedRef<FSpecDefinitionScope> CurrentScope = DefinitionScopeStack.Last();
2792 CurrentScope->AfterEach.Push(MakeShareable(
new FUntilDoneLatentCommand(
this, DoWork, DefaultTimeout)));
2797 const TSharedRef<FSpecDefinitionScope> CurrentScope = DefinitionScopeStack.Last();
2798 CurrentScope->AfterEach.Push(MakeShareable(
new FUntilDoneLatentCommand(
this, DoWork, Timeout)));
2801 void LatentAfterEach(EAsyncExecution Execution, TFunction<
void(
const FDoneDelegate&)> DoWork)
2803 const TSharedRef<FSpecDefinitionScope> CurrentScope = DefinitionScopeStack.Last();
2804 CurrentScope->AfterEach.Push(MakeShareable(
new FAsyncUntilDoneLatentCommand(
this, Execution, DoWork, DefaultTimeout)));
2809 const TSharedRef<FSpecDefinitionScope> CurrentScope = DefinitionScopeStack.Last();
2810 CurrentScope->AfterEach.Push(MakeShareable(
new FAsyncUntilDoneLatentCommand(
this, Execution, DoWork, Timeout)));
2834 TArray<TSharedRef<FSpecDefinitionScope>> Stack;
2835 Stack.Push(RootDefinitionScope.ToSharedRef());
2837 TArray<TSharedRef<IAutomationLatentCommand>> BeforeEach;
2838 TArray<TSharedRef<IAutomationLatentCommand>> AfterEach;
2840 while (Stack.Num() > 0)
2842 const TSharedRef<FSpecDefinitionScope> Scope = Stack.Last();
2844 BeforeEach.Append(Scope->BeforeEach);
2845 AfterEach.Append(Scope->AfterEach);
2847 for (int32 ItIndex = 0; ItIndex < Scope->It.Num(); ItIndex++)
2849 TSharedRef<FSpecIt> It = Scope->It[ItIndex];
2851 TSharedRef<FSpec> Spec = MakeShareable(
new FSpec());
2853 Spec->Description = It->Description;
2854 Spec->Filename = It->Filename;
2855 Spec->LineNumber = It->LineNumber;
2856 Spec->Commands.Append(BeforeEach);
2857 Spec->Commands.Add(It->Command);
2859 for (int32 AfterEachIndex = AfterEach.Num() - 1; AfterEachIndex >= 0; AfterEachIndex--)
2861 Spec->Commands.Add(AfterEach[AfterEachIndex]);
2864 check(!IdToSpecMap.Contains(Spec->Id));
2865 IdToSpecMap.Add(Spec->Id, Spec);
2869 if (Scope->Children.Num() > 0)
2871 Stack.Append(Scope->Children);
2872 Scope->Children.Empty();
2876 while (Stack.Num() > 0 && Stack.Last()->Children.Num() == 0 && Stack.Last()->It.Num() == 0)
2878 const TSharedRef<FSpecDefinitionScope> PoppedScope = Stack.Pop();
2880 if (PoppedScope->BeforeEach.Num() > 0)
2882 BeforeEach.RemoveAt(BeforeEach.Num() - PoppedScope->BeforeEach.Num(), PoppedScope->BeforeEach.Num());
2885 if (PoppedScope->AfterEach.Num() > 0)
2887 AfterEach.RemoveAt(AfterEach.Num() - PoppedScope->AfterEach.Num(), PoppedScope->AfterEach.Num());
2893 RootDefinitionScope.Reset();
2894 DefinitionScopeStack.Reset();
2900 Description.Empty();
2901 IdToSpecMap.Empty();
2902 RootDefinitionScope.Reset();
2903 DefinitionScopeStack.Empty();
2912 Description.Add(InDescription);
2917 Description.RemoveAt(Description.Num() - 1);
2923 for (int32 Index = 0; Index < Description.Num(); ++Index)
2925 if (Description[Index].IsEmpty())
2930 if (CompleteDescription.IsEmpty())
2932 CompleteDescription = Description[Index];
2934 else if (FChar::IsWhitespace(CompleteDescription[CompleteDescription.Len() - 1]) || FChar::IsWhitespace(Description[Index][0]))
2936 CompleteDescription = CompleteDescription +
TEXT(
".") + Description[Index];
2940 CompleteDescription = FString::Printf(
TEXT(
"%s.%s"), *CompleteDescription, *Description[Index]);
2944 return CompleteDescription;
2949 if (Description.Last().EndsWith(
TEXT(
"]")))
2951 FString ItDescription = Description.Last();
2955 if (ItDescription.FindLastChar(
TEXT(
'['), StartingBraceIndex) && StartingBraceIndex != ItDescription
.Len() - 1)
2963 for (int32 Index = 0; Index < Description.Num(); ++Index)
2965 if (Description[Index].IsEmpty())
2970 if (CompleteId.IsEmpty())
2972 CompleteId = Description[Index];
2974 else if (FChar::IsWhitespace(CompleteId[CompleteId.Len() - 1]) || FChar::IsWhitespace(Description[Index][0]))
2976 CompleteId = CompleteId + Description[Index];
2980 CompleteId = FString::Printf(
TEXT(
"%s %s"), *CompleteId, *Description[Index]);
3000#define DEFINE_LATENT_AUTOMATION_COMMAND(CommandName) class
3001 CommandName : public IAutomationLatentCommand
3004 virtual ~CommandName()
3006 virtual bool Update() override; \
3007}
3009#define DEFINE_LATENT_AUTOMATION_COMMAND_ONE_PARAMETER(CommandName,ParamType,ParamName) class
3010 CommandName : public IAutomationLatentCommand
3013 CommandName(ParamType InputParam)
3014 : ParamName(InputParam)
3016 virtual ~CommandName()
3018 virtual bool Update() override;
3020 ParamType ParamName; \
3021}
3023#define DEFINE_LATENT_AUTOMATION_COMMAND_TWO_PARAMETER(CommandName,ParamType0,ParamName0,ParamType1,ParamName1) class
3024 CommandName : public IAutomationLatentCommand
3027 CommandName(ParamType0 InputParam0, ParamType1 InputParam1)
3028 : ParamName0(InputParam0)
3029 , ParamName1(InputParam1)
3031 virtual ~CommandName()
3033 virtual bool Update() override;
3035 ParamType0 ParamName0;
3036 ParamType1 ParamName1; \
3037}
3039#define DEFINE_LATENT_AUTOMATION_COMMAND_THREE_PARAMETER(CommandName,ParamType0,ParamName0,ParamType1,ParamName1,ParamType2,ParamName2) class
3040 CommandName : public IAutomationLatentCommand
3043 CommandName(ParamType0 InputParam0, ParamType1 InputParam1, ParamType2 InputParam2)
3044 : ParamName0(InputParam0)
3045 , ParamName1(InputParam1)
3046 , ParamName2(InputParam2)
3048 virtual ~CommandName()
3050 virtual bool Update() override;
3052 ParamType0 ParamName0;
3053 ParamType1 ParamName1;
3054 ParamType2 ParamName2; \
3055}
3057#define DEFINE_LATENT_AUTOMATION_COMMAND_FOUR_PARAMETER(CommandName,ParamType0,ParamName0,ParamType1,ParamName1,ParamType2,ParamName2,ParamType3,ParamName3) class
3058 CommandName : public IAutomationLatentCommand
3061 CommandName(ParamType0 InputParam0, ParamType1 InputParam1, ParamType2 InputParam2, ParamType3 InputParam3)
3062 : ParamName0(InputParam0)
3063 , ParamName1(InputParam1)
3064 , ParamName2(InputParam2)
3065 , ParamName3(InputParam3)
3067 virtual ~CommandName()
3069 virtual bool Update() override;
3071 ParamType0 ParamName0;
3072 ParamType1 ParamName1;
3073 ParamType2 ParamName2;
3074 ParamType3 ParamName3; \
3075}
3077#define DEFINE_LATENT_AUTOMATION_COMMAND_FIVE_PARAMETER(CommandName,ParamType0,ParamName0,ParamType1,ParamName1,ParamType2,ParamName2,ParamType3,ParamName3,ParamType4,ParamName4) class
3078 CommandName : public IAutomationLatentCommand
3081 CommandName(ParamType0 InputParam0, ParamType1 InputParam1, ParamType2 InputParam2, ParamType3 InputParam3, ParamType4 InputParam4)
3082 : ParamName0(InputParam0)
3083 , ParamName1(InputParam1)
3084 , ParamName2(InputParam2)
3085 , ParamName3(InputParam3)
3086 , ParamName4(InputParam4)
3088 virtual ~CommandName()
3090 virtual bool Update() override;
3092 ParamType0 ParamName0;
3093 ParamType1 ParamName1;
3094 ParamType2 ParamName2;
3095 ParamType3 ParamName3;
3096 ParamType4 ParamName4; \
3097}
3099#define DEFINE_EXPORTED_LATENT_AUTOMATION_COMMAND(EXPORT_API, CommandName) class
3100 EXPORT_API CommandName : public IAutomationLatentCommand
3103 virtual ~CommandName()
3105 virtual bool Update() override; \
3106}
3108#define DEFINE_EXPORTED_LATENT_AUTOMATION_COMMAND_ONE_PARAMETER(EXPORT_API, CommandName,ParamType,ParamName) class
3109 EXPORT_API CommandName : public IAutomationLatentCommand
3112 CommandName(ParamType InputParam)
3113 : ParamName(InputParam)
3115 virtual ~CommandName()
3117 virtual bool Update() override;
3119 ParamType ParamName; \
3120}
3122#define DEFINE_EXPORTED_LATENT_AUTOMATION_COMMAND_TWO_PARAMETER(EXPORT_API, CommandName,ParamType0,ParamName0,ParamType1,ParamName1) class
3123 EXPORT_API CommandName : public IAutomationLatentCommand
3126 CommandName(ParamType0 InputParam0, ParamType1 InputParam1)
3127 : ParamName0(InputParam0)
3128 , ParamName1(InputParam1)
3130 virtual ~CommandName()
3132 virtual bool Update() override;
3134 ParamType0 ParamName0;
3135 ParamType1 ParamName1; \
3136}
3138#define DEFINE_ENGINE_LATENT_AUTOMATION_COMMAND(CommandName)
3141#define DEFINE_ENGINE_LATENT_AUTOMATION_COMMAND_ONE_PARAMETER(CommandName,ParamType,ParamName)
3144#define DEFINE_EXPORTED_LATENT_AUTOMATION_COMMAND_WITH_RETRIES(EXPORT_API,CommandName,RetryCount,WaitTimeBetweenRuns) class
3145 EXPORT_API CommandName : public IAutomationLatentCommandWithRetriesAndDelays
3148 CommandName(int32 InRetryCount, double InWaitTimeBetweenRuns)
3149 : IAutomationLatentCommandWithRetriesAndDelays(#CommandName, InRetryCount, InWaitTimeBetweenRuns)
3151 virtual ~CommandName()
3153 virtual bool Execute() override;
3155}
3157#define DEFINE_EXPORTED_LATENT_AUTOMATION_COMMAND_WITH_RETRIES_ONE_PARAMETER(EXPORT_API,CommandName,RetryCount,WaitTimeBetweenRuns,ParamType,ParamName) class
3158 EXPORT_API CommandName : public IAutomationLatentCommandWithRetriesAndDelays
3161 CommandName(int32 InRetryCount, double InWaitTimeBetweenRuns, ParamType ParamName)
3162 : IAutomationLatentCommandWithRetriesAndDelays(#CommandName, InRetryCount, InWaitTimeBetweenRuns)
3163 , ParamName(ParamName)
3165 virtual ~CommandName()
3167 virtual bool Execute() override;
3169 ParamType ParamName; \
3170}
3172#define DEFINE_EXPORTED_LATENT_AUTOMATION_COMMAND_WITH_RETRIES_TWO_PARAMETERS(EXPORT_API,CommandName,RetryCount,WaitTimeBetweenRuns,ParamType0,ParamName0,ParamType1,ParamName1) class
3173 EXPORT_API CommandName : public IAutomationLatentCommandWithRetriesAndDelays
3176 CommandName(int32 InRetryCount, double InWaitTimeBetweenRuns, ParamType0 ParamName0, ParamType1 ParamName1)
3177 : IAutomationLatentCommandWithRetriesAndDelays(#CommandName, InRetryCount, InWaitTimeBetweenRuns)
3178 , ParamName0(ParamName0)
3179 , ParamName1(ParamName1)
3181 virtual ~CommandName()
3183 virtual bool Execute() override;
3185 ParamType0 ParamName0;
3186 ParamType1 ParamName1; \
3187}
3189#define DEFINE_EXPORTED_LATENT_AUTOMATION_COMMAND_WITH_RETRIES_THREE_PARAMETERS(EXPORT_API,CommandName,RetryCount,WaitTimeBetweenRuns,ParamType0,ParamName0,ParamType1,ParamName1,ParamType2,ParamName2) class
3190 EXPORT_API CommandName : public IAutomationLatentCommandWithRetriesAndDelays
3193 CommandName(int32 InRetryCount, double InWaitTimeBetweenRuns, ParamType0 ParamName0, ParamType1 ParamName1, ParamType2 ParamName2)
3194 : IAutomationLatentCommandWithRetriesAndDelays(#CommandName, InRetryCount, InWaitTimeBetweenRuns)
3195 , ParamName0(ParamName0)
3196 , ParamName1(ParamName1)
3197 , ParamName2(ParamName2)
3199 virtual ~CommandName()
3201 virtual bool Execute() override;
3203 ParamType0 ParamName0;
3204 ParamType1 ParamName1;
3205 ParamType2 ParamName2; \
3206}
3208#define DEFINE_EXPORTED_LATENT_AUTOMATION_COMMAND_WITH_RETRIES_FOUR_PARAMETERS(EXPORT_API,CommandName,RetryCount,WaitTimeBetweenRuns,ParamType0,ParamName0,ParamType1,ParamName1,ParamType2,ParamName2,ParamType3,ParamName3) class
3209 EXPORT_API CommandName : public IAutomationLatentCommandWithRetriesAndDelays
3212 CommandName(int32 InRetryCount, double InWaitTimeBetweenRuns, ParamType0 ParamName0, ParamType1 ParamName1, ParamType2 ParamName2, ParamType3 ParamName3)
3213 : IAutomationLatentCommandWithRetriesAndDelays(#CommandName, InRetryCount, InWaitTimeBetweenRuns)
3214 , ParamName0(ParamName0)
3215 , ParamName1(ParamName1)
3216 , ParamName2(ParamName2)
3217 , ParamName3(ParamName3)
3219 virtual ~CommandName()
3221 virtual bool Execute() override;
3223 ParamType0 ParamName0;
3224 ParamType1 ParamName1;
3225 ParamType2 ParamName2;
3226 ParamType3 ParamName3; \
3227}
3230#define ADD_LATENT_AUTOMATION_COMMAND(ClassDeclaration) FAutomationTestFramework::Get().EnqueueLatentCommand(MakeShareable(new ClassDeclaration));
3234#define START_NETWORK_AUTOMATION_COMMAND(ClassDeclaration) class
3235 F##ClassDeclaration : public IAutomationNetworkCommand \
3236{private
3238 int32 RoleIndex; public
3240 F##ClassDeclaration(int32 InRoleIndex) : RoleIndex(InRoleIndex) {}
3241 virtual ~F##ClassDeclaration() {}
3242 virtual uint32 GetRoleIndex() const override { return RoleIndex; }
3243 virtual void Run() override
3246#define END_NETWORK_AUTOMATION_COMMAND(ClassDeclaration,InRoleIndex) };
3247 FAutomationTestFramework::Get().EnqueueNetworkCommand(MakeShareable(new F##ClassDeclaration(InRoleIndex)));
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3262#define IMPLEMENT_SIMPLE_AUTOMATION_TEST_PRIVATE( TClass, TBaseClass, PrettyName, TFlags, FileName, LineNumber )
3263 class TClass : public TBaseClass
3266 TClass( const FString& InName )
3267 :TBaseClass( InName, false ) {
3268 static_assert((TFlags)&EAutomationTestFlags::ApplicationContextMask, "AutomationTest has no application flag. It shouldn't run. See AutomationTest.h.");
3269 static_assert( (((TFlags)&EAutomationTestFlags::FilterMask) == EAutomationTestFlags::SmokeFilter) ||
3270 (((TFlags)&EAutomationTestFlags::FilterMask) == EAutomationTestFlags::EngineFilter) ||
3271 (((TFlags)&EAutomationTestFlags::FilterMask) == EAutomationTestFlags::ProductFilter) ||
3272 (((TFlags)&EAutomationTestFlags::FilterMask) == EAutomationTestFlags::PerfFilter) ||
3273 (((TFlags)&EAutomationTestFlags::FilterMask) == EAutomationTestFlags::StressFilter) ||
3274 (((TFlags)&EAutomationTestFlags::FilterMask) == EAutomationTestFlags::NegativeFilter),
3275 "All AutomationTests must have exactly 1 filter type specified. See AutomationTest.h.");
3277 virtual uint32 GetTestFlags() const override { return TFlags; }
3278 virtual bool IsStressTest() const { return false; }
3279 virtual uint32 GetRequiredDeviceNum() const override { return 1
; }
3280 virtual FString GetTestSourceFileName() const override { return FileName; }
3281 virtual int32 GetTestSourceFileLine() const override { return LineNumber; }
3283 virtual void GetTests(TArray<FString>& OutBeautifiedNames, TArray <FString>& OutTestCommands) const override
3285 OutBeautifiedNames.Add(PrettyName);
3286 OutTestCommands.Add(FString());
3288 virtual bool RunTest(const FString& Parameters) override;
3289 virtual FString GetBeautifiedTestName() const override { return PrettyName; }
3294#define IMPLEMENT_COMPLEX_AUTOMATION_TEST_PRIVATE( TClass, TBaseClass, PrettyName, TFlags, FileName, LineNumber )
3295 class TClass : public TBaseClass
3298 TClass( const FString& InName )
3299 :TBaseClass( InName, true ) {
3300 static_assert((TFlags)&EAutomationTestFlags::ApplicationContextMask, "AutomationTest has no application flag. It shouldn't run. See AutomationTest.h.");
3301 static_assert( (((TFlags)&EAutomationTestFlags::FilterMask) == EAutomationTestFlags::SmokeFilter) ||
3302 (((TFlags)&EAutomationTestFlags::FilterMask) == EAutomationTestFlags::EngineFilter) ||
3303 (((TFlags)&EAutomationTestFlags::FilterMask) == EAutomationTestFlags::ProductFilter) ||
3304 (((TFlags)&EAutomationTestFlags::FilterMask) == EAutomationTestFlags::PerfFilter) ||
3305 (((TFlags)&EAutomationTestFlags::FilterMask) == EAutomationTestFlags::StressFilter) ||
3306 (((TFlags)&EAutomationTestFlags::FilterMask) == EAutomationTestFlags::NegativeFilter),
3307 "All AutomationTests must have exactly 1 filter type specified. See AutomationTest.h.");
3309 virtual uint32 GetTestFlags() const override { return ((TFlags) & ~(EAutomationTestFlags::SmokeFilter)); }
3310 virtual bool IsStressTest() const { return true; }
3311 virtual uint32 GetRequiredDeviceNum() const override { return 1
; }
3312 virtual FString GetTestSourceFileName() const override { return FileName; }
3313 virtual int32 GetTestSourceFileLine() const override { return LineNumber; }
3315 virtual void GetTests(TArray<FString>& OutBeautifiedNames, TArray <FString>& OutTestCommands) const override;
3316 virtual bool RunTest(const FString& Parameters) override;
3317 virtual FString GetBeautifiedTestName() const override { return PrettyName; }
3320#define IMPLEMENT_NETWORKED_AUTOMATION_TEST_PRIVATE(TClass, TBaseClass, PrettyName, TFlags, NumParticipants, FileName, LineNumber)
3321 class TClass : public TBaseClass
3324 TClass( const FString& InName )
3325 :TBaseClass( InName, false ) {
3326 static_assert((TFlags)&EAutomationTestFlags::ApplicationContextMask, "AutomationTest has no application flag. It shouldn't run. See AutomationTest.h.");
3327 static_assert( (((TFlags)&EAutomationTestFlags::FilterMask) == EAutomationTestFlags::SmokeFilter) ||
3328 (((TFlags)&EAutomationTestFlags::FilterMask) == EAutomationTestFlags::EngineFilter) ||
3329 (((TFlags)&EAutomationTestFlags::FilterMask) == EAutomationTestFlags::ProductFilter) ||
3330 (((TFlags)&EAutomationTestFlags::FilterMask) == EAutomationTestFlags::PerfFilter) ||
3331 (((TFlags)&EAutomationTestFlags::FilterMask) == EAutomationTestFlags::StressFilter) ||
3332 (((TFlags)&EAutomationTestFlags::FilterMask) == EAutomationTestFlags::NegativeFilter),
3333 "All AutomationTests must have exactly 1 filter type specified. See AutomationTest.h.");
3335 virtual uint32 GetTestFlags() const override { return ((TFlags) & ~(EAutomationTestFlags::EditorContext | EAutomationTestFlags::CommandletContext | EAutomationTestFlags::SmokeFilter)); }
3336 virtual uint32 GetRequiredDeviceNum() const override { return NumParticipants; }
3337 virtual FString GetTestSourceFileName() const override { return FileName; }
3338 virtual int32 GetTestSourceFileLine() const override { return LineNumber; }
3340 virtual void GetTests(TArray<FString>& OutBeautifiedNames, TArray <FString>& OutTestCommands) const override
3342 OutBeautifiedNames.Add(PrettyName);
3343 OutTestCommands.Add(FString());
3345 virtual bool RunTest(const FString& Parameters) override;
3346 virtual FString GetBeautifiedTestName() const override { return PrettyName; }
3349#define IMPLEMENT_BDD_AUTOMATION_TEST_PRIVATE( TClass, PrettyName, TFlags, FileName, LineNumber )
3350 class TClass : public FBDDAutomationTestBase
3353 TClass( const FString& InName )
3354 :FBDDAutomationTestBase( InName, false ) {
3355 static_assert((TFlags)&EAutomationTestFlags::ApplicationContextMask, "AutomationTest has no application flag. It shouldn't run. See AutomationTest.h.");
3356 static_assert( (((TFlags)&EAutomationTestFlags::FilterMask) == EAutomationTestFlags::SmokeFilter) ||
3357 (((TFlags)&EAutomationTestFlags::FilterMask) == EAutomationTestFlags::EngineFilter) ||
3358 (((TFlags)&EAutomationTestFlags::FilterMask) == EAutomationTestFlags::ProductFilter) ||
3359 (((TFlags)&EAutomationTestFlags::FilterMask) == EAutomationTestFlags::PerfFilter) ||
3360 (((TFlags)&EAutomationTestFlags::FilterMask) == EAutomationTestFlags::StressFilter) ||
3361 (((TFlags)&EAutomationTestFlags::FilterMask) == EAutomationTestFlags::NegativeFilter),
3362 "All AutomationTests must have exactly 1 filter type specified. See AutomationTest.h.");
3364 virtual uint32 GetTestFlags() const override { return TFlags; }
3365 virtual bool IsStressTest() const { return false; }
3366 virtual uint32 GetRequiredDeviceNum() const override { return 1
; }
3367 virtual FString GetTestSourceFileName() const override { return FileName; }
3368 virtual int32 GetTestSourceFileLine() const override { return LineNumber; }
3370 virtual bool RunTest(const FString& Parameters) override;
3371 virtual FString GetBeautifiedTestName() const override { return PrettyName; }
3376#define DEFINE_SPEC_PRIVATE( TClass, PrettyName, TFlags, FileName, LineNumber )
3377 class TClass : public FAutomationSpecBase
3380 TClass( const FString& InName )
3381 : FAutomationSpecBase( InName, false ) {
3382 static_assert((TFlags)&EAutomationTestFlags::ApplicationContextMask, "AutomationTest has no application flag. It shouldn't run. See AutomationTest.h.");
3383 static_assert( (((TFlags)&EAutomationTestFlags::FilterMask) == EAutomationTestFlags::SmokeFilter) ||
3384 (((TFlags)&EAutomationTestFlags::FilterMask) == EAutomationTestFlags::EngineFilter) ||
3385 (((TFlags)&EAutomationTestFlags::FilterMask) == EAutomationTestFlags::ProductFilter) ||
3386 (((TFlags)&EAutomationTestFlags::FilterMask) == EAutomationTestFlags::PerfFilter) ||
3387 (((TFlags)&EAutomationTestFlags::FilterMask) == EAutomationTestFlags::StressFilter) ||
3388 (((TFlags)&EAutomationTestFlags::FilterMask) == EAutomationTestFlags::NegativeFilter),
3389 "All AutomationTests must have exactly 1 filter type specified. See AutomationTest.h.");
3391 virtual uint32 GetTestFlags() const override { return TFlags; }
3392 using FAutomationSpecBase::GetTestSourceFileName;
3393 virtual FString GetTestSourceFileName() const override { return FileName; }
3394 using FAutomationSpecBase::GetTestSourceFileLine;
3395 virtual int32 GetTestSourceFileLine() const override { return LineNumber; }
3396 virtual FString GetTestSourceFileName(const FString&) const override { return GetTestSourceFileName(); }
3397 virtual int32 GetTestSourceFileLine(const FString&) const override { return GetTestSourceFileLine(); }
3399 virtual FString GetBeautifiedTestName() const override { return PrettyName; }
3400 virtual void Define() override;
3403#define BEGIN_DEFINE_SPEC_PRIVATE( TClass, PrettyName, TFlags, FileName, LineNumber )
3404 class TClass : public FAutomationSpecBase
3407 TClass( const FString& InName )
3408 : FAutomationSpecBase( InName, false ) {
3409 static_assert((TFlags)&EAutomationTestFlags::ApplicationContextMask, "AutomationTest has no application flag. It shouldn't run. See AutomationTest.h.");
3410 static_assert( (((TFlags)&EAutomationTestFlags::FilterMask) == EAutomationTestFlags::SmokeFilter) ||
3411 (((TFlags)&EAutomationTestFlags::FilterMask) == EAutomationTestFlags::EngineFilter) ||
3412 (((TFlags)&EAutomationTestFlags::FilterMask) == EAutomationTestFlags::ProductFilter) ||
3413 (((TFlags)&EAutomationTestFlags::FilterMask) == EAutomationTestFlags::PerfFilter) ||
3414 (((TFlags)&EAutomationTestFlags::FilterMask) == EAutomationTestFlags::StressFilter) ||
3415 (((TFlags)&EAutomationTestFlags::FilterMask) == EAutomationTestFlags::NegativeFilter),
3416 "All AutomationTests must have exactly 1 filter type specified. See AutomationTest.h.");
3418 virtual uint32 GetTestFlags() const override { return TFlags; }
3419 using FAutomationSpecBase::GetTestSourceFileName;
3420 virtual FString GetTestSourceFileName() const override { return FileName; }
3421 using FAutomationSpecBase::GetTestSourceFileLine;
3422 virtual int32 GetTestSourceFileLine() const override { return LineNumber; }
3424 virtual FString GetBeautifiedTestName() const override { return PrettyName; }
3425 virtual void Define() override;
3428 #define IMPLEMENT_SIMPLE_AUTOMATION_TEST( TClass, PrettyName, TFlags )
3429 IMPLEMENT_SIMPLE_AUTOMATION_TEST_PRIVATE(TClass, FAutomationTestBase, PrettyName, TFlags, __FILE__, __LINE__)
3432 TClass TClass##AutomationTestInstance( TEXT(#TClass) );
3434 #define IMPLEMENT_COMPLEX_AUTOMATION_TEST( TClass, PrettyName, TFlags )
3435 IMPLEMENT_COMPLEX_AUTOMATION_TEST_PRIVATE(TClass, FAutomationTestBase, PrettyName, TFlags, __FILE__, __LINE__)
3438 TClass TClass##AutomationTestInstance( TEXT(#TClass) );
3440 #define IMPLEMENT_COMPLEX_AUTOMATION_CLASS( TClass, PrettyName, TFlags )
3441 IMPLEMENT_COMPLEX_AUTOMATION_TEST_PRIVATE(TClass, FAutomationTestBase, PrettyName, TFlags, __FILE__, __LINE__)
3442 #define IMPLEMENT_NETWORKED_AUTOMATION_TEST(TClass, PrettyName, TFlags, NumParticipants)
3443 IMPLEMENT_NETWORKED_AUTOMATION_TEST_PRIVATE(TClass, FAutomationTestBase, PrettyName, TFlags, NumParticipants, __FILE__, __LINE__)
3446 TClass TClass##AutomationTestInstance( TEXT(#TClass) );
3449 #define IMPLEMENT_CUSTOM_SIMPLE_AUTOMATION_TEST( TClass, TBaseClass, PrettyName, TFlags )
3450 IMPLEMENT_SIMPLE_AUTOMATION_TEST_PRIVATE(TClass, TBaseClass, PrettyName, TFlags, __FILE__, __LINE__)
3453 TClass TClass##AutomationTestInstance( TEXT(#TClass) );
3456 #define IMPLEMENT_CUSTOM_COMPLEX_AUTOMATION_TEST( TClass, TBaseClass, PrettyName, TFlags )
3457 IMPLEMENT_COMPLEX_AUTOMATION_TEST_PRIVATE(TClass, TBaseClass, PrettyName, TFlags, __FILE__, __LINE__)
3460 TClass TClass##AutomationTestInstance( TEXT(#TClass) );
3463 #define IMPLEMENT_BDD_AUTOMATION_TEST( TClass, PrettyName, TFlags )
3464 IMPLEMENT_BDD_AUTOMATION_TEST_PRIVATE(TClass, PrettyName, TFlags, __FILE__, __LINE__)
3467 TClass TClass##AutomationTestInstance( TEXT(#TClass) );
3470 #define DEFINE_SPEC( TClass, PrettyName, TFlags )
3471 DEFINE_SPEC_PRIVATE(TClass, PrettyName, TFlags, __FILE__, __LINE__)
3474 TClass TClass##AutomationSpecInstance( TEXT(#TClass) );
3477 #define BEGIN_DEFINE_SPEC( TClass, PrettyName, TFlags )
3478 BEGIN_DEFINE_SPEC_PRIVATE(TClass, PrettyName, TFlags, __FILE__, __LINE__)
3480 #define END_DEFINE_SPEC( TClass )
3484 TClass TClass##AutomationSpecInstance( TEXT(#TClass) );
3488
3491
3493
3494
3495
3498 #define IMPLEMENT_SIMPLE_AUTOMATION_TEST( TClass, PrettyName, TFlags )
3500 #define IMPLEMENT_COMPLEX_AUTOMATION_TEST( TClass, PrettyName, TFlags )
3502 #define IMPLEMENT_NETWORKED_AUTOMATION_TEST(TClass, PrettyName, TFlags, NumParticipants)
3505 #define IMPLEMENT_CUSTOM_SIMPLE_AUTOMATION_TEST( TClass, TBaseClass, PrettyName, TFlags )
3507 #define IMPLEMENT_CUSTOM_COMPLEX_AUTOMATION_TEST( TClass, TBaseClass, PrettyName, TFlags )
3509 #define IMPLEMENT_BDD_AUTOMATION_TEST(TClass, PrettyName, TFlags)
3511 #define DEFINE_SPEC(TClass, PrettyName, TFlags)
3513 #define BEGIN_DEFINE_SPEC(TClass, PrettyName, TFlags)
3515 #define END_DEFINE_SPEC(TClass)
3519
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3547#define UTEST_EQUAL(What, Actual, Expected)
3548 if (!TestEqual(What, Actual, Expected))
3553#define UTEST_EQUAL_TOLERANCE(What, Actual, Expected, Tolerance)
3554 if (!TestEqual(What, Actual, Expected, Tolerance))
3559#define UTEST_EQUAL_INSENSITIVE(What, Actual, Expected)
3560 if (!TestEqualInsensitive(What, Actual, Expected))
3565#define UTEST_NOT_EQUAL(What, Actual, Expected)
3566 if (!TestNotEqual(What, Actual, Expected))
3571#define UTEST_SAME(What, Actual, Expected)
3572 if (!TestSame(What, Actual, Expected))
3577#define UTEST_NOT_SAME(What, Actual, Expected)
3578 if (!TestNotSame(What, Actual, Expected))
3583#define UTEST_TRUE(What, Value)
3584 if (!TestTrue(What, Value))
3589#define UTEST_FALSE(What, Value)
3590 if (!TestFalse(What, Value))
3595#define UTEST_VALID(What, SharedPointer)
3596 if (!TestValid(What, SharedPointer))
3601#define UTEST_INVALID(What, SharedPointer)
3602 if (!TestInvalid(What, SharedPointer))
3607#define UTEST_NULL(What, Pointer)
3608 if (!TestNull(What, Pointer))
3613#define UTEST_NOT_NULL(What, Pointer)
3614 if (!TestNotNull(What, Pointer))
3623
3624
3625
3640 return LatentPredicate();
3676 FUntilCommand(TFunction<
bool()> InCallback, TFunction<
bool()> InTimeoutCallback,
float InTimeout = 5.0f)
3721 UE_LOG(LogLatentCommands, Error,
TEXT(
"%s"), *ErrorMessage);
3735 FString ErrorMessageText =
FString::Printf(
TEXT(
"%s has failed due to exceeding the max allowed run time of %f seconds. \
3736This may be due to an error, or having a single command attempt to do too many things. If this is not due to an error, consider breaking \
3764 UE_LOG(LogLatentCommands, Log,
TEXT(
"%s Executing Attempt %d."), *GetTestAndCommandName(), CurrentIteration);
3768 UE_LOG(LogLatentCommands, Log,
TEXT(
"%s Executing Attempt %d of %d."), *GetTestAndCommandName(), CurrentIteration, MaxRetries);
3774 UE_LOG(LogLatentCommands, Log,
TEXT(
"%s Completed Successfully, total run time: %f seconds."), *GetTestAndCommandName(), GetCurrentRunTime());
3799 ,
MaxRetries(InMaxRetries < 0 ? 0 : InMaxRetries)
3810 UE_LOG(LogLatentCommands, Warning,
TEXT(
"%s has been set to Unlimited retries. Will be using MaxTotalRunTime to prevent \
3811running forever. Default time is set at 300 seconds. If this is not enough time, make sure to override this in your Execute() loop."),*GetTestAndCommandName());
3845 return FString::Printf(
TEXT(
"Test: %s - Command: %s - "), *GetCurrentTest()->GetTestFullName(), *CommandClassName);
#define IMPLEMENT_BDD_AUTOMATION_TEST_PRIVATE(TClass, PrettyName, TFlags, FileName, LineNumber)
#define DEFINE_EXPORTED_LATENT_AUTOMATION_COMMAND_ONE_PARAMETER(EXPORT_API, CommandName, ParamType, ParamName)
#define IMPLEMENT_COMPLEX_AUTOMATION_TEST_PRIVATE(TClass, TBaseClass, PrettyName, TFlags, FileName, LineNumber)
#define DEFINE_SPEC_PRIVATE(TClass, PrettyName, TFlags, FileName, LineNumber)
#define SAFE_GETSTACK(VariableName, IgnoreCount, MaxDepth)
DEFINE_LOG_CATEGORY_STATIC(LogLatentCommands, Log, All)
#define DEFINE_EXPORTED_LATENT_AUTOMATION_COMMAND(EXPORT_API, CommandName)
#define IMPLEMENT_SIMPLE_AUTOMATION_TEST_PRIVATE(TClass, TBaseClass, PrettyName, TFlags, FileName, LineNumber)
#define IMPLEMENT_NETWORKED_AUTOMATION_TEST_PRIVATE(TClass, TBaseClass, PrettyName, TFlags, NumParticipants, FileName, LineNumber)
#define BEGIN_DEFINE_SPEC_PRIVATE(TClass, PrettyName, TFlags, FileName, LineNumber)
#define WITH_AUTOMATION_WORKER
#define UE_DEPRECATED(Version, Message)
#define DECLARE_MULTICAST_DELEGATE_TwoParams(DelegateName, Param1Type, Param2Type)
#define DECLARE_DELEGATE(DelegateName)
#define DECLARE_DELEGATE_TwoParams(DelegateName, Param1Type, Param2Type)
#define DECLARE_DELEGATE_ThreeParams(DelegateName, Param1Type, Param2Type, Param3Type)
#define DECLARE_MULTICAST_DELEGATE_OneParam(DelegateName, Param1Type)
EAutomationComparisonToleranceLevel
#define LLM_SCOPE_BYNAME(...)
#define UE_KINDA_SMALL_NUMBER
FWindowsCriticalSection FCriticalSection
const bool bSkipIfErrored
FAsyncLatentCommand(FAutomationSpecBase *const InSpec, EAsyncExecution InExecution, TFunction< void()> InPredicate, const FTimespan &InTimeout, bool bInSkipIfErrored=false)
virtual ~FAsyncLatentCommand()
const TFunction< void()> Predicate
virtual bool Update() override
FAutomationSpecBase *const Spec
const EAsyncExecution Execution
virtual ~FAsyncUntilDoneLatentCommand()
FAutomationSpecBase *const Spec
const EAsyncExecution Execution
const bool bSkipIfErrored
FAsyncUntilDoneLatentCommand(FAutomationSpecBase *const InSpec, EAsyncExecution InExecution, TFunction< void(const FDoneDelegate &)> InPredicate, const FTimespan &InTimeout, bool bInSkipIfErrored=false)
virtual bool Update() override
const TFunction< void(const FDoneDelegate &) Predicate)
const bool bSkipIfErrored
virtual ~FSingleExecuteLatentCommand()
const TFunction< void()> Predicate
const FAutomationSpecBase *const Spec
FSingleExecuteLatentCommand(const FAutomationSpecBase *const InSpec, TFunction< void()> InPredicate, bool bInSkipIfErrored=false)
virtual bool Update() override
virtual ~FUntilDoneLatentCommand()
FAutomationSpecBase *const Spec
const TFunction< void(const FDoneDelegate &) Predicate)
virtual bool Update() override
FUntilDoneLatentCommand(FAutomationSpecBase *const InSpec, TFunction< void(const FDoneDelegate &)> InPredicate, const FTimespan &InTimeout, bool bInSkipIfErrored=false)
const bool bSkipIfErrored
void xLatentIt(const FString &InDescription, const FTimespan &Timeout, TFunction< void(const FDoneDelegate &)> DoWork)
void xLatentBeforeEach(EAsyncExecution Execution, const FTimespan &Timeout, TFunction< void(const FDoneDelegate &)> DoWork)
void xIt(const FString &InDescription, EAsyncExecution Execution, TFunction< void()> DoWork)
void xLatentIt(const FString &InDescription, EAsyncExecution Execution, TFunction< void(const FDoneDelegate &)> DoWork)
virtual FString GetTestSourceFileName(const FString &InTestName) const override
void LatentIt(const FString &InDescription, EAsyncExecution Execution, TFunction< void(const FDoneDelegate &)> DoWork)
void xLatentIt(const FString &InDescription, TFunction< void(const FDoneDelegate &)> DoWork)
void LatentIt(const FString &InDescription, TFunction< void(const FDoneDelegate &)> DoWork)
void LatentAfterEach(TFunction< void(const FDoneDelegate &)> DoWork)
void xLatentIt(const FString &InDescription, EAsyncExecution Execution, const FTimespan &Timeout, TFunction< void(const FDoneDelegate &)> DoWork)
void LatentAfterEach(const FTimespan &Timeout, TFunction< void(const FDoneDelegate &)> DoWork)
void PopDescription(const FString &InDescription)
void xBeforeEach(EAsyncExecution Execution, TFunction< void()> DoWork)
void xLatentAfterEach(const FTimespan &Timeout, TFunction< void(const FDoneDelegate &)> DoWork)
void xIt(const FString &InDescription, TFunction< void()> DoWork)
void xLatentAfterEach(TFunction< void(const FDoneDelegate &)> DoWork)
void xLatentAfterEach(EAsyncExecution Execution, const FTimespan &Timeout, TFunction< void(const FDoneDelegate &)> DoWork)
FString GetDescription() const
void xLatentAfterEach(EAsyncExecution Execution, TFunction< void(const FDoneDelegate &)> DoWork)
TArray< FString > Description
void LatentBeforeEach(const FTimespan &Timeout, TFunction< void(const FDoneDelegate &)> DoWork)
void LatentAfterEach(EAsyncExecution Execution, const FTimespan &Timeout, TFunction< void(const FDoneDelegate &)> DoWork)
void xBeforeEach(TFunction< void()> DoWork)
FAutomationSpecBase(const FString &InName, const bool bInComplexTask)
void AfterEach(TFunction< void()> DoWork)
void BeforeEach(EAsyncExecution Execution, TFunction< void()> DoWork)
virtual int32 GetTestSourceFileLine(const FString &InTestName) const override
void LatentIt(const FString &InDescription, const FTimespan &Timeout, TFunction< void(const FDoneDelegate &)> DoWork)
void It(const FString &InDescription, TFunction< void()> DoWork)
TMap< FString, TSharedRef< FSpec > > IdToSpecMap
void EnsureDefinitions() const
void xAfterEach(EAsyncExecution Execution, TFunction< void()> DoWork)
void xAfterEach(EAsyncExecution Execution, const FTimespan &Timeout, TFunction< void()> DoWork)
void AfterEach(EAsyncExecution Execution, TFunction< void()> DoWork)
void It(const FString &InDescription, EAsyncExecution Execution, TFunction< void()> DoWork)
void xLatentBeforeEach(const FTimespan &Timeout, TFunction< void(const FDoneDelegate &)> DoWork)
void xLatentBeforeEach(EAsyncExecution Execution, TFunction< void(const FDoneDelegate &)> DoWork)
void xIt(const FString &InDescription, EAsyncExecution Execution, const FTimespan &Timeout, TFunction< void()> DoWork)
TSharedPtr< FSpecDefinitionScope > RootDefinitionScope
void LatentAfterEach(EAsyncExecution Execution, TFunction< void(const FDoneDelegate &)> DoWork)
void xBeforeEach(EAsyncExecution Execution, const FTimespan &Timeout, TFunction< void()> DoWork)
virtual bool RunTest(const FString &InParameters) override
void xAfterEach(TFunction< void()> DoWork)
void PushDescription(const FString &InDescription)
void LatentIt(const FString &InDescription, EAsyncExecution Execution, const FTimespan &Timeout, TFunction< void(const FDoneDelegate &)> DoWork)
virtual uint32 GetRequiredDeviceNum() const override
void It(const FString &InDescription, EAsyncExecution Execution, const FTimespan &Timeout, TFunction< void()> DoWork)
void LatentBeforeEach(TFunction< void(const FDoneDelegate &)> DoWork)
void LatentBeforeEach(EAsyncExecution Execution, TFunction< void(const FDoneDelegate &)> DoWork)
void xLatentBeforeEach(TFunction< void(const FDoneDelegate &)> DoWork)
void BeforeEach(EAsyncExecution Execution, const FTimespan &Timeout, TFunction< void()> DoWork)
void LatentBeforeEach(EAsyncExecution Execution, const FTimespan &Timeout, TFunction< void(const FDoneDelegate &)> DoWork)
virtual void GetTests(TArray< FString > &OutBeautifiedNames, TArray< FString > &OutTestCommands) const override
void AfterEach(EAsyncExecution Execution, const FTimespan &Timeout, TFunction< void()> DoWork)
virtual bool IsStressTest() const
TArray< TSharedRef< FSpecDefinitionScope > > DefinitionScopeStack
void BeforeEach(TFunction< void()> DoWork)
void Describe(const FString &InDescription, TFunction< void()> DoWork)
void xDescribe(const FString &InDescription, TFunction< void()> DoWork)
bool TestEqual(const TCHAR *What, const FString &Actual, const FString &Expected)
bool TestNull(const TCHAR *What, const void *Pointer)
bool TestEqual(const TCHAR *What, const int32 Actual, const int32 Expected)
virtual uint32 GetRequiredDeviceNum() const =0
bool TestEqual(const TCHAR *What, const FString &Actual, const TCHAR *Expected)
bool TestEqual(const TCHAR *What, const TCHAR *Actual, const FString &Expected)
bool TestNotEqual(const TCHAR *Description, const ValueType &Actual, const ValueType &Expected)
FAutomationTestExecutionInfo ExecutionInfo
virtual void AddTelemetryData(const FString &DataPoint, double Measurement, const FString &Context=TEXT(""))
bool TestNotSame(const TCHAR *Description, const ValueType &Actual, const ValueType &Expected)
bool TestSame(const FString &Description, const ValueType &Actual, const ValueType &Expected)
virtual bool SuppressLogWarnings()
TArray< FAutomationExpectedMessage > ExpectedMessages
bool HasMetExpectedMessages(ELogVerbosity::Type VerbosityType=ELogVerbosity::All)
virtual bool SuppressLogErrors()
FString GetTestContext() const
virtual FString GetBeautifiedTestName() const =0
bool TestEqual(const FString &What, const int32 Actual, const int32 Expected)
static bool LogCategoryMatchesSeverityInclusive(ELogVerbosity::Type Actual, ELogVerbosity::Type MaximumVerbosity)
virtual void SetTestContext(FString Context)
virtual void AddTelemetryData(const TMap< FString, double > &ValuePairs, const FString &Context=TEXT(""))
bool IsExpectedMessage(const FString &Message, const ELogVerbosity::Type &Verbosity=ELogVerbosity::All)
virtual FString GetTestSourceFileName() const
bool TestEqual(const TCHAR *What, const float Actual, const float Expected, float Tolerance=UE_KINDA_SMALL_NUMBER)
bool bRunOnSeparateThread
virtual void SetTelemetryStorage(const FString &StorageName)
FORCEINLINE void AddCommand(IAutomationLatentCommand *NewCommand)
bool TestNotSame(const FString &Description, const ValueType &Actual, const ValueType &Expected)
bool TestEqual(const TCHAR *What, const FColor Actual, const FColor Expected)
bool TestNotNull(const FString &What, const ValueType *Pointer)
const bool IsComplexTask() const
bool TestNull(const FString &What, const void *Pointer)
bool TestSame(const TCHAR *Description, const ValueType &Actual, const ValueType &Expected)
virtual void GetTests(TArray< FString > &OutBeautifiedNames, TArray< FString > &OutTestCommands) const =0
bool TestInvalid(const FString &Description, const TSharedPtr< ValueType > &SharedPointer)
bool GetLastExecutionSuccessState()
bool TestValid(const TCHAR *Description, const TSharedPtr< ValueType > &SharedPointer)
bool TestEqual(const TCHAR *What, const FVector Actual, const FVector Expected, float Tolerance=UE_KINDA_SMALL_NUMBER)
bool TestEqual(const FString &What, const double Actual, const double Expected, double Tolerance=UE_KINDA_SMALL_NUMBER)
virtual void AddEvent(const FAutomationEvent &InEvent, int32 StackOffset=0, bool bCaptureStack=false)
bool TestTrue(const FString &What, bool Value)
virtual bool RunTest(const FString &Parameters)=0
FString GetTestName() const
bool TestEqual(const FString &What, const TCHAR *Actual, const FString &Expected)
bool TestEqual(const TCHAR *What, const int64 Actual, const int64 Expected)
bool HasMetExpectedErrors()
bool TestEqual(const FString &What, const FString &Actual, const FString &Expected)
virtual FString GetTestOpenCommand(const FString &Parameter) const
virtual void AddErrorS(const FString &InError, const FString &InFilename, int32 InLineNumber)
void GenerateTestNames(TArray< FAutomationTestInfo > &TestInfo) const
virtual int32 GetTestSourceFileLine(const FString &InTestName) const
virtual void AddAnalyticsItem(const FString &InAnalyticsItem)
const bool IsRanOnSeparateThread() const
bool TestEqual(const TCHAR *What, const FLinearColor Actual, const FLinearColor Expected)
bool TestEqual(const FString &What, const FColor Actual, const FColor Expected)
virtual FString GetTestSourceFileName(const FString &InTestName) const
bool TestTrue(const TCHAR *What, bool Value)
void GetExecutionInfo(FAutomationTestExecutionInfo &OutInfo) const
virtual bool SuppressLogs()
virtual FString GetTestAssetPath(const FString &Parameter) const
void ClearExecutionInfo()
bool TestFalse(const FString &What, bool Value)
bool TestFalse(const TCHAR *What, bool Value)
bool TestEqual(const FString &What, const FVector Actual, const FVector Expected, float Tolerance=UE_KINDA_SMALL_NUMBER)
uint32 ExtractAutomationTestFlags(FString InTagNotation)
virtual int32 GetTestSourceFileLine() const
bool TestEqualInsensitive(const TCHAR *What, const TCHAR *Actual, const TCHAR *Expected)
void AddExpectedMessage(FString ExpectedPatternString, EAutomationExpectedMessageFlags::MatchType CompareType=EAutomationExpectedMessageFlags::Contains, int32 Occurrences=1)
FAutomationTestBase(const FString &InName, const bool bInComplexTask)
virtual void AddWarning(const FString &InWarning, int32 StackOffset=0)
void PushContext(const FString &Context)
bool TestEqual(const TCHAR *What, const FRotator Actual, const FRotator Expected, float Tolerance=UE_KINDA_SMALL_NUMBER)
bool TestEqual(const TCHAR *What, const ValueType &Actual, const ValueType &Expected)
bool TestEqual(const TCHAR *What, const TCHAR *Actual, const TCHAR *Expected)
void AddExpectedError(FString ExpectedPatternString, EAutomationExpectedErrorFlags::MatchType CompareType=EAutomationExpectedErrorFlags::Contains, int32 Occurrences=1)
virtual uint32 GetTestFlags() const =0
bool TestInvalid(const TCHAR *Description, const TSharedPtr< ValueType > &SharedPointer)
bool TestEqual(const FString &What, const FString &Actual, const TCHAR *Expected)
bool TestEqual(const FString &What, const FRotator Actual, const FRotator Expected, float Tolerance=UE_KINDA_SMALL_NUMBER)
FString TestParameterContext
bool HasAnyErrors() const
virtual void AddErrorIfFalse(bool bCondition, const FString &InError, int32 StackOffset=0)
virtual FString GetTestFullName() const
void AddExpectedMessage(FString ExpectedPatternString, ELogVerbosity::Type ExpectedVerbosity, EAutomationExpectedMessageFlags::MatchType CompareType=EAutomationExpectedMessageFlags::Contains, int32 Occurrences=1)
virtual void AddWarningS(const FString &InWarning, const FString &InFilename, int32 InLineNumber)
bool TestEqual(const FString &What, const ValueType &Actual, const ValueType &Expected)
void SetSuccessState(bool bSuccessful)
FORCEINLINE void AddCommand(IAutomationNetworkCommand *NewCommand)
bool TestEqual(const TCHAR *What, const double Actual, const double Expected, double Tolerance=UE_KINDA_SMALL_NUMBER)
bool TestNotEqual(const FString &Description, const ValueType &Actual, const ValueType &Expected)
FCriticalSection ActionCS
virtual void AddInfo(const FString &InLogItem, int32 StackOffset=0, bool bCaptureStack=false)
void GetExpectedMessages(TArray< FAutomationExpectedMessage > &OutInfo, ELogVerbosity::Type Verbosity=ELogVerbosity::All) const
virtual ~FAutomationTestBase()
virtual bool ElevateLogWarningsToErrors()
bool TestEqual(const TCHAR *What, const FTransform Actual, const FTransform Expected, float Tolerance=UE_KINDA_SMALL_NUMBER)
bool TestValid(const FString &Description, const TSharedPtr< ValueType > &SharedPointer)
virtual void AddError(const FString &InError, int32 StackOffset=0)
void InternalSetSuccessState(bool bSuccessful)
bool TestNotNull(const TCHAR *What, const ValueType *Pointer)
bool TestEqual(const FString &What, const float Actual, const float Expected, float Tolerance=UE_KINDA_SMALL_NUMBER)
bool TestEqual(const FString &What, const TCHAR *Actual, const TCHAR *Expected)
void PushContext(const FString &Context)
~FAutomationTestExecutionInfo()
int32 GetErrorTotal() const
const FString & GetContext() const
TArray< FAutomationTelemetryData > TelemetryItems
void AddEvent(const FAutomationEvent &Event, int StackOffset=0, bool bCaptureStack=true)
void AddError(const FString &ErrorMessage)
TArray< FAutomationExecutionEntry > Entries
TArray< FString > AnalyticsItems
int32 RemoveAllEvents(EAutomationEventType EventType)
void AddWarning(const FString &WarningMessage)
TArray< FString > ContextStack
const TArray< FAutomationExecutionEntry > & GetEntries() const
int32 GetWarningTotal() const
FAutomationTestExecutionInfo()
int32 RemoveAllEvents(TFunctionRef< bool(FAutomationEvent &)> FilterPredicate)
std::atomic< FFeedbackContext * > DestinationContext
virtual void SerializeRecord(const UE::FLogRecord &Record) override
std::atomic< FAutomationTestBase * > CurTest
FCriticalSection ActionCS
~FAutomationTestMessageFilter()
virtual void Serialize(const TCHAR *V, ELogVerbosity::Type Verbosity, const FName &Category) override
void SetCurrentAutomationTest(FAutomationTestBase *InAutomationTest)
FAutomationTestMessageFilter()
virtual bool CanBeUsedOnMultipleThreads() const override
void SetDestinationContext(FFeedbackContext *InDestinationContext)
virtual void Serialize(const TCHAR *V, ELogVerbosity::Type Verbosity, const FName &Category, double Time) override
FCriticalSection ActionCS
~FAutomationTestOutputDevice()
FAutomationTestOutputDevice()
TSet< FAutomationTestBase * > LoggedFailureCause
std::atomic< FAutomationTestBase * > CurTest
virtual void Serialize(const TCHAR *V, ELogVerbosity::Type Verbosity, const class FName &Category) override
virtual bool CanBeUsedOnMultipleThreads() const override
void SetCurrentAutomationTest(FAutomationTestBase *InAutomationTest)
FAutomationTestBase * CurrentTest
TQueue< TSharedPtr< IAutomationNetworkCommand > > NetworkCommands
FOnTestEvent OnTestStartEvent
bool IsLatentCommandQueueEmpty() const
void EnqueueNetworkCommand(TSharedPtr< IAutomationNetworkCommand > NewCommand)
static FAutomationTestFramework & GetInstance()
FOnTestEvent OnTestEndEvent
uint32 RequestedTestFilter
bool RegisterAutomationTest(const FString &InTestNameToRegister, FAutomationTestBase *InTestToRegister)
FOnTestDataRetrieved OnTestDataRetrieved
void GetValidTestNames(TArray< FAutomationTestInfo > &TestInfo) const
FOnTestScreenshotAndTraceCaptured TestScreenshotAndTraceCapturedDelegate
FSimpleMulticastDelegate PostTestingEvent
bool ExecuteLatentCommands()
FString GetUserAutomationDirectory() const
void ConcludeAutomationTests()
~FAutomationTestFramework()
void DumpAutomationTestExecutionInfo(const TMap< FString, FAutomationTestExecutionInfo > &InInfoToDump)
FAutomationTestOutputDevice AutomationTestOutputDevice
FOnTestScreenshotCaptured & OnScreenshotCaptured()
void NotifyPerformanceDataRetrieved(bool bSuccess, const FString &ErrorMessage)
FAutomationTestFramework(const FAutomationTestFramework &)
TMap< FString, FAutomationTestBase * > AutomationTestClassNameToInstanceMap
void SetForceSmokeTests(const bool bInForceSmokeTests)
void NotifyTestDataRetrieved(bool bWasNew, const FString &JsonData)
FSimpleMulticastDelegate PreTestingEvent
bool InternalStopTest(FAutomationTestExecutionInfo &OutExecutionInfo)
void NotifyScreenshotComparisonComplete(const FAutomationScreenshotCompareResults &CompareResults)
FAutomationTestMessageFilter AutomationTestMessageFilter
void EnqueueLatentCommand(TSharedPtr< IAutomationLatentCommand > NewCommand)
FAutomationTestFramework()
void DequeueAllCommands()
bool StopTest(FAutomationTestExecutionInfo &OutExecutionInfo)
FOnTestScreenshotComparisonComplete OnScreenshotCompared
FOnPerformanceDataRetrieved OnPerformanceDataRetrieved
FOnTestScreenshotAndTraceCaptured & OnScreenshotAndTraceCaptured()
void InternalStartTest(const FString &InTestToRun)
bool ContainsTest(const FString &InTestName) const
void SetDeveloperDirectoryIncluded(const bool bInDeveloperDirectoryIncluded)
static FAutomationTestFramework & Get()
bool ExecuteNetworkCommands()
void SetRequestedTestFilter(const uint32 InRequestedTestFlags)
void SetCaptureStack(bool bCapture)
void NotifyScreenshotTakenAndCompared()
TQueue< TSharedPtr< IAutomationLatentCommand > > LatentCommands
void StartTestByName(const FString &InTestToRun, const int32 InRoleIndex)
FOnTestScreenshotCaptured TestScreenshotCapturedDelegate
FSimpleMulticastDelegate OnScreenshotTakenAndCompared
FAutomationTestFramework & operator=(const FAutomationTestFramework &)
bool ShouldTestContent(const FString &Path) const
bool GetCaptureStack() const
FFeedbackContext * OriginalGWarn
void AddAnalyticsItemToCurrentTest(const FString &AnalyticsItem)
FAutomationTestBase * GetCurrentTest() const
void PrepForAutomationTests()
bool UnregisterAutomationTest(const FString &InTestNameToUnregister)
bool bDeveloperDirectoryIncluded
const int32 GetNumParticipantsRequired() const
FAutomationTestInfo(const FString &InDisplayName, const FString &InFullTestPath, const FString &InTestName, const uint32 InTestFlags, const int32 InNumParticipantsRequired, const FString &InParameterName=FString(), const FString &InSourceFile=FString(), int32 InSourceFileLine=0, const FString &InAssetPath=FString(), const FString &InOpenCommand=FString())
uint32 NumDevicesCurrentlyRunningTest
void AddTestFlags(const uint32 InTestFlags)
const FString & GetDisplayName() const
const FString GetOpenCommand() const
void InformOfNewDeviceRunningTest()
const FString GetTestParameter() const
void ResetNumDevicesRunningTest()
void SetNumParticipantsRequired(int32 NumRequired)
const FString GetAssetPath() const
const FString GetSourceFile() const
const uint32 GetTestFlags() const
uint32 NumParticipantsRequired
void SetDisplayName(const FString &InDisplayName)
const int32 GetSourceFileLine() const
const FString & GetFullTestPath() const
const int GetNumDevicesRunningTest() const
FString GetTestName() const
bool IsDiscoveryMode() const
TArray< TFunction< void()> > BeforeEachStack
TArray< FString > Description
void PushDescription(const FString &InDescription)
void It(const FString &InDescription, TFunction< void()> DoWork)
TArray< TFunction< void()> > AfterEachStack
TArray< FString > TestCommands
void PopDescription(const FString &InDescription)
FBDDAutomationTestBase(const FString &InName, const bool bInComplexTask)
virtual void GetTests(TArray< FString > &OutBeautifiedNames, TArray< FString > &OutTestCommands) const override
void xIt(const FString &InDescription, TFunction< void()> DoWork)
virtual bool RunTest(const FString &Parameters) override
void Describe(const FString &InDescription, TFunction< void()> DoWork)
FString GetDescription() const
void xDescribe(const FString &InDescription, TFunction< void()> DoWork)
TArray< FString > BeautifiedNames
void BeforeEach(TFunction< void()> DoWork)
void AfterEach(TFunction< void()> DoWork)
virtual bool Update() override
FDelayedFunctionLatentCommand(TFunction< void()> InCallback, float InDelay=0.1f)
TFunction< void()> Callback
virtual bool Update() override
TFunction< bool()> LatentPredicate
virtual ~FFunctionLatentCommand()
FFunctionLatentCommand(TFunction< bool()> InLatentPredicate)
UE_NODISCARD FString RightChop(int32 Count) const &
ARK_API void RemoveAt(int32 Index, int32 Count=1, bool bAllowShrinking=true)
UE_NODISCARD FORCEINLINE int32 Len() const
UE_NODISCARD FORCEINLINE const TCHAR * operator*() const UE_LIFETIMEBOUND
UE_NODISCARD FORCEINLINE bool IsEmpty() const
FThreadSafeBool(bool bValue=false)
FORCEINLINE bool operator=(bool bNewValue)
FThreadedAutomationLatentCommand(TUniqueFunction< void()> InFunction)
virtual bool Update() override
virtual ~FThreadedAutomationLatentCommand()
TUniqueFunction< void()> Function
FUntilCommand(TFunction< bool()> InCallback, TFunction< bool()> InTimeoutCallback, float InTimeout=5.0f)
virtual bool Update() override
TFunction< bool()> Callback
TFunction< bool()> TimeoutCallback
virtual ~IAutomationLatentCommand()
IAutomationLatentCommand()
double GetCurrentRunTime() const
double MaxTotalRunTimeInSeconds
bool IsDelayTimerRunning() const
IAutomationLatentCommandWithRetriesAndDelays(const FString InCommandClassName, const int32 InMaxRetries, const double InWaitTimeBetweenRuns)
virtual ~IAutomationLatentCommandWithRetriesAndDelays()
bool HasExceededMaxTotalRunTime()
const double DelayTimeInSeconds
void OverrideMaxTotalRunTimeInSeconds(double OverrideValue)
const FString CommandClassName
IAutomationLatentCommandWithRetriesAndDelays()
const bool bHasUnlimitedRetries
virtual void CommandFailedDueToError(const FString &ErrorMessage)
FAutomationTestBase * GetCurrentTest() const
virtual bool Update() override
FString GetTestAndCommandName() const
virtual uint32 GetRoleIndex() const =0
virtual ~IAutomationNetworkCommand()
const TCHAR * ToString(EAutomationExpectedMessageFlags::MatchType ThisType)
static const Type FromString(FString Name)
static const TMap< FString, Type > & GetTestFlagsMap()
FAutomationComparisonToleranceAmount()
static FAutomationComparisonToleranceAmount FromToleranceLevel(EAutomationComparisonToleranceLevel InTolerance)
FAutomationComparisonToleranceAmount(uint8 R, uint8 G, uint8 B, uint8 A, uint8 InMinBrightness, uint8 InMaxBrightness)
FRegexPattern MessagePattern
FAutomationExpectedMessage(FString &InMessagePattern, ELogVerbosity::Type InVerbosity, EAutomationExpectedMessageFlags::MatchType InCompareType, int32 InExpectedNumberOfOccurrences=1)
FAutomationExpectedMessage(FString &InMessagePattern, ELogVerbosity::Type InVerbosity, int32 InExpectedNumberOfOccurrences)
FString MessagePatternString
int32 ActualNumberOfOccurrences
int32 ExpectedNumberOfOccurrences
ELogVerbosity::Type Verbosity
EAutomationExpectedMessageFlags::MatchType CompareType
FAutomationEvent ToAutomationEvent(const FString &ScreenhotName) const
double MaxLocalDifference
uint8 ToleranceMaxBrightness
FString AdapterInternalDriverVersion
int32 AntiAliasingQuality
uint8 ToleranceMinBrightness
FString AdapterUserDriverVersion
FAutomationScreenshotData()
int32 GlobalIlluminationQuality
int32 ViewDistanceQuality
TArray< TSharedRef< FSpecDefinitionScope > > Children
TArray< TSharedRef< IAutomationLatentCommand > > AfterEach
TArray< TSharedRef< IAutomationLatentCommand > > BeforeEach
TArray< TSharedRef< FSpecIt > > It
TArray< TSharedRef< IAutomationLatentCommand > > Commands
TSharedRef< IAutomationLatentCommand > Command
FSpecIt(FString InDescription, FString InId, FString InFilename, int32 InLineNumber, TSharedRef< IAutomationLatentCommand > InCommand)
FAutomationTelemetryData(const FString &InDataPoint, double InMeasurement, const FString &InContext)
bool operator>=(const FDateTime &Other) const
static FDateTime UtcNow()
FDateTime operator+(const FTimespan &Other) const
static FTimespan FromSeconds(double Seconds)