This site requires JavaScript to be enabled
IE BUMPER

Tosca Version
IncidentLookup using list
Language
How can we help?

Solution Suggestions

Please enter your question to get suggestions.
  Help
IE BUMPER
Product
Results per page
Tosca Version
Categories
Version
Boolean Operators
OR or vertical bar symbol (|)
Finds a match if either the terms exist in a document (a union using sets).
AND
Finds a match if both terms exist in a document (an intersection of sets).
NOT, minus (-), or exclamation point (!)
Excludes documents that contain the term after NOT (a difference of sets).
Wildcards
Asterisk (*)
The asterisk symbol performs a multi character wildcard search.
Percent sign (%)
The percent sign performs a single character wildcard search.
Phrases
Quotation marks (")
Use quotation marks to search for an exact phrase with multiple terms.
For examples and more information look at our Knowledge Base: Advanced Search On The Support Portal

Iterating an Excel file

I have an Excel file which contains rows with on each row a source file and a target file.
Now I want to create a test case which iterates all rows in the Excel file and for each row to check if the source file and target file exists.
Is this possible to do?
Regards,
John 
6 0

Agnes Fröschl

Created: 2015-03-31 15:40:03

Hy John,

You can use a combination of the ExcelEngine and the Module "TC File Existence" to build your TestCase.
The predefined Modules from the ExcelEngine can be downloaded from our Support Portal:
https://support.tricentis.com/community/downloads.do?number=DOW0003509

"TC File Existence" can be found in the package "File Operations":
https://support.tricentis.com/community/downloads.do?number=DOW0003510

To iterate over the list of files you can use a While-Loop. Therefore you would need Tosca 8.3.SP1.
I have tested the following TestSteps with Excel 2013:

1) Open the excel Workbook
2) Set the current row, where you want to start (TC Set Buffer)
3) While-Loop:
       while the current row holds a value
        repeat:
            Buffer the current file path
            split the path into the directory and the file name (TC String Operations)
            verify file existence of the current file (TC File Exists)
            increase the current row (TC Set Buffer and {CALC[{B[RowNumber]}+1]})
           
This will iterate over reach row of one column.
If you have a second column which contains a file in each row, you would need to set the current column and repeat the TestCase.

I will also open an incident for you and send you a subset via mail.

Best Regards,
Agnes

John Van Arkelen

2015-03-31 15:03:29
Wow, thank you, this looks really good!
3 0

Rahul S S

Created: 2015-10-01 11:33:07

Hi,


For the benefit of the community, if someone is till using an older version of TOSCA which does not support looping, the following could be tried to achieve the desired result:
You would have to create two test cases:
Test Case 1 - Would essentially have only one test step and it sets the value "1" to some buffer variable, say "ExcelrowCount"
Test Case 2 - In this test case we access the excel sheet with the file paths, perform the buffer action of the paths and then perform a verification using the generic module "TC File Existence" and increment the buffer "ExcelrowCount", which we used in the first test case.

The second test case described here is exactly similar to the test case that Agnes mentioned in her solution, the only difference being, the iteration is not built into your test case (as in her case, where she uses a looping construct), but is rather handled using the execution list property called "Repetitions".

Now drag both these test cases onto an execution list to create execution entries. Maintain the repetitions property of the first test case as 1 while the repetitions property for the second test case should have a number equal to the number of rows that you want to iterate through in your excel. After such a set-up if the execution list as a whole is executed, you will notice that the first test case runs only once and sets the initial value for your buffer which can be used to access the first row in your excel sheet and then the second test case repeats its execution each time working on a different row, thus essentially iterating through your excel sheet.

Note: If you want a subset of this example, please leave your email id here and I will send it to you.

Best Regards,
Rahul



1 0

Abhishek Shukla

Created: 2016-03-11 19:08:38

Hi,

It is not required to hardcode value for row count, just use .rowcount property to store #of rows and try iterating using while loop or Repetitions as detailed above.

Regards,
Abhishek

Sandeep Singh

2016-08-30 04:53:54

Hi Abhishek!!! I have a query regarding the RowCount property as you detailed above. Which module do I use while buffering the row count of the excel I am working with? Will it be open excel or get active range? I will be able to iterate over the rows, just need some help with where to use the RowCount property and with which module.

Thanks

Sandeep

0 0

jayamathan yesudass

Created: 2018-04-11 11:14:19

Hi,

Open Excel using - Excel Open workbook

activate sheet using - Excel Set Active Worksheet

Then using below screenshot we can able to get RowCount from Excel

and values will get stored in Buffer called REC

 

Thanks,

Jayamathan

Afreen Jumanal

2018-09-24 10:14:15

Hi Jayamathan,

I can read the excel row count but total row count is 347 but value displayed in Buffer variable is 199?? please suggest.

IE BUMPER

Tosca is the perfect solution

Optimize - Manage - Automate

Download Trial