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

相关推荐
3***C7441 天前
Spring Boot 整合 log4j2 日志配置教程
spring boot·单元测试·log4j
IMPYLH1 天前
Lua 的 rawset 函数
开发语言·笔记·单元测试·lua
霍格沃兹测试开发学社1 天前
被裁后,我如何实现0到3份大厂Offer的逆袭?(内附面试真题)
人工智能·selenium·react.js·面试·职场和发展·单元测试·压力测试
n***63271 天前
Spring Boot 整合 log4j2 日志配置教程
spring boot·单元测试·log4j
代码or搬砖2 天前
SpringMVC常用注解(二)
log4j
代码or搬砖2 天前
SpringMVC常用注解
log4j
aloha_7892 天前
联易融测开面试准备
java·python·面试·单元测试
R***62312 天前
Spring Boot 整合 log4j2 日志配置教程
spring boot·单元测试·log4j
老李头喽3 天前
走进单元测试
java·单元测试
万象.3 天前
高并发服务器组件单元测试&集成测试&系统测试
服务器·单元测试·集成测试