Skip to content

Commit

Permalink
Switch reporter API to conform to new spec proposal, add onBegin an…
Browse files Browse the repository at this point in the history
…d `onEnd`
  • Loading branch information
luis-j-soares committed Apr 9, 2024
1 parent 7ed3343 commit 54aa936
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 17 deletions.
8 changes: 2 additions & 6 deletions framework/src/source/BaseTestReporter.bs
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,11 @@ namespace rooibos
m.allStats = runner.stats
end function

function reportResults(allStats as dynamic)
function onBegin()
'override me
end function

function testLogInfo(text as string)
'override me
end function

function testLogError(text as string)
function onEnd(allStats as dynamic)
'override me
end function

Expand Down
10 changes: 1 addition & 9 deletions framework/src/source/ConsoleTestReporter.bs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace rooibos
end if
end function

override function reportResults(allStats)
override function onEnd(allStats)
m.allStats = allStats
m.startReport()
for each testSuite in m.testRunner.testSuites
Expand Down Expand Up @@ -186,14 +186,6 @@ namespace rooibos
'++ printing
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

override function testLogInfo(text)
? "INFO " ; text
end function

override function testLogError(text)
? "ERROR " ; text
end function

function printLine(depth = 0, text = "")
? " " ; text
end function
Expand Down
2 changes: 1 addition & 1 deletion framework/src/source/JUnitTestReporter.bs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace rooibos
super(testRunner)
end function

override function reportResults(allStats as dynamic)
override function onEnd(allStats as dynamic)
root = createObject("roXMLElement")
root.SetName("testsuites")
properties = root.addElement("properties")
Expand Down
6 changes: 5 additions & 1 deletion framework/src/source/TestRunner.bs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ namespace rooibos
' */
public function run()

for each reporter in m.testReporters
reporter.onBegin()
end for

rooibosTimer = createObject("roTimespan")
rooibosTimer.mark()
suiteNames = m.runtimeConfig.getAllTestSuitesNames()
Expand Down Expand Up @@ -100,7 +104,7 @@ namespace rooibos
m.stats.time = rooibosTimer.totalMilliseconds()

for each reporter in m.testReporters
reporter.reportResults(m.stats)
reporter.onEnd(m.stats)
end for

rooibosResult = {
Expand Down

0 comments on commit 54aa936

Please sign in to comment.