dbt

How to run dbt unit tests with csv files as input and output


I'm trying to setup a unit test with csv files as outputs and inputs and I'm getting always errors of the type: File not found for fixture.

I have the csv files in the folder tests/fixtures.

The yml code is:

unit_tests:
  - name: check_complicate_stuff
    description: "blabla"
    model: core_display
    given:
      - input: ref('model')
        format: csv
        fixture: mock_core_table.csv
    expect:
      format: csv
      fixture: expected_output.csv

In the dbt_project.yml file, I've not overwritten the tests-path

I've tried with different fixture paths: fixtures/expected_output.csv tests/fixtures/expected_output.csv And the error is always the same. Thanks


Solution

  • Get rid of the file extension, just the file name is needed.

    In your case it should be expected_output instead of expected_output.csv, etc.