← Back to team overview

sikuli-driver team mailing list archive

[Question #673165]: How to create test suite at runtime based on excel params

 

New question #673165 on Sikuli:
https://answers.launchpad.net/sikuli/+question/673165

Please guide me. I am developing test framework using sikuli with Jython to test my desktop based app. I am using HTMLTestRunner (RaiMan's) for reporting. I have an excel file having names of features which I want to test at runtime. If there is '1' present in column next to it, then I want to add it to test suite (otherwise not). How can I do this dynamic addition of test cases to test suite?
Below is my driver script.

####TestDriver.py####

from sikuli import*
import HTMLTestRunner # needed here
reload(HTMLTestRunner)
import unittest
import os,sys

RootFolder = "C:\\Users\\nbhushan\\Desktop\\SikuliFramework_PRE2019"

if not RootFolder in sys.path: 
    sys.path.append(RootFolder)
 
import Effects

print "Starting execution of UI tests for PRE application."

workbook = xlrd.open_workbook(RootFolder+"\\TestData\\" + "PRE_Test_Execution_Data.xls")
worksheet = workbook.sheet_by_index(0)

testcase_list = []
for row in range(worksheet.nrows):
    area_flag = worksheet.cell(row, 3).value
    if area_flag == 1:
        testcase_list.append(worksheet.cell(row, 1).value)

suite=unittest.TestLoader().loadTestsFromModule(Effects, )
outfile = "C:\\Users\\nbhushan\\Desktop\\SikuliFramework_PRE2019\\Output\\TestReport.html"
runner = HTMLTestRunner.HTMLTestRunner(stream=outfile, title='Xbox Test Report', description='This is a demo' )
runner.run(suite)

###end###

Note that I am running 'Effects' module explicitly here, just to make you understand how my driver script looks like. Please suggest changes so that I can run all the test cases which 'testcase_list' variable holds in my script  (and not just Effects module) . I dont want to write hard coded repetitive statements to add test case to suite again and again (unless it is my last option). 

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.