Selenium Web驱动程序(PHP或JAVA)

时间:2020-12-24 15:20:57

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. 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. 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. But the facebook one seems incomplete, even send keys are not implemented but looks flexible to add our own code and functionality. 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. 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.

但是关于phpunit与selenium服务器的使用似乎存在少量替代方案,而且没有官方支持PHP。如果我们在phpunit的页面上使用该类,我们将会遇到Selenium RC1服务器,这不是我们想要的,因为我们的网站有很多ajax和动态内容。我们已经读过,有3个不同的项目使用了selenium Json Wire协议,以便与webdriver选项兼容。但Facebook的一个看起来不完整,即使发送密钥没有实现,但看起来很灵活,添加我们自己的代码和功能。 chibimagic webdriver有一个可怕的约定(使用下划线vs驼峰的情况),这将破坏我们自己的约定,我们不喜欢它那么多。我们认为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. A lot of people seems to have this same question but I haven't heard yet a good answer.

如果这是你的项目,你会怎么做?我们现在买不起QA工程师,因此我们的两位开发人员目前都会编写测试,他们对Java一无所知,他们需要使用语言和工具进行培训,看起来是一个很好的长期选择但是非常好昂贵的。很多人似乎都有同样的问题,但我还没有听到一个好的答案。

4 个解决方案

#1


1  

We have Selenium tests using the V1 server now and haven't had a chance to investigate the options. 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.

我们现在使用V1服务器进行Selenium测试,并且没有机会调查这些选项。我希望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. Setting up the tools can be a PITA, but you should be able to find plenty of help online for that. Still, introducing a new language just for testing seems like a risk best avoided if possible.

至于使用Java,语法与PHP非常相似,测试代码本身不会过多依赖Selenium API之外的Java特定。设置工具可以是PITA,但您应该能够在线找到大量帮助。尽管如此,如果可能的话,引入一种仅用于测试的新语言似乎是最好的风险。

#2


1  

I would still investigate on java.

我还是会研究java。

Selenium in Java is very very easy and even more is WebDriver. Just Google the tutorials, your engineers will be able to reproduce soon.

Java中的Selenium非常简单,WebDriver就更多了。只需Google的教程,您的工程师就能很快重现。

Suggested tools: Eclipse, JUnit, Selenium 2

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

#3


1  

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.

#4


0  

Perhaps a javascript testing framework would work?
You can do UI tests with a javascript framework and your developers should know javascript.

也许一个javascript测试框架可以工作?你可以使用javascript框架进行UI测试,你的开发人员应该知道javascript。

See this thread.

看到这个帖子。

#1


1  

We have Selenium tests using the V1 server now and haven't had a chance to investigate the options. 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.

我们现在使用V1服务器进行Selenium测试,并且没有机会调查这些选项。我希望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. Setting up the tools can be a PITA, but you should be able to find plenty of help online for that. Still, introducing a new language just for testing seems like a risk best avoided if possible.

至于使用Java,语法与PHP非常相似,测试代码本身不会过多依赖Selenium API之外的Java特定。设置工具可以是PITA,但您应该能够在线找到大量帮助。尽管如此,如果可能的话,引入一种仅用于测试的新语言似乎是最好的风险。

#2


1  

I would still investigate on java.

我还是会研究java。

Selenium in Java is very very easy and even more is WebDriver. Just Google the tutorials, your engineers will be able to reproduce soon.

Java中的Selenium非常简单,WebDriver就更多了。只需Google的教程,您的工程师就能很快重现。

Suggested tools: Eclipse, JUnit, Selenium 2

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

#3


1  

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.

#4


0  

Perhaps a javascript testing framework would work?
You can do UI tests with a javascript framework and your developers should know javascript.

也许一个javascript测试框架可以工作?你可以使用javascript框架进行UI测试,你的开发人员应该知道javascript。

See this thread.

看到这个帖子。