#單個參數A @pytest.mark.parametrize("A", [1, 2, 3, 4, 5]) def test_A(A): assert A > 3
#多個參數 @pytest.mark.parametrize("F,G,H", ([(1,2,3), (4,5,6), (7,8,9)])) def test_F(F,G,H): assert F+G>H #多個參數換個寫法 @pytest.mark.parametrize("K,L,M",( pytest.param(1,2,3), pytest.param(4,5,6), pytest.param(7,8,9))) def test_K(K,L,M): assert K+L>M
@pytest.mark.parametrize("I",[ pytest.param([1,2,3]), pytest.param([4,5,6])]) def test_I(I): assert I #定義一個id做標識 @pytest.mark.parametrize("J",[ pytest.param([1,2,3],id="first case"), pytest.param([4,5,6],id="second case")]) def test_J(J): assert J