thbar

thbar

Hi there,

As I’m starting to implement Membrane pipelines (initially as one-off scripts like the one below), I wonder what are the good pipeline testing strategies?

I am more interested by pipelines testing (where the SUT = System Under Test is the pipeline itself, which is supervised in the example) than by individual components, where I have pretty good ideas on how to do that.

With this example:

Mix.install([
  :membrane_hackney_plugin,
  :membrane_mp3_mad_plugin,
  :membrane_portaudio_plugin
])

defmodule MyPipeline do
  use Membrane.Pipeline

  @impl true
  def handle_init(_ctx, mp3_url) do
    spec =
      child(%Membrane.Hackney.Source{
        location: mp3_url,
        hackney_opts: [follow_redirect: true]
      })
      |> child(Membrane.MP3.MAD.Decoder)
      |> child(Membrane.PortAudio.Sink)

    {[spec: spec], %{}}
  end
end

mp3_url =
  "https://raw.githubusercontent.com/membraneframework/membrane_demo/master/simple_pipeline/sample.mp3"

Membrane.Pipeline.start_link(MyPipeline, mp3_url)

What testing can be done?

I realise that ultimately I will use a “test sink” for these tests, and also mock out the HTTP source, but you see the general idea.

I will look into the Membrane codebase, but happy to bounce ideas here.

Showing Posts 1 to 1

mat-hek

mat-hek

Membrane Core Team

:wave: When testing pipelines, I try to avoid mocking and create E2E tests whenever possible :wink: I use snapshot testing extensively as well. In this case, I’d set up a simple HTTP server based on Bandit or inets that would serve the mp3 and a virtual sound card that would capture the output and save it to a file. At first, you can manually play the file and ensure it’s correct. Then, you can use it as a snapshot to compare automatically. I think If we had an HTTP source based on Req, it would be easier to test, as Req seems to have great testing features built-in :thinking:

Testing source and sink are actually useful for making artificial pipelines to test particular elements by feeding them with specific inputs and asserting on outputs. If you replace elements in a real pipeline with them, remember that you only test a part of the original pipeline.

— All posts loaded —

Where Next? Top

Trending in Questions Top

RSP87
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
nseaSeb
Hello, I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
RemyXRenard
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
brecabral
Documentation While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
samoloth
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
FlyingNoodle
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
webofbits
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself. My main conc...
#ai
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews