我正在尝试设置服务器以对Racket程序运行广泛的随机测试,并希望将这些测试的输出发送到日志文件中。如何将测试的输出记录到文件?
来自rackunit
的测试返回#<void>
,而不是字符串,因此尝试在测试中使用(call-with-output-file ...
只会将#<void>
添加到输出文件中。
(call-with-output-file "testing.txt"
(λ (out)
(display <TESTS> out))
#:exists 'append)
输出文件应记录测试结果或错误(如果有)。任何帮助表示赞赏。
答案 0 :(得分:0)
将检查放到测试套件中,而不是自己运行打印到it('should handle', () => {
expect(component.Id).toBe(null);
component.isKeyUp();
component.detectChanges();
expect(component.show).toBe(true);
});
并返回stderr
的检查,以便您可以使用#<void>
中的run-tests
rackunit/text-ui
但是,#lang racket
(require rackunit rackunit/text-ui)
(define-test-suite testing
<TESTS>)
(.... something something (run-tests testing) ....)
函数似乎使用run-tests
而不是current-error-port
打印测试失败,因此在current-output-port
中,您需要设置{{1 }}到call-with-output-file
。
current-error-port