June 28, 2010 0

Getting the name of the current test function

By Anthony in Python, QA, Selenium, Test Automation, Testing

I needed a way to retrieve the name of the current function in order to create better, more informative test output. After dabbling for a while with introspection, I realized what I needed was built right in to Unittest. Best part: No lambdas required.

Inside of your function simply call id.main()