Forum Discussion
This should work:
A = get_test_suite(test_case_container) Log.Message(str(A[0]))
as well as this:
A = [get_test_suite(test_case_container)] Log.Message(str(A[0][0]))
- baxatob8 years agoCommunity Hero
... while not test_case_container.EOF(): if test_case_container.Value["TCID"] == "Ctrl_ID": Log.Message(test_case_container.Value["TC1138"] ...
But this is still not optimal way, imho.
I suggest to use:
- Rajesh28 years agoContributor
Hi baxatob. If you dont mind, Can you please tell me how to do the same using Excel via COM.
I have tried with this:
def Control_Actions1():
Excel = Sys.OleObject["Excel.Application"]
Excel.Workbooks.Open("C:\\Users\\TESTPC\\Desktop\\Cochlear_CSEP2.xlsx").Sheets.Item["TC_Nav_ SP_Implant"]
RowCount = Excel.ActiveSheet.UsedRange.Rows.Count
ColumnCount = Excel.ActiveSheet.UsedRange.Columns.Count
Log.Message(RowCount)
Log.Message(ColumnCount)
tests_run=[]
for i in range(0,RowCount):
for j in range(0,ColumnCount):
if(Excel.Value["TCID"] == "Ctrl_ID"):
test=tests_to_run.append(test_case_container.Value["TC1138"])
test_case_container.Next()
return tests_to_run - baxatob8 years agoCommunity Hero
I am afraid I can't help you here, because I never used Excel via COM. And I can't check it, because I have not MSOffice installed in my test environment.
- shankar_r8 years agoCommunity Hero
Rajesh2all of the methods and properties used below are same as Excel via COM there is no difference
Excel = Sys.OleObject["Excel.Application"]
Excel.Workbooks.Open("C:\\Users\\TESTPC\\Desktop\\Cochlear_CSEP2.xlsx").Sheets.Item["TC_Nav_ SP_Implant"]
RowCount = Excel.ActiveSheet.UsedRange.Rows.Count
ColumnCount = Excel.ActiveSheet.UsedRange.Columns.Count - pavanmac8 years agoContributor
Can anyone help me with this:
def get_test_suite(test_case_container):
tests_to_run = [] # creating an empty list
while not test_case_container.EOF():
if test_case_container.Value["TCID"] == "1138":
tests_to_run.append(test_case_container.Value["Ctrl_ID"])test_case_container.Next()
return tests_to_run
def testd():
test_case_container = DDT.ExcelDriver("C:\\Users\\admin\\Desktop\\xyz.xlsx", "TC_Nav", True)
A = [get_test_suite(test_case_container)]
Log.Message(str(A))I want to fetch the value of 1st ctrl_ID.. Then next ctrl_id
I have the table attached.
Related Content
Recent Discussions
- 4 days ago
- 4 days ago