优化python的测试用例

This commit is contained in:
everywhere.z
2024-01-11 16:58:37 +08:00
parent 5c0693ac04
commit d5585e889a
3 changed files with 16 additions and 1 deletions

View File

@@ -26,7 +26,7 @@ import javax.annotation.Resource;
@TestPropertySource(value = "classpath:/common/application.properties")
@SpringBootTest(classes = ScriptPythonCommonELTest.class)
@EnableAutoConfiguration
@ComponentScan({ "com.yomahub.liteflow.test.script.python.common.cmp" })
@ComponentScan({ "com.yomahub.liteflow.test.script.python.common.cmp","com.yomahub.liteflow.test.script.python.common.domain" })
public class ScriptPythonCommonELTest extends BaseTest {
@Resource
@@ -40,6 +40,7 @@ public class ScriptPythonCommonELTest extends BaseTest {
Assertions.assertTrue(response.isSuccess());
Assertions.assertEquals(Integer.valueOf(30), context.getData("s1"));
Assertions.assertEquals("杰克", context.getData("name"));
Assertions.assertEquals("hi,jack", context.getData("td"));
}
}

View File

@@ -0,0 +1,13 @@
package com.yomahub.liteflow.test.script.python.common.domain;
import com.yomahub.liteflow.script.annotation.ScriptBean;
import org.springframework.stereotype.Component;
@Component
@ScriptBean("td")
public class TestDomain {
public String sayHi(String name){
return "hi," + name;
}
}

View File

@@ -20,6 +20,7 @@
else:
print 'hi'
defaultContext.setData("s1",a*b)
defaultContext.setData("td", td.sayHi("jack"))
]]>
</node>