Arma Reforger Explorer
1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Toggle main menu visibility
Loading...
Searching...
No Matches
SCR_AutotestCaseBase.c
Go to the documentation of this file.
1
5
class
SCR_AutotestCaseBase
:
TestBase
6
{
7
//------------------------------------------------------------------------------------------------
11
TestResultBase
AssertTrue(
bool
expression,
string
msg)
12
{
13
TestResultBase
result = GetResult();
14
if
(result && result.Failure())
15
return
result;
16
17
if
(!expression)
18
{
19
result =
SCR_AutotestResult
.
AsFailure
(
"AssertTrue: %1"
, msg);
20
SetResult(result);
21
}
22
23
return
result;
24
}
25
26
//------------------------------------------------------------------------------------------------
31
notnull
TestResultBase
SetResultSuccess(
bool
force =
false
)
32
{
33
TestResultBase
result = GetResult();
34
if
(!force && result && result.Failure())
35
return
result;
36
37
result =
SCR_AutotestResult
.
AsSuccess
();
38
SetResult(result);
39
40
return
result;
41
}
42
43
//------------------------------------------------------------------------------------------------
50
notnull
TestResultBase
SetResultFailure(
string
reason
,
string
param1
=
""
,
string
param2
=
""
,
string
param3
=
""
)
51
{
52
TestResultBase
result = GetResult();
53
if
(result && result.Failure())
54
return
result;
55
56
result =
SCR_AutotestResult
.
AsFailure
(
reason
,
param1
,
param2
,
param3
);
57
SetResult(result);
58
59
return
result;
60
}
61
62
//------------------------------------------------------------------------------------------------
64
TestSuite
GetSuite()
65
{
66
for
(
int
i, countSuites =
TestHarness
.GetNSuites(); i < countSuites; i++)
67
{
68
TestSuite
suite =
TestHarness
.GetSuite(i);
69
for
(
int
j, countTests = suite.GetNTests(); j < countTests; j++)
70
{
71
TestBase
test = suite.GetTest(j);
72
if
(test.Type() ==
this
.Type())
73
return
suite;
74
}
75
}
76
77
return
null;
78
}
79
80
//------------------------------------------------------------------------------------------------
83
void
Print(
string
msg,
LogLevel
level =
LogLevel
.NORMAL)
84
{
85
SCR_AutotestHarness
.GetLogger().
Log
(
"\t"
+msg, level);
86
}
87
88
//------------------------------------------------------------------------------------------------
91
void
PrintFormat(
string
fmt,
string
param1
=
""
,
string
param2
=
""
,
string
param3
=
""
,
LogLevel
level =
LogLevel
.NORMAL)
92
{
93
SCR_AutotestHarness
.GetLogger().
Log
(
string
.Format(
"\t"
+fmt,
param1
,
param2
,
param3
), level);
94
}
95
96
//------------------------------------------------------------------------------------------------
99
void
PrintOnce(
string
msg,
LogLevel
level =
LogLevel
.NORMAL)
100
{
101
SCR_AutotestHarness
.GetLogger().
LogOnce
(
"\t"
+msg, level);
102
}
103
104
//------------------------------------------------------------------------------------------------
105
[
Step
(
EStage
.Setup)]
106
private
void
Setup_Logger()
107
{
108
SCR_AutotestHarness
._SetActiveTestCase(
this
);
109
}
110
111
//------------------------------------------------------------------------------------------------
112
[
Step
(
EStage
.TearDown)]
113
private
void
TearDown_PrintTestResult()
114
{
115
SCR_AutotestHarness
.GetLogger().
LogTestCaseResult
(
this
);
116
}
117
118
//------------------------------------------------------------------------------------------------
119
[
Step
(
EStage
.TearDown)]
120
private
void
TearDown_Logger()
121
{
122
SCR_AutotestHarness
._SetActiveTestCase(null);
123
}
124
}
reason
string reason
Definition
ServerBrowserMenuCallbacks.c:41
SCR_AutotestCaseBase
Definition
SCR_AutotestCaseBase.c:6
SCR_AutotestHarness
Definition
SCR_AutotestHarness.c:24
SCR_AutotestPrinter::LogOnce
void LogOnce(string msg, LogLevel level=LogLevel.NORMAL)
Prevents duplicate printing of the same message. Intended to be used with messages printed many times...
Definition
SCR_AutotestPrinter.c:74
SCR_AutotestPrinter::Log
void Log(string msg, LogLevel level=LogLevel.NORMAL, bool forceFileWrite=false, bool consoleLog=true)
Should be used in tests instead of global Print. Forwards test output to separate file.
Definition
SCR_AutotestPrinter.c:36
SCR_AutotestPrinter::LogTestCaseResult
void LogTestCaseResult(TestBase test)
Definition
SCR_AutotestPrinter.c:99
SCR_AutotestResult
Definition
SCR_AutotestResult.c:5
SCR_AutotestResult::AsFailure
static SCR_AutotestResult AsFailure(string reason, string param1="", string param2="", string param3="")
Definition
SCR_AutotestResult.c:25
SCR_AutotestResult::AsSuccess
static SCR_AutotestResult AsSuccess()
Definition
SCR_AutotestResult.c:12
TestBase
Test base class.
Definition
TestBase.c:14
TestHarness
Collection of suites and main interface of the Testing framework.
Definition
TestHarness.c:14
TestResultBase
Definition
TestResultBase.c:17
TestSuite
Collection of tests. Provides API for environment preparation.
Definition
TestSuite.c:14
LogLevel
LogLevel
Enum with severity of the logging message.
Definition
LogLevel.c:14
Step
class TestStep Step
EStage
class Test EStage
param3
T3 param3
Definition
tuple.c:93
param2
T2 param2
Definition
tuple.c:92
param1
Tuple param1
scripts
Autotest
Game
TestFramework
SCR_AutotestCaseBase.c
Generated by
1.17.0