# GStreamer validate update
##### Thibault Saunier
###### GStreamer conference 2024
---
## What is validate
* Test framework for GStreamer
* test infrastructure (`ValidateMonitor` and `ValidateScenario`)
* test runner (`gst-validate-launcher`)
----
## The `.validatetest` file format
* Makes test consice
* Make writing test pretty simple
* Makes understanding the test simpler
Note:
Tests written in C are very verbose and often not so simple to understand
----
``` jproperties
meta,
args = {
"fakesrc num-buffers=1 ! fakesink name=sink",
},
configs = {
# Monitor the data flow in the sink sinkpad
# This first generate an expectation file (commited to git)
# and on subsequent runs, it will check that the flow matches
# the expectations
"$(validateflow), pad=sink:sink, buffers-checksum=true",
}
# The validate tool will simply play the pipeline until EOS is reached.
```
----
## Expectation file
``` jproperties
event stream-start: GstEventStreamStart, flags=(GstStreamFlags)GST_STREAM_FLAG_NONE, group-id=(uint)1;
event segment: format=BYTES, start=0, offset=0, stop=18446744073709551615, time=0, base=0, position=0
buffer: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709, dts=0:00:00.000000000, flags=discont
event eos: (no structure)
```
----
## gst-tester-1.0
* Tool in GStreamer core (only usable when GstValidate is available)
* You can now write your 'unit test' with GStreamer validate
``` bash
$ gst-tester-1.0 my-test.validatetest
```
----
## Crank the clock
``` jproperties
meta,
handles-states=true,
args = {
"videotestsrc pattern=blue ! compositor name=c ! \
video/x-raw,width=100,height=100,framerate=10/1 ! $(videosink)",
}
set-timed-value-properties, timestamp=0.0, source-type=GstInterpolationControlSource,
binding-type=direct-absolute, c.sink_0::xpos=0
set-timed-value-properties, timestamp=1.0, source-type=GstInterpolationControlSource,
binding-type=direct-absolute, c.sink_0::xpos=100
play
crank-clock, expected-time=0.0
check-properties, c.sink_0::xpos=0
crank-clock, repeat=5
check-position, expected-position=0.5
check-properties, c.sink_0::xpos=50
crank-clock, repeat=5
check-position, expected-position=1.0
check-properties, c.sink_0::xpos=100
stop
```
---
Thanks!
{"title":"gst-validate -","type":"slide","tags":"multimedia, gstconf, talk","slideOptions":{"transition":"slide","theme":"igalia","controlsLayout":"edges","slideNumber":"c/t"}}