添加单元测试,以现有的asp.net web表单应用程序 [英] Adding unit testing to an existing asp.net web forms application

查看:114
本文介绍了添加单元测试,以现有的asp.net web表单应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个现有的asp.net web表单应用程序,我想补充一些单元测试,但我不确定究竟是如何去做。

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

该应用程序与数据库驱动的功能,我想你可以比较先进的论坛。逻辑,数据访问和presentation被分隔的大部分

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.

我应该测试什么方法呢?

What methods should I be testing?

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

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.

太多的经验表明,当软件最初是没有单元测试编写的,它可以是很难随后改造的单元测试。 与传统code 有效地开展工作提供了如何使一个未经测试的软件项目测试的宝贵的指导意见。

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表单应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆