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

相关推荐
川石课堂软件测试1 天前
Python | 高阶函数基本应用及Decorator装饰器
android·开发语言·数据库·python·功能测试·mysql·单元测试
Filotimo_1 天前
springboot的单元测试功能有什么用
spring boot·单元测试·log4j
不光头强1 天前
Spring整合单元测试
spring·单元测试·log4j
慧都小项1 天前
Parasoft C/C++test如何在CCS3环境下进行F2812项目的单元测试
单元测试·parasoft·ccs3
学IT的周星星1 天前
Spring 框架整合 JUnit 单元测试
java·spring·junit·单元测试
千里镜宵烛1 天前
Lua 面向对象编程完全指南:从元表到私密性,解锁灵活封装技巧
junit·单元测试·lua
安冬的码畜日常2 天前
【JUnit实战3_24】 第十四章:JUnit 5 扩展模型(Extension API)实战(下)
测试工具·junit·单元测试·jdbc·junit5扩展·junit extension
workflower3 天前
测试套件缩减方法
数据库·单元测试·需求分析·个人开发·极限编程
要一杯卡布奇诺3 天前
测开百日计划——Day1
功能测试·测试工具·单元测试·集成测试
安冬的码畜日常3 天前
【JUnit实战3_27】第十六章:用 JUnit 测试 Spring 应用:通过实战案例深入理解 IoC 原理
spring·观察者模式·设计模式·单元测试·ioc·依赖注入·junit5