简体   繁体   English

Selenium Web驱动程序(PHP或JAVA)

[英]Selenium Web Driver (PHP or JAVA)

We need to write some automated UI Tests on a project which is done entirely in PHP Kohana Framework, all of our engineers have experience with PHP language but none in Java. 我们需要在一个完全在PHP Kohana Framework中完成的项目上编写一些自动UI测试,我们所有的工程师都有使用PHP语言但没有使用Java语言的经验。

But there seems to be a short amount of alternatives regarding the use of phpunit with selenium server and no official support for PHP. 但是关于phpunit与selenium服务器的使用以及没有官方支持PHP似乎存在少量替代方案。 If we use the class at phpunit's page we would be stuck with Selenium RC1 server and that's not something we would want as our site has a lot of ajax and dynamic content. 如果我们在phpunit的页面上使用该类,我们将会遇到Selenium RC1服务器,这不是我们想要的,因为我们的网站有很多ajax和动态内容。 We've read that there are 3 different projects that make use of selenium Json Wire protocol in order to give compatibility with webdriver options. 我们已经读过,有3个不同的项目使用了selenium Json Wire协议,以便与webdriver选项兼容。 But the facebook one seems incomplete, even send keys are not implemented but looks flexible to add our own code and functionality. 但Facebook的一个似乎不完整,即使发送密钥没有实现,但看起来很灵活,添加我们自己的代码和功能。 The chibimagic webdriver has an awful convention (using underscores vs camel case) which would break our own conventions and we don't like it that much. chibimagic webdriver有一个可怕的约定(使用下划线vs驼峰的情况),这将破坏我们自己的约定,我们不喜欢它那么多。 We think Lukasz Kolczynski class is the best of them but having to rely an important project to one single guy who could leave the project doesn't seem as a smart option. 我们认为Lukasz Kolczynski班级是他们中最好的,但不得不依赖一个重要的项目给一个可以离开项目的人,这似乎不是一个明智的选择。

What would you do if this was your project? 如果这是你的项目,你会怎么做? we can't afford a QA engineer right now so two of our developers will write the tests for the moment and they know nothing of Java, they would require training in the language and the tools and looks like a good long term option but a very costly one. 我们现在买不起QA工程师,因此我们的两位开发人员暂时会编写测试,他们对Java一无所知,他们需要接受语言和工具方面的培训,看起来是一个很好的长期选择但是非常好昂贵的。 A lot of people seems to have this same question but I haven't heard yet a good answer. 很多人似乎都有同样的问题,但我还没有听到一个好的答案。

In the end what we decided to do was to create our own library to interact with the Selenium Json Wire Protocol and share it to the community. 最后,我们决定创建自己的库,与Selenium Json Wire Protocol进行交互,并将其分享给社区。

We aimed to make it as similar as possible with the examples from other language official libraries so any example from Java would have a very similar syntax in php. 我们的目的是使其与其他语言官方库中的示例尽可能相似,因此Java中的任何示例都将在php中具有非常相似的语法。

Here's the link, hope it helps someone else: https://github.com/Nearsoft/PHP-SeleniumClient 这是链接,希望它可以帮助其他人: https//github.com/Nearsoft/PHP-SeleniumClient

If you like it share it, get involved, fork it or do as you please. 如果您喜欢它,请分享,参与,分叉或随心所欲。

Regards, Mark. 问候,马克。

We have Selenium tests using the V1 server now and haven't had a chance to investigate the options. 我们现在使用V1服务器进行Selenium测试,并且没有机会调查这些选项。 I would expect the PHP web-driver projects to improve over time and would probably start there since you'll be up and running quickly. 我希望PHP Web驱动程序项目能够随着时间的推移而改进,并且可能会启动,因为您将快速启动并运行。

As for using Java, the syntax is extremely similar to PHP, and the test code itself won't rely too much on Java-specifics beyond the Selenium API. 至于使用Java,语法与PHP非常相似,测试代码本身不会过多依赖Selenium API之外的Java特定。 Setting up the tools can be a PITA, but you should be able to find plenty of help online for that. 设置工具可以是PITA,但您应该能够在线找到大量的帮助。 Still, introducing a new language just for testing seems like a risk best avoided if possible. 尽管如此,如果可能的话,引入一种仅用于测试的新语言似乎是最好的风险。

I would still investigate on java. 我还是会研究java。

Selenium in Java is very very easy and even more is WebDriver. Java中的Selenium 非常简单 ,WebDriver就更多了。 Just Google the tutorials, your engineers will be able to reproduce soon. 只需Google的教程,您的工程师就能很快重现。

Suggested tools: Eclipse, JUnit, Selenium 2 推荐的工具:Eclipse,JUnit,Selenium 2

Perhaps a javascript testing framework would work? 也许一个javascript测试框架可以工作?
You can do UI tests with a javascript framework and your developers should know javascript. 你可以使用javascript框架进行UI测试,你的开发人员应该知道javascript。

See this thread. 看到这个帖子。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM