对于大型网络应用程序来说,早期阶段是否需要进行单元测试和功能测试?

发布于 2024-11-10 05:13:16 字数 192 浏览 3 评论 0原文

我刚刚学习了 Ruby on Rails,为了提高我的技能,我正在尝试构建一个大型 Web 应用程序。但直到今天,我对单元测试和功能测试感到非常困惑(我不知道如何编写它们)。我的问题是现在我可以开始构建应用程序并通过使用浏览器上的真实数据(作为实际用户尝试与应用程序交互)来测试应用程序,而不是编写测试代码吗?(最终,我将有一个专家介入并提供帮助写测试代码)。提前谢谢您

I just learned Ruby on Rails,and to advance my skills i am trying to build a large web application .But to this day i am really confused about unit test and functional test(i dont know how to write them).My question is for now can i start building the app and and test the the app by using real data on the browser (as actual user trying to interact with the app)instead of writing test code?(Eventually later on I will have an exepert jump in and help out writing the test code).Thank you in advance

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

巡山小妖精 2024-11-17 05:13:16

关于单元测试有一个简单的事实……在项目的早期开始单元测试非常容易。随着应用程序变得更加复杂,单元测试变得更加难以实施。

查看以下链接:

http://guides.rubyonrails.org/testing.html

您可以查找有关如何/为何进行 RoR 单元测试的一般信息。

谢谢,

汤姆

There is one simple truth about unit testing... it is much easy to start unit testing early on in your project. Unit testing becomes more difficult to implement as your application grows more complex.

Check out the following link:

http://guides.rubyonrails.org/testing.html

You can find general information on the how/why of unit testing for RoR.

Thanks,

Tom

赤濁 2024-11-17 05:13:16

在开发应用程序的过程中编写单元测试的好处之一是它将有助于保持代码的高质量。将单元测试有效地应用于编写得不好的代码库通常是极其困难甚至不可能的。即使您不认为代码质量很差,它也可能不符合某人针对其编写单元测试所需的标准。

如果您认真编写单元测试,那么在编写单元测试之前编写“行走骨架”通常被认为是可接受的做法 - 使应用程序处于可运行状态的尽可能少的代码。然而,您在编写第一个测试之后等待的时间越长,您就越有可能根本不会进行任何测试。

One of the benefits of writing Unit Tests while in the course of developing the application is that it will help keep your code of a high quality. It is often extremely difficult to impossible to effectively apply Unit Tests to a poorly written code base. Even if you wouldn't consider the code to be of poor quality, it may not be of the standard necessary for someone to write unit tests against it.

If you are serious about writing unit tests, it is often considered acceptable practice to write a "walking skeleton" - the smallest amount of code possible to get the application in a runnable state, before writing a unit test. However, the longer you wait after that to write your first tests the more likely you will be to never have any tests at all.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文