开发者

classic asp testbed for quick function/unit tests

开发者 https://www.devze.com 2023-02-27 19:11 出处:网络
Is there any kind of online \"quick\" asp/vbscript test tool? It\'s a pain to load up a test page, put all the stuff in, wh开发者_StackOverflowen I just want to test some ASP VBScript.Yes, they are ca

Is there any kind of online "quick" asp/vbscript test tool? It's a pain to load up a test page, put all the stuff in, wh开发者_StackOverflowen I just want to test some ASP VBScript.


Yes, they are called .vbs files. These files are plain text files with a .vbs extenstion. You can run them from the command line. There are some minor differences, just google vbs or WSCript.

One of the most annoying issues is you cannot use response.write instead you use WScript.Echo. This displays the result in a windows style popup messagebox. So, if you use it in a loop to display values, you will have to close the box once for each value that is displayed. Can be a pain. I just contcatonate the results and display one message.

For example save the below code as myloop.vbs


Dim strMsg
Dim i

strMsg = ""
for i = 1 to 10
  strMsg = strMsg & CStr(i) & vbCrLf
next
WScript.Echo strMsg

Double-click on myloop.vbs and it runs.

This is a pretty cool way to test out a concept without having to create an asp page and load it on the server.


I realize this isn't a very good/correct answer, but I typically use VB6 (Visual Studio 6) as a quick interactive debuggable VBScript-equivalent testbed. Some syntax is different (CreateObject), and you need to add certain references to your "Default" testing project, but it does allow me to answer any question about type conversions etc within a few seconds (VB6 startup time + type/paste time + F5) rather than the few minutes it will take me to set up an ASP page, and even worse start up ASP debugging, which as of VS2008 and Windows 2003 is just a huge pain.

0

精彩评论

暂无评论...
验证码 换一张
取 消