Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/cmake/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp classic 捕获ASP模板的输出以进行单元测试_Asp Classic - Fatal编程技术网

Asp classic 捕获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

我试图找到一种方法来捕获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
    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: