2011-09-14 37 views

回答

0

好吧我有一個簡單的測試案例工作,但由於我們使用的是非標準的路由方法,我發現我必須爲每個測試用例明確地重新初始化全局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,如問題中給出的鏈接所述。

相關問題