Web应用程序的单元测试和开发 [英] Unit Testing and Development of webapplication

查看:75
本文介绍了Web应用程序的单元测试和开发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的印象是,开发人员无需担心Web应用程序的测试方面.测试角色对开发人员的重要性是什么?开发人员是否应该对基于……的开发的WEB应用程序进行任何测试,例如:C#.net 3层体系结构.我应该知道什么样的测试方法才能达到2年的工作经验.

I was under the impression that a developer don''t need to worry about the testing side of web application. Whats the importance of testing role for a developer.Should the developer be doing any testing for a WEB application that''s developed on...say for eg: C#.net 3 tier architecture . What testing methods should i be aware to get to a 2yr experience position.

推荐答案

如果您觉得开发人员无需担心Web应用程序的测试方面",您可能在判断方面存在一般性问题.忘记质量检查部门-他们可能做得不好,也可能做得不好(在许多组织中,质量检查是一个未解决的问题).

未经测试,几乎不可能进行任何开发.整个开发过程应包括主要和最重要的活动,即开发过程中进行测试";这与单元测试 http://en.wikipedia.org/wiki/Unit_testing的概念有关 [^ ].

测试不足是许多开发人员的大问题.让我们以ASP.NET开发为例.在运行和测试网页(通过Visual Studio调用开发HTTP服务器可以轻松完成)之前,应分别测试开发中使用的所有或多或少复杂的类型/方法.

开发人员应该养成定期创建和运行特殊测试项目的习惯,即使并不需要开发团队采用的开发过程也是如此(如果不需要,则意味着这是以下两项之一):您正在进行小规模的低礼节性开发,其中开发人员可以信任测试和其他特定方面,或者2)开发过程很糟糕.

有不同的框架可以简化该过程,但是开发人员仍然要承担一致性和使用测试代码的真正责任.例如,请参阅 Microsoft单元测试框架( http ://msdn.microsoft.com/en-us/library/ms243147(v = vs.80).aspx [http://en.wikipedia.org/wiki/NAnt [ ^ ]).

关于开发方法和测试,请参见测试驱动的开发: http://en.wikipedia .org/wiki/Test-driven_development [ ^ ]

—SA
If you "had the impression that a developer don''t need to worry about the testing side of web application" you probably have a general problem with judgment. Forget about QA department — they may or may not do their work well (and in many organization QA is the unresolved problem).

Any development is barely possible without testing. Whole development process should include the primary and most important activity called "test as you develop"; and this is related to the concept of unit testing http://en.wikipedia.org/wiki/Unit_testing[^].

Insufficient testing is big the problem in many developers. Let''s take ASP.NET development. Before running and testing Web pages (which is easily done with the development HTTP server invoked via Visual Studio) all of the more or less complex types/methods used in the development should be tested separately.

A developer should develop a habit to create and run special test projects an a regular basis, even if it is not required be a development process adopted in the development team (and if this is not required, it means one of the two: 1) you''re doing small-scale low-ceremony development where testing and other particular aspects are trusted to developers, or 2) the development process sucks).

There are different frameworks to facilitate the process, but the real responsibility for consistency and use of the testing codes is still on the developers. For example, see Microsoft Unit Testing Framework (http://msdn.microsoft.com/en-us/library/ms243147(v=vs.80).aspx[^]) or NAnt (http://en.wikipedia.org/wiki/NAnt[^]).

As to the development methods and testing, see Test-driven development: http://en.wikipedia.org/wiki/Test-driven_development[^]

—SA


单元测试是开发中最重要的阶段之一.我认为,每当您实际估算开发时间时,就应将与单元测试所花费的时间一样多地花在实际开发中.如果您对单元进行彻底的测试,则可以减少错误,从而减少了修复错误的成本.请记住,在开发生命周期中较早修复错误要比后来更便宜.

您应该首先在服务端组件上进行测试.您可以使用诸如VS内置测试框架或NUnit之类的工具对所有服务器端公共方法进行全面测试(确保私有方法被这些公共方法覆盖).

通常,确保所有边界通过都没有错误并且不会发生诸如null异常之类的错误是开发人员单元测试的一部分,应由开发人员自己完成.
Unit testing is one of the most important phases of development. In my opinion, everytime you are actually estimating time for development, you should include as much time as you spend in unit testing as you spend in actual development. If you unit test thoroughly, bugs are reduced and hence the cost of fixing the bug. Remember, a bug is much cheaper to fix earlier in the development life-cycle than later.

You should be doing testing on the service side components first. You could use a tool like the VS inbuilt testing framework or NUnit to do a thorough test of all server side public methods (making sure private methods are covered via those public methods).

In general, making sure all boundary pass without error and errors like null exceptions do not occur are part of developer unit testing and should be done by the developers themselves.


这篇关于Web应用程序的单元测试和开发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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