Showing posts with label documentation. Show all posts
Showing posts with label documentation. Show all posts

Tuesday, April 17, 2018

Generate Robot framerwork keyword documentation from custom library?

Let say, I've created my own python library for robot framework and now I want to generate documentation from the python class file.

How to do it?

Step 1:
In python, add your documentation

def delete_excel_row(self, varFileName, varSheetName, varCellName):
"""
Delete a row in the excel file.
Arguments:
| FileName | Excel file with full path |
| SheetName | Sheetname in the excel file |
| CellValue | Row to be deleted in the sheet |

Example:
Delete row
| Delete Excel Row | C:\\Python27\\ExcelRobotTest\\ExcelRobotTest.xlsx | Sheet1 | A1 |
"""
self.varFileName = varFileName
self.varSheetName = varSheetName
self.varCellName = varCellName
varExcel = win32com.client.DispatchEx('Excel.Application')
varWB = varExcel.Workbooks.Open(self.varFileName)
varSheet = varWB.Sheets(self.varSheetName)
varSheet.Range(self.varCellName).EntireRow.Delete(Shift=-4162)
varWB.Save()
varWB.Close()
varExcel.Quit()

Step 2:
Now generate documentation using command

 python -m robot.libdoc filename.py  filename.html