유닛 테스트의 input

유닛 테스트의 input

유닛 테스트에 입력(input)을 사용해서 테스트할 특정 모델이나 소스를 참조해요. input:에는 ref 또는 source 호출을 나타내는 문자열을 사용할 수 있어요.

출처: 문서

본문

유닛 테스트에 입력을 사용해서 테스트할 특정 모델이나 소스를 참조해요:

  • input:에는 ref 또는 source 호출을 나타내는 문자열을 사용해요:
    • ref('my_model') 또는 ref('my_model', v='2') 또는 ref('dougs_project', 'users')
    • source('source_schema', 'source_name')
  • 시드(seed)에는 선택적으로:
    • 시드에 입력을 제공하지 않으면 시드 자체를 입력으로 사용해요.
    • 시드에 입력을 제공하면 그 입력을 대신 사용해요.
  • rows: []로 빈 리스트를 설정해서 "빈" 입력을 사용할 수 있어요. models/schema.yml
unit_tests:
  - name: test_is_valid_email_address # this is the unique name of the test
    model: dim_customers # name of the model I'm unit testing
    given: # the mock data for your inputs
      - input: ref('stg_customers')
        rows:
         - {email: [email protected],     email_top_level_domain: example.com}
         - {email: [email protected],     email_top_level_domain: unknown.com}
         - {email: badgmail.com,         email_top_level_domain: gmail.com}
         - {email: missingdot@gmailcom,  email_top_level_domain: gmail.com}
      - input: ref('top_level_email_domains')
        rows:
         - {tld: example.com}
         - {tld: gmail.com}
...

더 알아보기 (Learn more)