将单元测试添加到现有的 asp.net web 表单应用程序

编程入门 行业动态 更新时间:2024-10-25 12:19:17
本文介绍了将单元测试添加到现有的 asp web 表单应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个现有的 asp webforms 应用程序,我想向其中添加一些单元测试,但不确定如何去做.

I have an existing asp webforms application that I would like to add some unit testing to but am unsure of exactly how to go about it.

该应用程序是具有功能的数据库驱动,我想您可以将其与高级论坛进行比较.逻辑、数据访问和呈现大部分是分开的.

The application is database driven with functionality I guess you could compare to an advanced forum. Logic, data access and presentation are seperated for the most part.

我应该测试哪些方法?

如何处理数据库和测试数据?

How do I handle the database and test data?

有没有推荐的工具可以帮助解决这个问题?

Are there any tools recommended to assist in this?

推荐答案

您需要决定的第一件事是:您添加单元测试的动机是什么?

The first thing you need to decide is: What is your motivation for adding unit tests?

进行单元测试有很多很好的理由(我自己严格实践 TDD),但是知道哪个是您的案例的主要驱动力应该有助于您决定首先编写哪些测试.

There are many excellent reasons for having unit tests (I rigorously practice TDD myself), but knowing which one is the main driving force in your case should help you decide which tests to first write.

在大多数情况下,您应该专注于为过去给您带来最大痛苦的应用领域编写单元测试.

In most cases you should concentrate on writing unit tests for the areas of your application that have been causing you the most pain in the past.

大量经验表明,当软件最初是在没有单元测试的情况下编写的,随后很难改进单​​元测试.有效地使用遗留代码 提供了关于如何有效地使用旧代码的宝贵指导使未经测试的软件项目可测试.

Much experience has shown that when software originally was written without unit tests, it can be hard to subsequently retrofit unit tests. Working Effectively with Legacy Code provides valuable guidance on how to make an untested software projects testable.

更多推荐

将单元测试添加到现有的 asp.net web 表单应用程序

本文发布于:2023-11-14 11:31:58,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1587100.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:表单   应用程序   单元测试   net   asp

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!