Asp classic 捕获ASP模板的输出以进行单元测试
我试图找到一种方法来捕获ASP模板的响应,以便进行测试。读完这篇文章后,我希望下面的代码能够提供一个解决方案:Asp classic 捕获ASP模板的输出以进行单元测试,asp-classic,Asp Classic,我试图找到一种方法来捕获ASP模板的响应,以便进行测试。读完这篇文章后,我希望下面的代码能够提供一个解决方案: class cMockResponse public data public sub write( value) if isempty(data) then data = "" data = data & value end sub end class class cView public response
class cMockResponse
public data
public sub write( value)
if isempty(data) then data = ""
data = data & value
end sub
end class
class cView
public response
private sub class_initialize()
set response = new cMockResponse
end sub
public sub render()
' expected that the following would be compiled to response.write "hello world"
%> hello world <%
end sub
end class
set view = new cView
call view.render()
response.write "the mock respone was:" & view.response.data
由于响应引用了mock对象,我希望这个解决方案能够做到这一点,但显然不行。上述代码的输出毫不奇怪:
hello world the mock response was:
是否有其他方法可以通过编程方式捕获ASP模板的输出,而无需求助于内部xmlhttp请求 据我所知,无法捕获输出 如果您需要对经典ASP进行单元测试,您可以查看
response.write "hello world"
hello world the mock response was: