Our goal is to enable you to focus on your core logic. Therefore, testRTC takes care of the script’s generic and infrastructure parts, such as the script’s initialization and objects creation.
You should focus only on the script logic to test your service.
In the script we will use functions and commands from the following groups:
- Nightwatch/Selenium commands – the Nightwatch/Selenium commands handle all browsing related actions, such as navigating to specific web pages, clicking on buttons and screen artifacts, filling in form fields, etc. Detailed Nightwatch/Selenium API reference can be found in http://nightwatchjs.org/api#commands
- testRTC functions – testRTC functions were implemented in order to help you debug your service. testRTC functions supports actions such as take a screen shot and create a log message.
The client object that appear at the beginning of the script handles all Nightwatch/Selenium browsing related actions, such as navigating to specific web pages, clicking on buttons and screen artifacts, filling in form fields, etc.
All functions in the script return the client object and therefore a common method to scripts writing is chaining commands. When chaining commands, there is no need to add the semicolon symbol at the end of every command.
client .url() .setValue() .rtcScreenshot() .click()
Script general flow
In general, most of the scripts will be based on the following flow:
- Navigate to the service web page.
- If needed, enter some details (e.g. for video chat room, type user name and password to login).
- Click on a button to join a WebRTC session. At this point, the video call page should be loaded. As part of the video call page, the browser will be requested to stream the camera and microphone to the other parties in the call. When the camera and microphone streaming will be requested, testRTC will stream the selected video and audio media, instead the machine’s camera and microphone.
- Consume media. Ensure to consume the media for enough time so testRTC system will be able to collect enough QoS information.
- If needed, perform activities during the session, such as enter chat messages. In any case, we need to keep the test running for the requested time period. It can be done by using the pause command.
- The total script duration will actually set the test’s total duration.
- Test end / Session stop: While a WebRTC session is active, the browser collects statistical information that we will parse in order to present the test results, calculate test expectations, etc. If the browser will surf to a new URL, the browser will clear the WebRTC statistics and we will not be able to collect this information at the end of the test. Therefore please ensure that you will not surf to a new URL at the end of the WebRTC session.
Note that in many implementations, terminating a session will redirect the browser to a new URL. In such cases, please refrain from terminating the session. The session will be killed after we will collect the data and we will delete the instance that executed the test.For further information, please refer to https://testrtc.com/docs/looks-like-testmonitor-running-properly-see-failure-testrtc-report