在生产代码/服务器上运行测试 [英] Running test on Production Code/Server

查看:29
本文介绍了在生产代码/服务器上运行测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在单元测试/自动化测试方面相对缺乏经验,所以如果它没有任何意义,请原谅这个问题.

I'm relatively inexperienced when it comes to Unit Testing/Automated Testing, so pardon the question if it doesn't make any sense.

我正在处理的当前代码库是如此紧密耦合,以至于我需要重构大部分代码才能对其运行单元测试,因此我阅读了一些帖子并发现了 Selenium,我认为是一个非常酷的程序.

The current code base I'm working on is so tightly coupled that I'll need to refactor most of the code before ever being able to run unit tests on it, so I read some posts and discovered Selenium, which I think is a really cool program.

我的客户希望在我们的生产服务器上每十分钟运行一次特定的自动化测试,以确保我们的网站正常运行,并且某些功能/方面运行正常.

My client would like specific automated tests to run every ten minutes on our production server to ensure that our site is operational, and that certain features/aspects are running normally.

我从来没有真正想过要对生产服务器运行测试,因为你给网站增加了额外的压力.我一直认为您会针对暂存服务器运行所有测试,如果这些测试有效,那么只要托管服务提供商没有遇到问题,您就可以假设生产站点正常运行.

I've never really thought to run tests against a production server because you're adding additional stress to the site. I always thought you would run all tests against a staging server, and if those work, you can just assume the prouction site is operational as long as the hosting provider doesn't experience an issue.

您对在实际生产服务器上测试生产代码有何想法?

Any thoughts on your end on testing production code on the actual production server?

非常感谢大家!

推荐答案

如果您将 selenium 脚本视为监控"而不是测试",也许会有所帮助?我希望那里的每个主要网站都进行某种监视,即使它只是定期 PING 或每隔一段时间加载主页.虽然这种方式可能会走得太远,但总体上不要害怕这个概念.那么这种监控/测试对您和您的客户有哪些好处呢?

Maybe it would help if you thought of the selenium scripts as "monitoring" instead of "testing"? I would hope that every major web site out there has some kind of monitoring going on, even if it's just a periodic PING, or loading the homepage every so often. While it is possible to take this way too far, don't be afraid of the concept in general. So what might some of the benefits of this monitoring/testing to you and your client?

  1. 不知何故,并非世界上所有最好的测试都可以预测用户会做的奇怪事情,无论是有意的还是纯粹的数字力量(如果打字机上的 100 万只猴子可以写出哈姆雷特,想象一下几百次点击会快乐用户可以做到吗?ping 站点可以告诉您它是否已启动,但如果表已损坏并且报告现在失败,则无法告诉您,这一切都是因为用户输入了一个带有变音符号的值.

  1. Somehow not all the best testing in the world can predict the odd things users will do, either intentionally or by sheer force of numbers (if 1 million monkeys on typewriters can write Hamlet, imagine what a few hundred click happy users can do? Pinging a site can tell you if it's up, but not if a table is corrupted and a report is now failing, all because a user typed in a value with a umlaut in it.

虽然您的网站可能在登台服务器上表现出色,但随着时间的推移,它可能会开始退化.如果您正在监控这些硒测试的性能,您可以领先于缓慢的投诉.当然,正如您所提到的,请确保您的监控也不会引起问题!您可能必须让您的客户相信,某些测试适合每 X 分钟运行一次,而其他测试只应在每天凌晨 3 点运行一次.

While your site might perform great on the staging servers, maybe it will start to degrade over time. If you are monitoring the performance of those selenium tests, you can stay ahead of slowness complaints. Of course as you mentioned, be sure your monitoring isn't causing problems either! You may have to convince your client that certain test are appropriate to run every X minutes, and others should only be run once a day, at 3am.

如果您最终对实时站点进行紧急更改,您将更有信心知道测试正在运行以确保一切正常.

If you end up making an emergency change to the live site, you'll be more confident knowing that tests are running to make sure everything is ok.

这篇关于在生产代码/服务器上运行测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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