Automated testing of webrtc application?

2019-04-13 14:41发布

问题:

I am developing a conferencing app, details:

  • target: chrome browser

  • server: node.js ( currently windows env)

simplest test scenario would be:

  1. open two browser tabs( open browser if need be)
  2. emulate button click on both.
  3. emulate accept getUserMedia request( hardest part)
  4. more emulation stuff and reading JavaScript variable values and verifying them.

Till now, I have been doing manual testing for all of this, but decided that it would be impractical for the long run. I have not done much automated testing( just a bit of unit testing). Initially, i thought mocha would do the job, but beginning to think it is not enough.

I need some pointers as to what are tools or alternate test frameworks needed to achieve browser starting, tab opening and giving media sharing permissions.

回答1:

Chrome has command line flags for skipping get getUserMedia permission as well as using fake devices:

  • --use-fake-ui-for-media-stream (skips GUM permission prompt)
  • --use-fake-device-for-media-stream (uses a fake device)

Check http://blog.andyet.com/2014/09/29/testing-webrtc-applications, http://googletesting.blogspot.se/2014/08/chrome-firefox-webrtc-interop-test-pt-1.html for background information

If you want to click buttons, the standard tool for this is selenium. If you prefer Javascript to Java, a binding such as webdriver.io might be what you're looking for.



回答2:

If you like Ruby, take a look at Capybara. You'll probably also want to use Xvfb so that you can run the tests on a machine that doesn't have a display.

Here is an example snippet that will let you open Chome with the switches that Philipp suggests. I've used this to create a headless video recording test.

Capybara.register_driver :chrome do |app|
  switches = %w(disable-popup-blocking disable-translate use-fake-ui-for-media-stream use-fake-device-for-media-stream test-type)
  Capybara::Selenium::Driver.new(app, browser: :chrome, switches: switches)
end


回答3:

If you are looking for webrtc testing, you may like to see loadmultiplier.., it was answered here previously.