TDD - Allure Report 조금 더 다뤄보기(1)

정태경·2023년 5월 6일
0

TDD

목록 보기
9/10
post-thumbnail

Allure Report의 몇몇 기능들을 살펴보며 보기 편한 결과 보고서를 만들어보자.

테스트 타이틀 지정

테스트 타이틀을 지정하지 않으면 기본적으로 테스트 메서드명이 테스트 타이틀로 설정되어 노출된다.
코드 상에서 테스트 메서드명을 명시적으로 작성하여 테스트 타이틀이 노출되게 할 수도 있지만, 아래와 같이 정적 또는 동적으로 테스트 타이틀을 지정해줄 수 있다.

import allure
import pytest

# 정적 타이틀 지정
@allure.title("TestCase No.001 : 테스트 타이틀 지정")
def test_with_a_title():
    assert 2 + 2 == 4


# 동적 타이틀 지정
@allure.title("이 타이틀은 테스트 수행하며 동적으로 변경됩니다.")
def test_with_dynamic_title():
	assert 3 + 3 == 6
	allure.dynamic.title("TestCase No.002 : 동적 타이틀 지정")

실행 결과

아래와 같이 정적, 동적으로 테스트 타이틀이 지정되어 노출되는 것을 확인할 수 있다.


테스트 디스크립션 지정

테스트 디스크립션은 HTML 로도 작성할 수 있고 정적 텍스트로 지정할 수도 있다.

import allure
import pytest


# HTML 디스크립션 지정
@allure.title("TestCase No.001 : 테스트 타이틀 지정")
@allure.description_html("""
    <h1> HTML 테스트 description 지정</h1>
    <ol>
	    <li>목록1</li>
	    <li>목록2</li>
    </ol> 
""")
def test_with_a_title():
    assert 2 + 2 == 4


# 정적 디스크립션 지정
@allure.title("이 타이틀은 테스트 수행하며 동적으로 변경됩니다.")
@allure.description("정적으로 description 지정")
def test_with_dynamic_title():
	assert 3 + 3 == 6
	allure.dynamic.title("TestCase No.002 : 동적 타이틀 지정")

실행 결과 (HTML 디스크립션)

실행 결과 (정적 디스크립션)

profile
現 두나무 업비트 QA 엔지니어, 前 마이리얼트립 TQA 엔지니어

0개의 댓글