【发布时间】:2015-09-04 14:54:37
【问题描述】:
我已经了解了如何检索当前为 Python Selenium Unittest 运行的测试用例的名称。
unittest.TestCase.id()
如何使用 Webdriver Py.test 框架实现这一点?我没有使用 unittest 框架,所以我的测试看起来像这样:
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import Select
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions
from selenium.common.exceptions import *
import pytest, re, time, unicodedata
from pageobjects import locators
from os import sys, path
sys.path.append( path.dirname( path.dirname( path.abspath(__file__) ) ) )
def test_PointsBlockingTableNavigationPageLinksBlockingPointsOnly02(driver, url):
所以基本上,我想检索名称 "test_PointsBlockingTableNavigationPageLinksBlockingPointsOnly02" 以将其打印到屏幕上或在文件名中使用。
【问题讨论】:
标签: python testing selenium-webdriver pytest