How to add values from test steps in pytest excel report

Sum sjsumitj at gmail.com
Fri Apr 27 03:47:45 EDT 2018


Hi,

I am using python 2.7 and pytest version 3.2.1
I am using pytest excel plugin to run the pytest and generate test report
in excel format.

Step to install pytest excel : pip install pytest-excel

I am running my pytest test using below :

py.test --excelreport=report.xls e_test.py

Output Test report excel format :

SUITE NAME  TEST NAME   DESCRIPTION RESULT  DURATION    MESSAGE FILE
NAME   MARKERSTestSumFlow test_step1      PASSED  15.24737811
e_test.py

My query is that I want to display the values from my corresponding test
steps in pytest.
e.g. if my test step is following, then how do I display the output of
test_step1 "newNum" in the excel report.

def test_step1(fNum, sNum):
    newNum = fNum - sNum
    print newNum


Regards,
Sumit



More information about the Python-list mailing list