问题
I have a very old project implemented in (classic) ASP and SQL Server 2000. Because of quality concerns, I've been considering the possibility of implementing some form of automated quality testing. Though, the web pages are ASP the project is really 85% SQL Server stored procedure, functions, views and DTS. (Lots of dependency on DTS) A lot of code generation occurs from SQL Server.
In regards to the DTS, we are hoping to possibly upgrade the database to SQL Server 2005 -- so If unit testing can't be setup on DTS, what about SSIS?
I've found ASPUnit but it no longer seems to be maintained...
As for my question, it is really a multi-part question.
- Is it possible and practical to Unit Test ASP?
- Is it possible and practical to Unit Test SQL Server objects? (I've seen some success on this but some discouragement too)
- Is there a currently supported testing framework that is usable with both ASP and SQL Server?
- Are there any alternative software quality control methods to unit testing this type of code base? (Any general advise would also be helpful. Thank you.)
- Also, I've been considering the ROI on implementing automated testing in a project like this. The project is big. I don't know how much code but hundreds of files, thousands (if not millions) of lines of code. Given this, lets go back to 1 and 3.
I'm really in a bad situation with this project; any general quality control advise would be greatly appreciated...
回答1:
It sounds like your problems are actually at a higher level than unit tests. I'd argue that your major issues would be best solved at an integration test level.
Since your pages are generated largely by SQL, asp unit tests will only cover a small percentage of issues, so you will have better coverage by testing the end pages using an automated tool such as watin or ieunit/.
You can think of these in terms of unit testing, but they are really testing the end result after integration instead of testing the results of smaller functions. Although you may miss some lower level changes, you are bypassing the underlying design issues.
As long as your end result remains the same, your test will not care whether the area's content came from asp or SQL.
回答2:
WATiN will work great. It manipulates the browser, so it doesn't care what language the code is written in, or whether the code is good or bad, or designed for testability or not. It is regression testing, not unit testing. But that's an excellent place to start.
You can use your unit testing tool of choice: nUnit, mbUnit, MSTest, etc.
回答3:
You might have a look at ajaxed unit tests. (The library is still maintained)
回答4:
For the sql upgrade itself (and any other changes to sql code), I would have a look at Sql Unit (haven't used it) or something similar to implement unit tests on just the database.
You can do this alongside whatever other testing strategies you select.
Do be aware of the downsides to testing through the UI: http://blog.objectmentor.com/articles/2010/01/04/ui-test-automation-tools-are-snake-oil. Understand that tests via UI are generally fragile when designers want to make changes that should be OK for them to make. For strictly upgrading SQL versions, however, you should be fine.
来源:https://stackoverflow.com/questions/1239494/unit-testing-for-vbscript-asp-code-and-sql-server-2000