1
我可以找到way to call the test harness,但我無法弄清楚如何編寫一個簡單的測試用例。謝謝。如何爲我自己的應用程序使用cherrypy測試工具?
我可以找到way to call the test harness,但我無法弄清楚如何編寫一個簡單的測試用例。謝謝。如何爲我自己的應用程序使用cherrypy測試工具?
好吧我有一個簡單的測試案例工作,但由於我們使用的是非標準的路由方法,我發現我必須爲每個測試用例明確地重新初始化全局cherrypy配置(在testharness重新初始化之後)。那就是:
「」「 測試,該測試工具正在 ‘’」
import test_assignment_web
from cherrypy.test import helper
import cherrypy
class testTestHarness(helper.CPWebCase):
def setUp(self):
# fix up the cherrypy tree...
test_assignment_web.setUp()
def testTestPage(self):
path = "/test"
self.getPage(path)
self.assertStatus('200 OK')
test_assignment_web.setUp()修復了CherryPy的‘樹’對象testharness休息後,開始工作它。這個測試用例適用於TestHarness,如問題中給出的鏈接所述。
http://tools.cherrypy.org/wiki/RestfulAuth有一些有用的示例代碼,但某些有用的解釋會很好。 –