You have a line
assertTrue(Calculator.sum(1,2) == 3)
Do you really have Calculator
class with sum(int, int)
method?
You have a line
assertTrue(Calculator.sum(1,2) == 3)
Do you really have Calculator
class with sum(int, int)
method?
I tried to reproduce your insident.
I used Katalon Studio 9.0.0.
I created a new Katalon Studio project.
I located junit4ks-1.6.1.jar
in the Drivers
folder.
I made a Groovy class to be tested:
Keywords/test/Calculator.groovy
package test
public class Calculator {
static int sum(int a, int b) {
return a + b;
}
}
I made a JUnit4 test class:
Include/scripts/groovy/test/CommonMethodTest.groovy
package test
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.JUnit4
import static org.junit.Assert.True
@RunWith(JUnit4.class)
public class CommonMethodTest {
@Test
void test() {
assertTrue(Calculator.sum(1, 2) == 3)
}
}
I made a test runner script:
Test Cases/CommonMethodTestRunner
import static com.kazurayam.junit4ks.JUnitCustomKeywords.runWithJUnitRunner
import test.CommonMethodTest
runWithJUnitRunner(CommonMethodTest.class)
I ran the test runner script.
I got the following output in the console:
2024-02-21 07:42:05.326 INFO c.k.katalon.core.main.TestCaseExecutor - --------------------
2024-02-21 07:42:05.331 INFO c.k.katalon.core.main.TestCaseExecutor - START Test Cases/CommonMethodTestRunner
2024-02-21 07:42:05.898 DEBUG testcase.CommonMethodTestRunner - 1: JUnitCustomKeywords.runWithJUnitRunner(test.CommonMethodTest)
2024-02-21 07:42:06.249 INFO c.k.katalon.core.main.TestCaseExecutor - END Test Cases/CommonMethodTestRunner
The test passed.
So I have no idea why @jhilario got a problem.
@kazurayam Yes! It was a Groovy conflict between different versions.
Thanks!
c/c @grylion54
Here is my recent development.
I believe, âKatalon-IDEA-Combinationâ is much better than âjunit4ksâ