canoo 或 jwebUnit 用于自动化无头 Web 客户端?
我正在用 grails 用 groovy 编写一个应用程序,它需要对几个网站进行一些自动使用。因此,我需要能够执行与功能性 Web 应用程序测试类似的任务,而不需要浏览器。我还希望它尽可能轻,当然是完全无头的。
到目前为止,我知道有两种选择。 Canoo 有一个不错的 grails 插件,还有一个方便的 firefox 记录器插件和 EasyB/JWebUnit,可以使用 Selenium 进行记录。
Canoo 看起来很重,我不知道我需要做什么才能让它在 grails 服务中整齐地运行。
也许我的想法是错误的。这里有人用 Java 或 Groovy 做过这种事情吗?也许我最好放弃在命令行上使用curl ?
I'm writing an application in groovy with grails that needs to do some automated usage of a couple of websites. So I need something that will perform a similar task to functional web application testing, without a browser being needed. I would also like it to be as lightweight as possible and of course completely headless.
There are two options that I am aware of so far. Canoo which has a nice grails plugin and conveniently also a firefox recorder plugin and EasyB/JWebUnit which can be recorded with Selenium.
Canoo seems very heavy and I don't know what I'd have to do to get it to run in a grails service neatly.
Perhaps I'm thinking about this wrongly though. Has anyone here done this kind of thing in Java or Groovy? Am I better off just dropping out to curl on the command line perhaps?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否考虑过只发送网络请求?也许您不需要一个完整的无头浏览器,这样的一行
就足够您的应用程序使用了?
当您必须单击虚拟按钮时,测试工具或框架非常有用。但如果您只需远程控制网站,发送请求就足够了。
更新:如果您需要发送 POST 请求并处理 cookie,那么 Url-Class 是不够的。但您可以改用 http 构建器。以下是两个可以帮助您入门的 URL:
Have you though about just sending your web requests? Maybe you don't need a full blown headless browser and a line like
is enough for your app?
A testing tool or framework is great when you have to click virtual buttons. But if you only have to remote control a website, sending a request could be enough.
Update: if you need to send POST requests and handle cookies, then the Url-Class isn't enough. But you can use the http builder instead. Here are two URLs which will get you started: