Skip to content

Commit ef9983a

Browse files
authored
35/2 output test result to external source database text file xml json (#37)
* TestSuiteLoaded: remove COM interface unknown taglist * Optimize log file output
1 parent 239095e commit ef9983a

22 files changed

+83
-115
lines changed

access-add-in/AccUnitLoader.accda

0 Bytes
Binary file not shown.

access-add-in/source/modules/DebugPrintTestResultReporter.cls

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,6 @@ Private Property Set TestResultCollector(ByVal TestResultCollectorToListen As Te
3030
Set m_TestResultCollector = TestResultCollectorToListen
3131
End Property
3232

33-
Private Sub m_TestResultCollector_NewTestResult(ByVal TestResult As AccUnit.ITestResult)
34-
'
35-
End Sub
36-
37-
Private Sub m_TestResultCollector_TestSuiteFinished(ByVal TestSummary As AccUnit.ITestSummary)
38-
Debug.Print String(20, "#")
39-
End Sub
40-
4133
Private Sub m_TestResultCollector_TestTraceMessage(ByVal Message As String, ByVal CodeCoverageTracker As CodeCoverageTracker)
4234
If Message Like "* [*][*][*]*" Then
4335
Message = Replace(Message, vbNewLine, vbTab)

access-add-in/source/modules/LogFileTestResultReporter.cls

Lines changed: 34 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,18 @@ Attribute VB_Exposed = False
1717
Option Compare Text
1818
Option Explicit
1919

20+
Private Const LineSeperatorLen As Long = 40
21+
2022
Implements ITestResultReporter
23+
Private m_FileNo As Long
2124

2225
Private WithEvents m_TestResultCollector As TestResultCollector
2326
Attribute m_TestResultCollector.VB_VarHelpID = -1
2427

28+
Private Sub Class_Terminate()
29+
CloseFile
30+
End Sub
31+
2532
Private Property Set ITestResultReporter_TestResultCollector(ByVal TestResultCollectorToListen As TestResultCollector)
2633
Set TestResultCollector = TestResultCollectorToListen
2734
End Property
@@ -30,49 +37,32 @@ Private Property Set TestResultCollector(ByVal TestResultCollectorToListen As Te
3037
Set m_TestResultCollector = TestResultCollectorToListen
3138
End Property
3239

33-
Private Sub m_TestResultCollector_NewTestResult(ByVal TestResult As AccUnit.ITestResult)
34-
'
35-
End Sub
36-
3740
Private Sub m_TestResultCollector_TestSuiteFinished(ByVal TestSummary As AccUnit.ITestSummary)
3841
PrintSummary TestSummary, True
39-
PrintToFile String(40, "#")
42+
CloseFile
4043
End Sub
4144

4245
Private Sub m_TestResultCollector_TestSuiteStarted(ByVal TestSuite As AccUnit.ITestSuite)
43-
PrintToFile String(40, "#")
44-
End Sub
45-
46-
Private Sub m_TestResultCollector_TestTraceMessage(ByVal Message As String, ByVal CodeCoverageTracker As CodeCoverageTracker)
47-
' If Message Like "* [*][*][*]*" Then
48-
' Message = Replace(Message, vbNewLine, vbTab)
49-
' ElseIf Message Like "* ~~~*" Then
50-
' Message = Replace(Message, vbNewLine, vbTab)
51-
' End If
52-
' PrintToFile Message
53-
'
54-
' If Not (CodeCoverageTracker Is Nothing) Then
55-
' If Message Like "*Total*" Then
56-
' PrintToFile CodeCoverageTracker.GetReport()
57-
' End If
58-
' End If
46+
PrintToFile String(LineSeperatorLen, "#")
47+
PrintToFile Format(Now(), "yyyy-mm-dd hh:nn:ss")
5948
End Sub
6049

6150
Private Sub m_TestResultCollector_PrintSummary(ByVal TestSummary As AccUnit.ITestSummary, ByVal PrintTestResults As Boolean)
6251
PrintSummary TestSummary, PrintTestResults
6352
End Sub
6453

6554
Private Sub PrintSummary(ByVal TestSummary As AccUnit.ITestSummary, ByVal PrintTestResults As Boolean)
55+
6656
If PrintTestResults Then
67-
PrintToFile String(40, "-")
57+
PrintToFile String(LineSeperatorLen, "-")
6858
PrintTestDetailSummary TestSummary.GetTestResults
6959
End If
70-
PrintToFile String(40, "-")
60+
PrintToFile String(LineSeperatorLen, "-")
7161
PrintToFile "Tests: " & TestSummary.Total
7262
PrintToFile " ", "Passed: " & TestSummary.Passed
7363
PrintToFile " ", "Failed: " & TestSummary.Failed
7464
PrintToFile " ", "Ignored: " & TestSummary.Ignored
75-
PrintToFile String(40, "-")
65+
PrintToFile String(LineSeperatorLen, "-")
7666

7767
If TestSummary.Failed + TestSummary.Error > 0 Then
7868
PrintToFile (TestSummary.Failed + TestSummary.Error) & " / " & TestSummary.Total & " failed"
@@ -82,7 +72,7 @@ Private Sub PrintSummary(ByVal TestSummary As AccUnit.ITestSummary, ByVal PrintT
8272
PrintToFile (TestSummary.Ignored) & " / " & TestSummary.Total & " ignored"
8373
End If
8474

85-
PrintToFile String(40, "-")
75+
PrintToFile String(LineSeperatorLen, "-")
8676

8777
End Sub
8878

@@ -132,9 +122,6 @@ End Sub
132122

133123
Private Sub PrintToFile(ParamArray LogItems())
134124

135-
Dim FileNo As Long
136-
FileNo = FreeFile
137-
138125
Dim LineString As String
139126
Dim i As Long
140127

@@ -143,12 +130,27 @@ Private Sub PrintToFile(ParamArray LogItems())
143130
LineString = LineString & vbTab & LogItems(i)
144131
Next
145132

146-
Open LogFilePath For Append As #FileNo
147-
Print #FileNo, LineString
148-
Close #FileNo
133+
If m_FileNo = 0 Then
134+
OpenFile
135+
End If
149136

137+
Print #m_FileNo, LineString
138+
139+
End Sub
140+
141+
Private Sub OpenFile()
142+
m_FileNo = FreeFile
143+
Open LogFilePath For Append As #m_FileNo
144+
End Sub
145+
146+
Private Sub CloseFile()
147+
On Error Resume Next
148+
If m_FileNo <> 0 Then
149+
Close #m_FileNo
150+
m_FileNo = 0
151+
End If
150152
End Sub
151153

152154
Private Property Get LogFilePath() As String
153-
LogFilePath = CurrentDb.Name & ".AccUnit.log"
155+
LogFilePath = CurrentVbProject.FileName & ".AccUnit.log"
154156
End Property

access-add-in/source/modules/_config_Application.bas

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Option Compare Text
1818
Option Explicit
1919

2020
'Version nummer
21-
Private Const APPLICATION_VERSION As String = "0.9.23.240311"
21+
Private Const APPLICATION_VERSION As String = "0.9.24.240312"
2222

2323
Private Const APPLICATION_NAME As String = "ACLib AccUnit Loader"
2424
Private Const APPLICATION_FULLNAME As String = "Access Code Library - AccUnit Loader"

access-add-in/source/vbe-project.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"FileName": "AccUnitLoader.accda",
1010
"HelpFile": "",
1111
"HelpContextId": 0,
12-
"ConditionalCompilationArguments": "",
12+
"ConditionalCompilationArguments": "DEVMODE = 0",
1313
"Mode": 0,
1414
"Protection": 0,
1515
"Type": 100
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
-31.8 KB
Binary file not shown.

excel-add-in/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.xlsm
2+
*.log

0 commit comments

Comments
 (0)