vendredi 4 septembre 2015

Retrieving the name of the current test case running [Python] [Selenium Webdriver] [Py.test]

I've seen how to retrieve the name of the current test case running for Python Selenium Unittest.

unittest.TestCase.id()

How to achieve this using Webdriver Py.test framework? I'm not using unittest framework so my test looks something like this:

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):

So basicall, I want to retrieve the name "test_PointsBlockingTableNavigationPageLinksBlockingPointsOnly02" to either print to the screen or use in a filename.

Aucun commentaire:

Enregistrer un commentaire