drools8尝试(加单元测试)

drools8的maven模板项目里没有单元测试, 相比而言drools7有个非常好的test senorios

那就自己弄一个

文件是.http后缀的,写了个简单的例子如下

powershell 复制代码
//测试交通违章
POST  http://localhost:8080/Traffic Violation
accept: application/json
Content-Type: application/json

{
  "Violation": {
    "Code": "zzfdsfz",
    "Date": "2023-08-23",
    "Type": "speed",
    "Speed Limit": 10,
    "Actual Speed": 100
  },
  "Driver": {
    "Name": "string",
    "Age": 0,
    "State": "string",
    "City": "string",
    "Points": 0
  }
}

> {%
// 这块是对结果的测试
client.test("Request executed successfully", function() {
  client.assert(response.status === 200, "Response status is not 200");
  //client.assert(response.status === 203, "Response status is  200");
  //意思是说,罚金恒等于1000  否则报错"罚金计算错误"
  client.assert(response.body.Fine.Amount === 1000, "罚金计算错误");

});
%}

感觉还不错

下一步应用到k8s里,或者是看原生的微服务是什么东西

相关推荐
不要再敲了6 天前
掌握单元测试的利器:JUnit 注解从入门到精通
junit·单元测试
噔噔噔噔@7 天前
BUG排查流程
单元测试
Mr_Xuhhh8 天前
项目需求分析(2)
c++·算法·leetcode·log4j
山楂树下懒猴子9 天前
ChatAI项目-ChatGPT-SDK组件工程
人工智能·chatgpt·junit·https·log4j·intellij-idea·mybatis
Mr_Xuhhh9 天前
gtest全局套件的测试使用
log4j
索迪迈科技9 天前
Protobuf 新版“调试表示为什么有链接?为什么会打码?我该怎么改代码?
java·log4j·apache
凯子坚持 c9 天前
Redis核心通用命令深度解析:结合C++ redis-plus-plus 实战指南
c++·redis·log4j
云动雨颤10 天前
Python单元测试入门:3个核心断言方法,帮你快速定位代码bug
python·单元测试
Suresoft China10 天前
软件测试|STATIC 代码静态验证工具 C/C++ 工具链设置指南
c++·单元测试·静态测试·测试覆盖率·static·代码覆盖率·工具链设置