forked from AutoItMicro/MicroUnitTestingFramework
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmicro.test.suite.au3
More file actions
75 lines (59 loc) · 1.85 KB
/
Copy pathmicro.test.suite.au3
File metadata and controls
75 lines (59 loc) · 1.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
Func _testSuite_($suiteName)
Local $oClassObject = _AutoItObject_Class()
$oClassObject.Create()
Local $dicTest = ObjCreate("Scripting.Dictionary")
With $oClassObject
.AddMethod("finish", "finish")
.AddMethod("addTest", "AddTest")
.AddMethod("testPassed","testPassed")
.AddMethod("testFailed","testFailed")
.AddMethod("duration","suiteDuration")
EndWith
With $oClassObject
.AddProperty("_type_", $ELSCOPE_PUBLIC, "_testSuite_") ;Object type
.AddProperty("name", $ELSCOPE_PUBLIC, $suiteName)
.AddProperty("ci", $ELSCOPE_PUBLIC, False)
.AddProperty("format", $ELSCOPE_PUBLIC, "html")
.AddProperty("tests", $ELSCOPE_PUBLIC, $dicTest)
.AddProperty("testsPassed", $ELSCOPE_PUBLIC, 0)
.AddProperty("testsFailed", $ELSCOPE_PUBLIC, 0)
.AddProperty("pass", $ELSCOPE_PUBLIC, True) ;0 Failed - 1 OK
.AddProperty("result", $ELSCOPE_PUBLIC, "Passed")
.AddProperty("beginTime", $ELSCOPE_PUBLIC, _NowCalc())
.AddProperty("endTime", $ELSCOPE_PUBLIC, _NowCalc())
.AddProperty("failFast", $ELSCOPE_PUBLIC, False)
EndWith
Return $oClassObject.Object
EndFunc ;==>_testSuite_
Func addTest($this, $test)
$this.testCount = $this.testCount + 1
If $test.pass Then
$this.testPassed()
Else
$this.testFailed()
EndIf
appveyorAddTest($test.name, $test.testResult, $test.duration)
$this.tests.Add($this.testCount, $test.TestResult)
EndFunc ;==>_AddTest
Func testPassed($this)
$this.testsPassed = $this.testsPassed + 1
EndFunc
Func testFailed($this)
$this.pass = False
$this.result = "Failed"
$this.testsFailed = $this.testsFailed + 1
If $this.failFast Then
Exit 1
EndIf
EndFunc
Func finish($this)
$this.endTime = _NowCalc()
If $this.pass Then
Exit 0
Else
Exit 1
EndIf
EndFunc ;==>_Stop
Func suiteDuration($this)
Return $this.endTime - $this.beginTime
EndFunc