2009-07-08 8 views
0

私は、テストのためにASPテンプレートの応答をキャプチャする方法を見つけようとしています。unittestingのための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 

私は

%> hello world <% 

は、単にので

response.write "hello world" 

に変換されることを望んでブログ記事を考える:this記事を読んだ後、私は次のコードは、ソリューションを提供することを期待していましたレスポンスはモックオブジェクトを参照しています。私はこのソリューションがトリックを行うことを望みましたが、明らかにそうではありません。上記のコードの出力は当然です:

hello world the mock response was: 

はプログラム的に内部XMLHTTPリクエストに頼らずにASPテンプレートの出力をキャプチャする他の方法はありますか?

答えて

1

私が知っている限り、出力をキャプチャすることはできません。

従来のASPの単体テストが必要な場合は、ajaxed

関連する問題