Permalink
Browse files

redirect printed messages from test cases under JUnit into Katalon Log

  • Loading branch information...
kazurayam committed Oct 26, 2018
1 parent ee71301 commit b57dbcaff69cdfa5a26da1a79e5a9604c5f67dae
@@ -11,6 +11,7 @@ class CalculatorTest {

@Test
void testMultiply() {
println ">>> Hello from CalculatorTest#testMultiply()"
Calculator calc = new Calculator()
int expected = 12
int actual = calc.multiply(3, 4)
@@ -4,6 +4,21 @@
<name>RunningJUnitInKatalonStudio</name>
<tag></tag>
<UUID>7f8264c1-803e-409c-88b6-b24a6eb524cc</UUID>
<migratedVersion>5.4.0</migratedVersion>
<migratedVersion>5.7.0</migratedVersion>
<pageLoadTimeout>0</pageLoadTimeout>
<sourceContent>
<sourceFolderList>
<sourceFolderConfiguration>
<url>Include/scripts/groovy</url>
</sourceFolderConfiguration>
</sourceFolderList>
<systemFolderList>
<systemFolderConfiguration>
<url>Include/scripts/groovy</url>
</systemFolderConfiguration>
<systemFolderConfiguration>
<url>Include/features</url>
</systemFolderConfiguration>
</systemFolderList>
</sourceContent>
</Project>
@@ -2,6 +2,7 @@ import static com.kms.katalon.core.testcase.TestCaseFactory.findTestCase

import org.junit.runner.JUnitCore
import org.junit.runner.Result
import org.junit.internal.TextListener

import com.kms.katalon.core.util.KeywordUtil
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
@@ -14,7 +15,9 @@ WebUI.callTestCase(findTestCase('test/Prologue'), [:],
FailureHandling.CONTINUE_ON_FAILURE)

// run AllTests
Result result = JUnitCore.runClasses(AllTests.class)
JUnitCore junit = new JUnitCore()
junit.addListener(new TextListener(System.out))
Result result = junit.run(AllTests.class)

// print test result
WebUI.callTestCase(findTestCase('test/Epilogue'), ['result':result],
@@ -2,6 +2,7 @@ import static com.kms.katalon.core.testcase.TestCaseFactory.findTestCase

import org.junit.runner.JUnitCore
import org.junit.runner.Result
import org.junit.internal.TextListener

import com.kms.katalon.core.model.FailureHandling
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
@@ -13,7 +14,9 @@ WebUI.callTestCase(findTestCase('test/Prologue'), [:],
FailureHandling.CONTINUE_ON_FAILURE)

// run CalculatorTest
Result result = JUnitCore.runClasses(CalculatorTest.class)
JUnitCore junit = new JUnitCore()
junit.addListener(new TextListener(System.out))
Result result = junit.run(CalculatorTest.class)

// print test result
WebUI.callTestCase(findTestCase('test/Epilogue'), ['result':result],

0 comments on commit b57dbca

Please sign in to comment.