为什么是 testFixture 而不是 TestClass? [英] Why testFixture instead of TestClass?

查看:51
本文介绍了为什么是 testFixture 而不是 TestClass?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有三种组织单元测试的方法:按夹具、类或功能测试.但是 TestClass 的 NUnit 属性称为 TestFixture.这有什么历史原因吗?

There are three ways to organize unit tests: Test per Fixture, Class or Feature. But NUnit attribute for TestClass is called TestFixture. Are there any historical reasons for that?

推荐答案

主要的历史原因是 NUnit 最初是作为 JUnit 的直接端口而诞生的,junit 将其称为测试装置.

The main historical reason is that NUnit started life as a straight port from JUnit and junit called it test fixture.

NUnit 1.0 出现在我之前,但有人告诉我它是通过将 JUnit 中的所有 .java 文件重命名为 .cs 文件并尝试编译来开始的.它是从那里修复的,并添加了一个用户界面.当我加入 NUnit 2.0 时,NUnit 1.0 中仍有一个名为 IsVisualAgeForJava 的方法,因为当时 JUnit 对此有特殊行为.

NUnit 1.0 was before my time but I've been told it started out by renaming all of the .java files in JUnit to .cs files and trying to compile. It was fixed up from there and a UI was added. When I joined on for NUnit 2.0 there was still a method in NUnit 1.0 called IsVisualAgeForJava since JUnit had special behavior for that at the time.

在 NUnit 2.0 中,我们的目标是让 NUnit 更像 .NETish.所以我们添加了属性和一堆其他东西.我们所有人都来自 Java 背景,并与 JUnit 合作多年.使用 [TestFixture] 似乎很自然.

In NUnit 2.0 our aim was to make NUnit more .NETish. So we added the attributes and a bunch of other stuff. All of us came from java backgrounds and had worked with JUnit for years. It seemed quite natural to use [TestFixture].

这篇关于为什么是 testFixture 而不是 TestClass?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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