简体   繁体   English

无需打开浏览器或任何 UI 的自动化测试

[英]Automation Testing without opening browser or any UI

I have been doing automation testing and it is working fine.我一直在做自动化测试,它工作正常。 It is working like open a browser, interact with elements and execute test cases based on given conditions.它的工作方式类似于打开浏览器,与元素交互并根据给定条件执行测试用例。

I am using Selenium Webdriver, TestNG, Java and Maven for this.我为此使用了 Selenium Webdriver、TestNG、Java 和 Maven。

Now from seniorI got request that we perform same test cases without open browser or interact with UI.现在从高级我收到要求我们在不打开浏览器或与 UI 交互的情况下执行相同的测试用例。 How it is possible in selenium webdriver?在 selenium webdriver 中怎么可能?

They said they will provide me API, It is possible to do same using API.他们说他们会为我提供 API,使用 API 可以做同样的事情。 If yes then kindly provide a small example so that I can know more about it and will implement then.如果是,那么请提供一个小示例,以便我可以了解更多信息并在那时实施。

I have tried PhantomJS, HtmlUnitDriver but all have their disadvantage.我尝试过 PhantomJS、HtmlUnitDriver,但都有它们的缺点。 I think Xvfv is the better solution, no need to change code just run your script heedlessly.我认为 Xvfv 是更好的解决方案,无需更改代码,只需随意运行脚本即可。 Install Xvfb安装 Xvfb

sudo apt-get install xvfb

And use this command to run mvn script heedlessly并使用此命令随意运行 mvn 脚本

xvfb-run --server-args="-screen 0, 1624x1068x24" mvn test

I hope it will help you.我希望它会帮助你。

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

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