jsonSchema 单测重构 JUnit Jupiter

Refactor test resources to separate JSON Schema Test Suite files from project specific files · Issue #692 · networknt/json-schema-validator · GitHub

fixed by https://github.com/networknt/json-schema-validator/pull/697

i propose moving the specification files from JSON Schema Test Suite to . This would provide the following benefits:src/test/suite

  • Makes merging updates from that project into this one easier as it reduces the chance of removing or overwriting this project's files
  • Makes it easier to see exactly what changed in the specification thus making it easier to see what functional changes are required to conform (e.g., moved from to and was removed)content.json``draft2019-09/optional``draft2019-09``draft2019-09/optional/zeroTerminatedFloats.json
  • Enables the opportunity to populate by linking to that project thus eliminating the need to manually merge its changes into this project (it is also possible for Maven to download and unpack a specific version of the source code)src/test/suite
  • Enables more complicated processing of specification files. JSON Schema Test Suite has informed validators to expect specification files to appear at the root of the folder. The validators are now expected to extract from the specification file rather than using the folder name (e.g., tests``$schema``tests/draft2019-09)

This change depends on #690 being accepted.

Refactor unit-tests from JSON Schema Test Suite · Issue #690 · networknt/json-schema-validator · GitHub

fixed by Uses JUnit dynamic tests to generate tests from specification files by fdutton · Pull Request #691 · networknt/json-schema-validator · GitHub

JSON Schema Test Suite has several tests for each test-case and there is one or more test-cases in each specification file. Currently, this project treats each specification file as a single unit-test. As a result, a single test failure causes the unit-test to fail and no subsequent tests are performed. If the first test in a specification file fails, for example, no other tests are executed.

Several specification files are currently disabled simply because a single test fails. For example, content.json has four test-cases with a total of 18 tests. The unit-test is disabled so none of the tests are executed.

I propose refactoring the unit-tests to use JUnit Jupiter's dynamic test facility to create a separate unit-test for each test in a test-case (and each test-case in a specification file). This would provided several benefits:

The specification files also need refreshing but that is best left to a separate ticket.

This is an example of how this would appear when executed from the command line.

notranslate 复制代码
<span style="color:#1f2328"><span style="background-color:#ffffff"><span style="color:var(--fgColor-default, var(--color-fg-default))"><span style="background-color:var(--bgColor-muted, var(--color-canvas-subtle))"><code>[INFO] +--JSON Schema Test Suite - 1.063s
[INFO] |  +-- [OK] validation of duration strings (src/test/resources/draft2019-09/optional/format/duration.json) Draft 2019-09 no elements present - 0.001s
[INFO] |  +-- [XX] validation of duration strings (src/test/resources/draft2019-09/optional/format/duration.json) Draft 2019-09 no time elements present - 0s
[INFO] |  +-- [OK] validation of duration strings (src/test/resources/draft2019-09/optional/format/duration.json) Draft 2019-09 no date or time elements present - 0s
</code></span></span></span></span>

This is how it appears in Eclipse (IntelliJ has similar views).

相关推荐
Smoothcloud润云6 小时前
从“预测下一个词”到“预测下一个世界状态”:世界模型作为AGI新范式的深度分析报告
人工智能·测试工具·微服务·容器·github·状态模式·agi
CoovallyAIHub9 小时前
ICLR 2026 | VLM自己学会调检测器:VTool-R1用强化学习教视觉模型使用工具推理
算法·架构·github
CoovallyAIHub9 小时前
RK3588上111 FPS:轻量YOLOv8+异步视频处理系统实现无人机自主电力巡检
算法·架构·github
素玥11 小时前
实训7 json文件数据用python导入数据库
数据库·python·json
逛逛GitHub13 小时前
一个饺子馆在 GitHub 上开源了自己的 Skill。 北京海淀,杏坛路,北京邮电大学旁边,有一家快 20 年的饺子馆——金谷园。 好像几乎所有的北邮小伙
github
CoderJia程序员甲14 小时前
GitHub 热榜项目 - 日榜(2026-04-13)
ai·大模型·github·ai教程
BothSavage14 小时前
OpenHarness源码研究-1-配置打包管理
github
FreeBuf_15 小时前
黑客滥用 GitHub 和 GitLab 托管恶意软件并实施凭证钓鱼攻击
gitlab·github
三无推导16 小时前
GitHub爆火项目ChinaTextbook——开源如何重新定义教育普惠的边界
学习·开源·github
韩数16 小时前
为了能同时开发多个项目,我烧了几亿 token 开源了一个轻量级 AI-Native IDE
后端·程序员·github