测试Web应用程序中的链接 [英] Testing links in a web app

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

问题描述

我需要测试Web应用程序内的链接.我看过几个工具(Xenu,各种浏览器插件,link-checker(ruby)).没有什么能完全满足我的需求,我将在下面详细介绍.

I need to test links inside a web application. I have looked at a couple tools (Xenu, various browser plugins, link-checker(ruby)). Nothing quite fits my needs which I will detail below.

  • 我需要通过登录表单
  • 需要针对不同类型的用户(多组登录凭据)重新运行测试
  • 想在ci服务器(Jenkins)下自动执行此操作
  • 抓取网站的能力

有人有什么想法吗?如果我可以使用Ruby来做到这一点,那就好了!

Does anyone have any ideas? Bonus if I can use Ruby to do this!

推荐答案

一旦您具备了对网站进行爬网的能力,您所要求的就超出了大多数测试工具的范围.

What you are asking for is beyond most of the test tools once you throw in the ability to spider the site.

最终要求将您带入手工编码领域.使用Mechanize gem可以完成所有这些操作,但是,您需要对网站的很多导航进行编码.

That final requirement pushes you into the realm of hand-coding something. Using the Mechanize gem you could do all those things, but, you get to code a lot of the navigation of the site.

Mechanize在内部使用Nokogiri,因此很容易抓取页面中的所有链接,您可以将其存储在数据库中以供其他线程或后续代码检查.就是说,如果您是要访问的页面的所有者,那么编写Spider并不难,因为您可能会非常残酷地访问服务器并让代码以全速运行,而不必担心会因带宽占用过多而被禁止

Mechanize uses Nokogiri internally, so it's easy to grab all links in a page, which you could store in a database to be checked by a different thread, or some subsequent code. That said, writing a spider is not hard if you're the owner of the pages you're hitting, because you can be pretty brutal about accessing the server and let the code run at full speed without worrying about being banned for excessive bandwidth use.

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

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