TA的每日心情 | 无聊 2024-7-12 13:16 |
---|
签到天数: 1 天 连续签到: 1 天 [LV.1]测试小兵
|
而不是一个接口写一个test开头的方法
- <span class="nd">@allure.feature</span><span class="p">(</span><span class="s">'注册'</span><span class="p">)</span>
- <span class="nd">@pytest.mark.parametrize</span><span class="p">(</span><span class="s">'realCode, realMessage, expeCode, expeMessage, testCaseName'</span><span class="p">,</span> <span class="n">ResultParam</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span><span class="o">.</span><span class="n">value</span><span class="p">)</span>
- <span class="k">def</span> <span class="nf">test_register</span><span class="p">(</span><span class="n">realCode</span><span class="p">,</span> <span class="n">realMessage</span><span class="p">,</span> <span class="n">expeCode</span><span class="p">,</span> <span class="n">expeMessage</span><span class="p">,</span> <span class="n">testCaseName</span><span class="p">):</span>
- <span class="k">assert</span> <span class="n">realCode</span> <span class="o">==</span> <span class="n">expeCode</span>
- <span class="k">assert</span> <span class="n">realMessage</span> <span class="o">==</span> <span class="n">expeMessage</span>
- <span class="n">logging</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="n">testCaseName</span><span class="p">)</span>
- <span class="nd">@allure.feature</span><span class="p">(</span><span class="s">'登录'</span><span class="p">)</span>
- <span class="nd">@pytest.mark.parametrize</span><span class="p">(</span><span class="s">'realCode, realMessage, expeCode, expeMessage, testCaseName'</span><span class="p">,</span> <span class="n">ResultParam</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span><span class="o">.</span><span class="n">value</span><span class="p">)</span>
- <span class="k">def</span> <span class="nf">test_login</span><span class="p">(</span><span class="n">realCode</span><span class="p">,</span> <span class="n">realMessage</span><span class="p">,</span> <span class="n">expeCode</span><span class="p">,</span> <span class="n">expeMessage</span><span class="p">,</span> <span class="n">testCaseName</span><span class="p">):</span>
- <span class="k">assert</span> <span class="n">realCode</span> <span class="o">==</span> <span class="n">expeCode</span>
- <span class="k">assert</span> <span class="n">realMessage</span> <span class="o">==</span> <span class="n">expeMessage</span>
- <span class="n">logging</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="n">testCaseName</span><span class="p">)</span>
复制代码
|
|