提交 649e199f authored 作者: 黄夏豪's avatar 黄夏豪

fix(base): 修复了一个小BUG

上级 581b70b0
......@@ -77,8 +77,6 @@ public class LogQueueRuntime {
String messageToDb = JSONObject.toJSONString(logMsg);
ExecutionRecord executionRecord = addExecutionRecord(testExecuteLog, messageToDb);
sendMessage(currentThreadId, testExecuteLog.getUniqueKey(), executionRecord.getId(), messageToDb);
} else {
throw new GlobalException("该线程中的TestCaseLog对象未初始化,请先调用put方法初始化对象");
}
}
......
......@@ -64,25 +64,30 @@ class CaseActuatorTest {
@Test
void jsonPathTest() throws ScriptException {
String json = "{ \"store\": {\n" +
" \"book\": [ \n" +
" { \"category\": \"reference\",\n" +
String json = "{\n" +
" \"store\": {\n" +
" \"book\": [\n" +
" {\n" +
" \"category\": \"reference\",\n" +
" \"author\": \"Nigel Rees\",\n" +
" \"title\": \"Sayings of the Century\",\n" +
" \"price\": 8.95\n" +
" },\n" +
" { \"category\": \"fiction\",\n" +
" {\n" +
" \"category\": \"fiction\",\n" +
" \"author\": \"Evelyn Waugh\",\n" +
" \"title\": \"Sword of Honour\",\n" +
" \"price\": 12.99\n" +
" },\n" +
" { \"category\": \"fiction\",\n" +
" {\n" +
" \"category\": \"fiction\",\n" +
" \"author\": \"Herman Melville\",\n" +
" \"title\": \"Moby Dick\",\n" +
" \"isbn\": \"0-553-21311-3\",\n" +
" \"price\": 8.99\n" +
" },\n" +
" { \"category\": \"fiction\",\n" +
" {\n" +
" \"category\": \"fiction\",\n" +
" \"author\": \"J. R. R. Tolkien\",\n" +
" \"title\": \"The Lord of the Rings\",\n" +
" \"isbn\": \"0-395-19395-8\",\n" +
......@@ -93,8 +98,10 @@ class CaseActuatorTest {
" \"color\": \"red\",\n" +
" \"price\": 19.95\n" +
" }\n" +
" }\n" +
"}";
" },\n" +
" \"expensive\": 10\n" +
"}\n" +
" ";
ScriptEngine jsEngine = ScriptUtil.createJsEngine();
jsEngine.eval("//a跟b进行比较,对象类型分为以下几种:基础类型、数组、普通对象\n" +
"function equal(a, b) {\n" +
......@@ -219,8 +226,7 @@ class CaseActuatorTest {
"var a = new BaseEntity('{\"name\":1,\"age\":2}');\n" +
"var b = new BaseEntity('{\"name\":1,\"age\":3}');\n" +
"\n");
Object read = JsonPath.parse(json).read("$.store.book[0].price");
Object eval = jsEngine.eval(JSON.toJSONString(read) + ".length()");
Object read = JsonPath.parse(json).read("$.store.bicycle.color");
System.out.println("1");
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论