Skip to content

Commit 6fa204e

Browse files
[ONEM-25820] Major refactor (#21)
* [ONEM-25820] Major refactor This change aims to simplify the codebase, especially in the area of tests declaration. Tests declaration has been moved into |suites.js|, where each test suite explicitly declares its own tests. There are still some helper functions for creation of multiple tests at once (makeMvtMediaTests), but I personally find it much more readable. Current approach also gives us much greater control when it comes tests selection and parametrization (e.g. now we can mark some tests unstable on a given test suite). In addition: - Declare name for each stream, so it can be accessed directly - Drop unnecessary attributes from stream mediaStreams.js - Greatly simplify profiles.js - Drop blocklist - now unstable tests are declared in suites.js - Rework codecSupportTests.js - Rework coverage.js - Extend readme - Add skipping specific test by name Co-authored-by: Lukasz Rutkowski <lukasz.rutkowski@consult.red>
1 parent edcb845 commit 6fa204e

16 files changed

+1014
-1455
lines changed

README.md

Lines changed: 108 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Test streams use different audio/video/subtitles codecs and media containers. Fo
3232

3333
## Source
3434

35-
git clone git@github.com:rdkcentral/mvt.git
35+
git clone git@github.com:rdkcentral/MVT.git
3636
./prepare_submodule.sh
3737

3838
### Relation to js_mse_eme
@@ -100,24 +100,6 @@ A list of of all external media assets used by a deployed instance of MVT:
100100
| HSS-AVC1-AAC | [Microsoft PlayReady](https://testweb.playready.microsoft.com/Content/Content2X) | http://amssamples.streaming.mediaservices.windows.net/683f7e47-bd83-4427-b0a3-26a6c4547782/BigBuckBunny.ism/manifest(format=mpd-time-csf) | Not distributed by MVT, used for playback during test execution |
101101
| HSS-AVC1-AAC | [Microsoft PlayReady](https://testweb.playready.microsoft.com/Content/Content2X) | http://profficialsite.origin.mediaservices.windows.net/c51358ea-9a5e-4322-8951-897d640fdfd7/tearsofsteel_4k.ism/manifest | Not distributed by MVT, used for playback during test execution |
102102

103-
## Development
104-
105-
1. [Deploy](#deployment) the application
106-
2. [Stop the container](#stop-mvt) - it works on build-time static copy of source files
107-
3. Start development container with:
108-
109-
```
110-
docker run -v $PWD/:/usr/local/apache2/htdocs -v $TEST_MATERIALS_SRC:/usr/local/apache2/htdocs/test-materials -p 8080:80 --rm -d -it --name mvt-app mvt-app-img:latest
111-
```
112-
113-
Now you can modify MVT source code and observe changes on: http://localhost:8080
114-
115-
### Prettier
116-
117-
Source files are auto formatted by [prettier](https://prettier.io/), which should be used before committing any changes:
118-
119-
prettier -w .
120-
121103
## User Interface
122104

123105
![alt text](docs/main_view.png "Main view")
@@ -134,8 +116,8 @@ There are six media test templates:
134116

135117
- `Playback` verifies basic playback and media position progress on the span of 10 seconds
136118
- `Pause` verifies if browser is capable of pausing a stream
137-
- `Rate` verifies playback with various playback rates
138-
- `Position` executes seek operation
119+
- `PlayRate` verifies playback with various playback rates
120+
- `Seek` executes seek operation
139121
- `AudioTracks` changes audio track
140122
- `Subtitles` activates text tracks and verifies its content
141123

@@ -147,12 +129,12 @@ All interactive elements are navigable via arrow keys and can be selected throug
147129

148130
Test execution can be controlled through URL parameters, e.g. to run `DASH Shaka` tests 1,2,3 on Shaka Player version 2.5.20 use:
149131

150-
http://MVT_INSTANCE_ADDRESS?test_type=dash-shaka-test&tests=1-3&engine_shaka=2.5.20
132+
http://MVT_INSTANCE_ADDRESS/?test_type=dash-shaka-test&tests=1-3&engine_shaka=2.5.20
151133

152134
Most of the URL parameters can be combined. Here's a full list of supported queries:
153135

154136
- `test_type=SUITE_NAME` - test suite selection. Expected values:
155-
- codecsupport-test
137+
- codec-support-test
156138
- dash-html5-test
157139
- dash-shaka-test
158140
- dash-dashjs-test
@@ -181,26 +163,26 @@ It produces a JSON-like object, which should be easy to read by any automated te
181163

182164
```
183165
{
184-
"name": "codecsupport-test",
166+
"name": "codec-support-test",
185167
"setup_log": "",
186168
"suites": [],
187169
"teardown_log": "",
188170
"tests": [
189171
{
190-
"log": "[2022-05-04T12:27:02.799Z] TestExecutor: Test 1:video/mp4; codecs=\"avc1.64002a\"(avc1) STARTED with timeout 30000 \n[2022-05-04T12:27:02.800Z] TestExecutor: checking video/mp4; codecs=\"avc1.64002a\" \n[2022-05-04T12:27:02.800Z] TestExecutor: Test 1:video/mp4; codecs=\"avc1.64002a\"(avc1) PASSED. \n",
191-
"name": "video/mp4; codecs=\"avc1.64002a\"(avc1)",
172+
"log": "[2022-07-20T14:05:17.007Z] TestExecutor: Test 1:IsTypeSupported video/mp4 avc STARTED with timeout 30000 \n[2022-07-20T14:05:17.010Z] TestExecutor: Executing IsTypeSupported test for avc (video/mp4; codecs=\"avc1.4d002a\") \n[2022-07-20T14:05:17.014Z] TestExecutor: Test 1:IsTypeSupported video/mp4 avc PASSED. \n",
173+
"name": "IsTypeSupported video/mp4 avc",
192174
"status": "passed",
193-
"suites_chain": "MVT_SUITE.codecsupport-test",
194-
"time_ms": 2,
175+
"suites_chain": "MVT_SUITE.codec-support-test",
176+
"time_ms": 7,
195177
"type": "test_result",
196178
"ver": "1.0"
197-
},
179+
}
198180
{
199-
"log": "[2022-05-04T12:27:02.804Z] TestExecutor: Test 2:video/mp4; codecs=\"hvc1.2.4.L153.00\"(hevc) STARTED with timeout 30000 \n[2022-05-04T12:27:02.805Z] TestExecutor: checking video/mp4; codecs=\"hvc1.2.4.L153.00\" \n[2022-05-04T12:27:02.805Z] TestExecutor: Test 2:video/mp4; codecs=\"hvc1.2.4.L153.00\"(hevc) FAILED \n[2022-05-04T12:27:02.807Z] TestExecutor: Test 0.0.0.1:video/mp4; codecs=\"hvc1.2.4.L153.00\"(hevc) threw an error: Assert failed: canPlayType should be probably for video/mp4; codecs=\"hvc1.2.4.L153.00\" \n",
200-
"name": "video/mp4; codecs=\"hvc1.2.4.L153.00\"(hevc)",
201-
"status": "failed",
202-
"suites_chain": "MVT_SUITE.codecsupport-test",
203-
"time_ms": 4,
181+
"log": "[2022-07-20T14:05:17.020Z] TestExecutor: Test 2:IsTypeSupported video/mp2t avc STARTED with timeout 30000 \n[2022-07-20T14:05:17.023Z] TestExecutor: Executing IsTypeSupported test for avc (video/mp2t; codecs=\"avc1.4d002a\") \n[2022-07-20T14:05:17.027Z] TestExecutor: Test 2:IsTypeSupported video/mp2t avc FAILED \n[2022-07-20T14:05:17.032Z] TestExecutor: Test :IsTypeSupported video/mp2t avc threw an error: Assert failed: MediaSource.isTypeSupported should be true for video/mp2t; codecs=\"avc1.4d002a\" \n",
182+
"name": "IsTypeSupported video/mp2t avc",
183+
"status": "skipped",
184+
"suites_chain": "MVT_SUITE.codec-support-test",
185+
"time_ms": 13,
204186
"type": "test_result",
205187
"ver": "1.0"
206188
}
@@ -219,10 +201,100 @@ It is still supported, but it uses different output format and does not include
219201

220202
- <span style="color:yellow">Unsupported</span> - case is unsupported, either by container, player or WPEWebKit.
221203
- <span style="color:red">Supported, no content</span> - case is not covered by MVT test suite.
222-
- <span style="color:green">Supported</span> - case is represented by `x` media streams. Please note that it does not mean that related tests pass on the active device - it is just a coverage view which does not verify test results.
204+
- <span style="color:green">Supported</span> - case is represented by `x` tests. Please note that it does not mean that related tests pass on the active device - it is just a coverage view which does not verify test results.
223205

224206
![alt text](docs/coverage.png "Coverage")
225207

208+
## Development
209+
210+
1. [Deploy](#deployment) the application
211+
2. [Stop the container](#stop-mvt) - it works on build-time static copy of source files
212+
3. Start development container with:
213+
214+
```
215+
docker run -v $PWD/:/usr/local/apache2/htdocs -v $TEST_MATERIALS_SRC:/usr/local/apache2/htdocs/test-materials -p 8080:80 --rm -d -it --name mvt-app mvt-app-img:latest
216+
```
217+
218+
Now you can modify MVT source code and observe changes on: http://localhost:8080/
219+
220+
### General
221+
222+
`index.html` is the entrypoint to the application.
223+
It loads all required scripts in a specific sequence, most importantly, `suites.js`,
224+
where all MVT tests are declared. Once all files are loaded, `startMseTest` function is triggered in order to
225+
start `js_mse_eme` submodule and to render the UI.
226+
227+
### Adding new tests
228+
229+
MVT test cases are a product of test templates (`src/mediaTests.js`) and media streams (`mediaStreams.js`).
230+
Test templates provide the actual test implementation, which can be parametrized with a given media stream.
231+
It means that e.g. `DASH_FMP4_AVC_AAC Playback` and `DASH_FMP4_MPEG2_MP3 Playback` load different media content,
232+
but the test code is exactly the same (`src/mediaTests.js::testPlayback`). Such approach allows us for verification
233+
of browser behavior depending on the media stream properties.
234+
Furthermore, tests are splitted into suites (`suites.js`). Suites differ in type of streaming (e.g. DASH, progressive)
235+
and player (e.g. Shaka, native).
236+
237+
With that in mind, if you wish to extend MVT with a media stream, then its enough to simply declare it in
238+
`mediaStreams.js` e.g.
239+
240+
```
241+
// Media Streams
242+
var MS = {
243+
DASH: {
244+
....
245+
PLAYREADY_3_0: {
246+
variant: "dash",
247+
container: "fmp4",
248+
video: {
249+
codec: "avc",
250+
},
251+
audio: {
252+
codec: "aac",
253+
},
254+
src: "MANIFEST URL",
255+
drm: {
256+
servers: {
257+
"com.microsoft.playready":
258+
"LICENSE SERVER URL",
259+
},
260+
},
261+
},
262+
```
263+
264+
Then the stream has to be added to some test suites in `suites.js`
265+
266+
Hoverer, if you wish to implement a new test template, then you have to create `TestTemplate` object:
267+
268+
```
269+
let complicatedTest = new TestTemplate(`complicatedTest`, function (runner, video) {
270+
// Test code
271+
// |video| refers to active HTML5 video node
272+
// |runner| can be used for interactions with the test framework:
273+
runner.log(`Executing complicatedTest...`);
274+
// Failed assertion breaks test execution
275+
runner.assert(video.currentTime >= 0, `message on assertion failure`);
276+
// Call |runner.succeed| function to mark test as passed
277+
runner.succeed();
278+
});
279+
```
280+
281+
The new template has be binded with media stream and added into a test suite (see `suites.js`):
282+
283+
```
284+
(function () {
285+
const testSuite = "DASH dashjs";
286+
....
287+
tests.push(new MvtMediaTest(complicatedTest, MS.DASH.PLAYREADY_3_0, engine));
288+
```
289+
290+
Now test case 'DASH_PLAYREADY_3_0 complicatedTest` should appear under 'DASH dashjs' test suite.
291+
292+
### Prettier
293+
294+
Source files are auto formatted by [prettier](https://prettier.io/), which should be used before committing any changes:
295+
296+
prettier -w .
297+
226298
## Continuous Integration
227299

228300
MVT provides API for triggering tests and gathering results,
@@ -267,7 +339,7 @@ CI job which setups DUT, starts test suites and gathers results.
267339
In example, to execute `DASH shaka` test suite the test runner should:
268340

269341
1. Start `WebBrowser` and connect to `WebDriver`
270-
2. Start test suite by setting URL to `http://MVT_INSTANCE_ADDRESS?test_type=dash-shaka-test&command=run`
342+
2. Start test suite by setting URL to `http://MVT_INSTANCE_ADDRESS/?test_type=dash-shaka-test&command=run`
271343
3. Wait till tests finishes i.e. till `WebDriver`'s:
272344

273345
`return globalRunner.currentTestIdx == globalRunner.testList.length`

coverage.html

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,18 @@
4040
"js_mse_eme/harness/test.js",
4141
"js_mse_eme/lib/mse/msutil.js",
4242
"js_mse_eme/lib/mse/mediaSourcePortability.js",
43+
"test-materials/js/countdown-de.js",
44+
"test-materials/js/countdown-en.js",
45+
"test-materials/js/countdown-fr.js",
46+
"test-materials/js/countdown-es.js",
47+
"src/constants.js",
48+
"src/common.js",
4349
"mediaStreams.js",
4450
"src/mvtTest.js",
45-
"src/common.js",
4651
"src/engineChange.js",
47-
"src/blocklist.js",
48-
"src/baseConfig.js",
4952
"src/profiles.js",
5053
"src/engines.js",
51-
"src/codecSupport.js",
5254
"src/mediaTests.js",
53-
"src/codecSupportTests.js",
5455
"src/suites.js",
5556
"src/coverage.js",
5657
"js_mse_eme/harness/main.js",
@@ -71,7 +72,7 @@
7172
};
7273
document.head.appendChild(script);
7374
} else {
74-
GenerateCoverage();
75+
generateCoverage();
7576
}
7677
})();
7778
</script>

index.html

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,14 @@
4646
"test-materials/js/countdown-en.js",
4747
"test-materials/js/countdown-fr.js",
4848
"test-materials/js/countdown-es.js",
49+
"src/constants.js",
50+
"src/common.js",
4951
"mediaStreams.js",
5052
"src/mvtTest.js",
51-
"src/common.js",
5253
"src/engineChange.js",
53-
"src/blocklist.js",
54-
"src/baseConfig.js",
5554
"src/profiles.js",
5655
"src/engines.js",
57-
"src/codecSupport.js",
5856
"src/mediaTests.js",
59-
"src/codecSupportTests.js",
6057
"src/suites.js",
6158
"js_mse_eme/harness/main.js",
6259
];

0 commit comments

Comments
 (0)