运行所有测试套件的最佳方式是什么

运行所有测试套件的最佳方式是什么

本文介绍了Logtalk:运行所有测试套件的最佳方式是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Logtalk 代码示例中,每个示例都提供了自己的测试套件,可在独立"模式下运行(一次一个测试套件).

In Logtalk code examples, each example provides its own test suite which is runnable in a "standalone" mode (one test suite at once).

但是,正如标题所说,我对一次测试所有测试套件(所有加载的对象在我的应用程序中继承 lgtunit )的最佳方法感兴趣,并在最后对所有测试执行进行一个总结(总通过/跳过/失败).

But, as the title says, I'm interested in the best approaches of testing all test suites (all loaded objects inheriting lgtunit in my app) at once, and having one single summary of all tests execution at the end (total passed / skipped / failed).

例如,在 SWI-Prolog 中,run_tests/0 运行所有测试单元.

For example, in SWI-Prolog, run_tests/0 run all test-units.

推荐答案

这是运行所有已注册测试套件的 runner 对象的第一个实现:https://github.com/koryonik/logtalk-experiments/tree/master/test-runner

Here is a first implementation of a runner object to run all registered test suites : https://github.com/koryonik/logtalk-experiments/tree/master/test-runner

用法很简单:

只需运行所有加载的 lgtunit 测试套件:

Simply run all loaded lgtunit test suites :

test_runner::autoregister_tests, % register all loaded lgtunit objects
test_runner::run_tests.

或者手动注册你想要运行的测试套件:

Or Manually register test suites you want to run :

test_runner::register_tests(test_suite_obj1),
test_runner::register_tests(test_suite_obj2),
test_runner::run_tests. %run the 2 test suites

这篇关于Logtalk:运行所有测试套件的最佳方式是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 06:10