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里,或者是看原生的微服务是什么东西

相关推荐
汽车仪器仪表相关领域7 小时前
Kvaser Leaf Light HS v2 CB:裸卡式CAN接口新标杆,赋能车载与工业集成测试高效升级
服务器·网络·数据库·人工智能·单元测试·自动化·汽车
川石课堂软件测试18 小时前
软件测试:典型面试题库
数据库·python·功能测试·mysql·单元测试·grafana·prometheus
NCIN EXPE2 天前
SpringBoot Test详解
spring boot·后端·log4j
polaris06302 天前
Spring Boot 项目开发流程全解析
java·spring boot·log4j
汽车仪器仪表相关领域2 天前
Kvaser U100:工业级单通道CAN/CAN FD转USB接口,恶劣环境下的可靠通信桥梁
linux·运维·服务器·人工智能·功能测试·单元测试·可用性测试
芥末的无奈3 天前
Harness Engineering 实战(一):为 fdk-acc 添加单元测试
单元测试·ai编程·harness
发际线向北3 天前
0x03 单元测试与Junit
前端·单元测试
QH139292318804 天前
KEYSIGHT E5071C 端网络分析仪
网络·功能测试·嵌入式硬件·物联网·单元测试·集成测试·模块测试