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

相关推荐
realhuizhu16 小时前
周五下午5点改完的代码,你敢直接发布上线吗?
自动化测试·单元测试·ai编程·测试驱动开发·代码质量
许泽宇的技术分享1 天前
AgentFramework:测试方法
log4j
我一定会有钱1 天前
pytest测试框架基础
python·单元测试·自动化·pytest
宋情写1 天前
单元测试、覆盖率测试-Springboot
spring boot·单元测试·测试覆盖率
卓码软件测评3 天前
第三方APP软件测试机构:【Gatling如何测试移动应用后端API移动网络特性和用户行为模拟】
网络·测试工具·单元测试·测试用例
晚烛3 天前
Flutter + OpenHarmony 质量保障体系:从单元测试到真机巡检的全链路可靠性工程
flutter·单元测试
墨痕诉清风3 天前
java漏洞集合工具(Struts2、Fastjson、Weblogic(xml)、Shiro、Log4j、Jboss、SpringCloud)
xml·java·struts·安全·web安全·spring cloud·log4j
旺仔Sec3 天前
2025年安徽省职业院校技能大赛(高职组)软件测试赛项规程及竞赛样题(附评分标准)
功能测试·单元测试·压力测试
Lisonseekpan3 天前
为什么Spring 推荐使用构造器注入而非@Autowired字段注入?
java·后端·spring·log4j
brave and determined4 天前
CANN训练营 学习(day10)昇腾AI算子ST测试全攻略:从入门到精通
自动化测试·人工智能·log4j·算子·fuzz·测试实战·st测试