-
Notifications
You must be signed in to change notification settings - Fork 56
/
TestCaseBeforeAfterTest.cfc
executable file
·50 lines (38 loc) · 1.85 KB
/
TestCaseBeforeAfterTest.cfc
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
<cfcomponent extends="mxunit.framework.TestCase">
<cfset beforeTestsCount = 0>
<cfset afterTestsCount = 0>
<cffunction name="beforeTests" output="false" access="public" returntype="any" hint="">
<cflog text="Before Tests! Count is #beforeTestsCount#">
<cfset beforeTestsCount++>
</cffunction>
<cffunction name="afterTests" output="false" access="public" returntype="any" hint="">
<cflog text="After Tests! Count is #afterTestsCount#">
<cfset afterTestsCount++>
</cffunction>
<cffunction name="setUp" returntype="void" access="public" hint="put things here that you want to run before each test">
<cflog text="setUp">
</cffunction>
<cffunction name="tearDown" returntype="void" access="public" hint="put things here that you want to run after each test">
<cflog text="tearDown">
</cffunction>
<cffunction name="one" returntype="void" access="public">
<cfset debug("beforeTestsCount is #beforeTestsCount#; afterTestsCount is #afterTestsCount#")>
<cfset assertEquals(1, beforeTestsCount)>
<cfset assertEquals(0, afterTestsCount)>
</cffunction>
<cffunction name="two" returntype="void" access="public">
<cfset debug("beforeTestsCount is #beforeTestsCount#; afterTestsCount is #afterTestsCount#")>
<cfset assertEquals(1, beforeTestsCount)>
<cfset assertEquals(0, afterTestsCount)>
</cffunction>
<cffunction name="three" returntype="void" access="public">
<cfset debug("beforeTestsCount is #beforeTestsCount#; afterTestsCount is #afterTestsCount#")>
<cfset assertEquals(1, beforeTestsCount)>
<cfset assertEquals(0, afterTestsCount)>
</cffunction>
<cffunction name="four" returntype="void" access="public">
<cfset debug("beforeTestsCount is #beforeTestsCount#; afterTestsCount is #afterTestsCount#")>
<cfset assertEquals(1, beforeTestsCount)>
<cfset assertEquals(0, afterTestsCount)>
</cffunction>
</cfcomponent>