我在服务器上一次又一次地运行一堆测试,我想要一些可以记录测试执行时间的东西,这样我就可以查找哪些测试是在什么时间运行的。有什么建议吗?我怎样才能做到这一点?
发布于 2015-05-13 10:05:00
带时间戳的测试报告
如果您只想在测试报告中添加时间戳,那么可以在nosetest调用周围创建一个bash包装器,将时间戳添加到报告的开头。
test.sh:
#!/usr/bin/bash
# test
nosetests tests -v -d --with-coverage --cover-package=project --cover-tests --cover-erase --cover-inclusive --cover-branches &> test.txt.temp
# test report
echo '' > test_report.txt
echo 'Project Testing Report' >> test_report.txt
echo `date "+%Y-%m-%d %H:%M:%S %z"` >> test_report.txt
echo '=========================================' >> test_report.txt
echo '' >> test_report.txt
cat test.txt.temp >> test_report.txt
rm .coverage
rm test.txt.temp
echo 'project tested'test_report.txt:
Project Testing Report
2015-05-12 19:04:17 -0000
=========================================
test that this test passes ... ok
test that this test fails ... ok
...https://stackoverflow.com/questions/25880422
复制相似问题