[英]Time stamp using nosetests
I am running bunch of tests in a server over and over again and i want something that would record at what time the tests executed so that I can lookup which tests ran at what time. 我在服务器中一遍又一遍地运行一堆测试,我想要一些可以记录何时执行测试的记录,以便我可以查询哪些测试在什么时间运行。 Any suggestions how can i accomplish this?
任何建议,我怎么能做到这一点?
If you just want a timestamp in a test report you can create a bash
wrapper around your nosetest
call that adds a timestamp to the beginning of the report. 如果您只想在测试报告中添加时间戳,则可以在
nosetest
调用周围创建一个bash
包装器,以在报告的开头添加时间戳。
test.sh: 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: 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
...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.