| <!DOCTYPE html> |
| <head> |
| <title>RCPTT Documentation Center</title> |
| <meta charset="UTF-8"> |
| <link rel="stylesheet" href="https://www.eclipse.org/rcptt/shared/css/bootstrap.min.css"> |
| <link rel="stylesheet" href="https://www.eclipse.org/rcptt/shared/css/main.css"> |
| <link rel="stylesheet" href="https://www.eclipse.org/rcptt/shared/css/prism.css"> |
| <link rel="icon" href="https://www.eclipse.org/rcptt/shared/img/favicon.ico"> |
| <script src="https://www.eclipse.org/rcptt/shared/js/jquery.min.js"></script> |
| <script src="https://www.eclipse.org/rcptt/shared/js/bootstrap.min.js"></script> |
| <script src="https://www.eclipse.org/rcptt/shared/js/prism.js"></script> |
| <script src="https://www.eclipse.org/rcptt/shared/js/ecl.js"></script> |
| <script> |
| (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ |
| (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), |
| m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) |
| })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); |
| |
| ga('create', 'UA-39589807-5', 'eclipse.org'); |
| ga('send', 'pageview'); |
| </script> |
| </head> |
| <body> |
| <div id="before-footer"> |
| <header> |
| <nav class="navbar navbar-default navbar-static-top" role="navigation"> |
| <div class="container"> |
| |
| <div class="navbar-header"> |
| <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"> |
| <span class="sr-only">Toggle navigation</span> |
| <span class="icon-bar"></span> |
| <span class="icon-bar"></span> |
| <span class="icon-bar"></span> |
| </button> |
| <span class="navbar-brand">RCPTT Documentation Center</span> |
| </div> |
| <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> |
| <ul class="nav navbar-nav"> |
| <li class="active" > |
| <a href="https://www.eclipse.org/rcptt/documentation/userguide/getstarted">User Guide</a> |
| </li> |
| <li > |
| <a href="https://www.eclipse.org/rcptt/documentation/faq/">FAQ</a> |
| </li> |
| <li> |
| <a href="http://eclipse.org/rcptt">Back to RCPTT Main Site</a> |
| </li> |
| <li> |
| <a href="http://eclipse.org">Eclipse.org</a> |
| </li> |
| </ul> |
| </div> |
| </nav> |
| </header> |
| <section class="content"> |
| <div class="container"> |
| <div class="row"> |
| <div class="col-sm-3"> |
| <div class="rcptt-sidebar"> |
| <ul class="nav"> |
| <li ><a href="https://www.eclipse.org/rcptt/documentation/userguide/getstarted/">Get Started</a> |
| </li> |
| <li ><a href="https://www.eclipse.org/rcptt/documentation/userguide/testeditor/">Test Case Editor</a> |
| </li> |
| <li ><a href="https://www.eclipse.org/rcptt/documentation/userguide/controlpanel">Control Panel</a> |
| </li> |
| <li ><a href="https://www.eclipse.org/rcptt/documentation/userguide/assertions/">Assertions</a> |
| </li> |
| <li ><a href="https://www.eclipse.org/rcptt/documentation/userguide/ecl/">Eclipse Command Language</a> |
| <ul class="nav"> |
| <li > |
| <a href="https://www.eclipse.org/rcptt/documentation/userguide/ecl/new-command-guide/">New ECL Command Guide</a> |
| </li> |
| <li > |
| <a href="https://www.eclipse.org/rcptt/documentation/userguide/ecl/excel-import-export/">ECL commands for Excel import and export</a> |
| </li> |
| <li > |
| <a href="https://www.eclipse.org/rcptt/documentation/userguide/ecl/xml-import-export/">ECL commands for XML import and export</a> |
| </li> |
| </ul> |
| </li> |
| <li ><a href="https://www.eclipse.org/rcptt/documentation/userguide/contexts/">Contexts</a> |
| <ul class="nav"> |
| <li > |
| <a href="https://www.eclipse.org/rcptt/documentation/userguide/contexts/workspace/">Workspace</a> |
| </li> |
| <li > |
| <a href="https://www.eclipse.org/rcptt/documentation/userguide/contexts/workbench/">Workbench</a> |
| </li> |
| <li > |
| <a href="https://www.eclipse.org/rcptt/documentation/userguide/contexts/launch/">Launch</a> |
| </li> |
| <li > |
| <a href="https://www.eclipse.org/rcptt/documentation/userguide/contexts/preferences/">Preferences</a> |
| </li> |
| <li > |
| <a href="https://www.eclipse.org/rcptt/documentation/userguide/contexts/parameters/">Parameters</a> |
| </li> |
| <li > |
| <a href="https://www.eclipse.org/rcptt/documentation/userguide/contexts/group/">Group</a> |
| </li> |
| <li > |
| <a href="https://www.eclipse.org/rcptt/documentation/userguide/contexts/folder/">Folder</a> |
| </li> |
| <li > |
| <a href="https://www.eclipse.org/rcptt/documentation/userguide/contexts/default/">Default</a> |
| </li> |
| <li > |
| <a href="https://www.eclipse.org/rcptt/documentation/userguide/contexts/super/">Super</a> |
| </li> |
| <li > |
| <a href="https://www.eclipse.org/rcptt/documentation/userguide/contexts/ecl/">ECL Script</a> |
| </li> |
| </ul> |
| </li> |
| <li ><a href="https://www.eclipse.org/rcptt/documentation/userguide/verifications/">Verifications</a> |
| <ul class="nav"> |
| <li > |
| <a href="https://www.eclipse.org/rcptt/documentation/userguide/verifications/text/">Text</a> |
| </li> |
| <li > |
| <a href="https://www.eclipse.org/rcptt/documentation/userguide/verifications/treetable/">Table/Tree</a> |
| </li> |
| <li > |
| <a href="https://www.eclipse.org/rcptt/documentation/userguide/verifications/errorlog/">Error Log</a> |
| </li> |
| <li > |
| <a href="https://www.eclipse.org/rcptt/documentation/userguide/verifications/time/">Time</a> |
| </li> |
| </ul> |
| </li> |
| <li ><a href="https://www.eclipse.org/rcptt/documentation/userguide/procedures/">Procedures and Variables</a> |
| </li> |
| <li ><a href="https://www.eclipse.org/rcptt/documentation/userguide/runner/">Test Runner</a> |
| <ul class="nav"> |
| <li > |
| <a href="https://www.eclipse.org/rcptt/documentation/userguide/runner/arguments/">Arguments</a> |
| </li> |
| </ul> |
| </li> |
| <li ><a href="https://www.eclipse.org/rcptt/documentation/userguide/maven/">Maven plugin</a> |
| </li> |
| <li ><a href="https://www.eclipse.org/rcptt/documentation/userguide/rap/">RAP</a> |
| <ul class="nav"> |
| <li > |
| <a href="https://www.eclipse.org/rcptt/documentation/userguide/rap/install/">Install instructions</a> |
| </li> |
| <li > |
| <a href="https://www.eclipse.org/rcptt/documentation/userguide/rap/recordReplay/">Record and Replay</a> |
| </li> |
| <li > |
| <a href="https://www.eclipse.org/rcptt/documentation/userguide/rap/capability/">Capability Contexts</a> |
| </li> |
| <li > |
| <a href="https://www.eclipse.org/rcptt/documentation/userguide/rap/rap-commands/">ECL commands</a> |
| </li> |
| <li > |
| <a href="https://www.eclipse.org/rcptt/documentation/userguide/rap/rap-maven/">Maven plugin</a> |
| </li> |
| </ul> |
| </li> |
| <li ><a href="https://www.eclipse.org/rcptt/documentation/userguide/integration/test-rail-integration/">Integration with TestRail</a> |
| </li> |
| </ul> |
| </div> |
| </div> |
| <div class="col-sm-9"> |
| <h1>ECL commands for Excel import and export</h1> |
| <br> |
| <h2>Excel export</h2><hr> |
| |
| <h3>write-excel-file</h3> |
| |
| Writes tables from input pipe to into excel (xls or xlsx) file. Fails if file is not found or format is invalid.<br><br> |
| |
| Input: |
| |
| <ul> |
| <li><b>tables</b> (1, ∞) Table: Tables to write</li> |
| </ul> |
| |
| Parameters: |
| |
| <ul> |
| <li><b>uri</b> String: URI to write Excel data to. Currently supported schemes are workspace:/ for files in workspace and file:/ for files on local file system.</li> |
| <li><b>append</b> boolean: Whether to append given table data into file. Default value is false.</li> |
| |
| </ul> |
| |
| Output: |
| |
| <ul> |
| <li>The value of 'tables' argument</li> |
| </ul> |
| |
| Example: |
| |
| <pre ><code class="language-ecl">​global [val supportedDevices [list |
| [list "Device Name" "Device Info"] |
| [list "Device 1" "Info 1"] |
| [list "Device 2" "Info 2"] |
| [list "Device 3" "Info 3"] |
| ]] |
| |
| global [val allDevices [list |
| [list "Device Name" "Device Info"] |
| [list "Device 1" "Info 1"] |
| [list "Device 2" "Info 2"] |
| [list "Device 3" "Info 3"] |
| [list "Device 4" "Info 4"] |
| [list "Device 5" "Info 5"] |
| ]] |
| |
| |
| proc newTable [val table] [val name] { |
| $table | list-as-table-data | set-page-name $name |
| } |
| |
| |
| emit [newTable $supportedDevices "Supported devices"] [newTable $allDevices "All devices"] |
| | write-excel-file "workspace:/excel/devices.xlsx" |
| </code></pre> |
| |
| |
| <br> |
| <h2>Excel import</h2><hr> |
| |
| <h3>read-excel-file</h3> |
| |
| Parses given excel file (xls or xlsx) into tables and write them to output pipe. Fails if file is not found or format is invalid. |
| <br><br> |
| Parameters: |
| <br> |
| <ul> |
| <li><b>uri</b> String: URI to read Excel data from. Currently supported schemes are workspace:/ for files in workspace and file:/ for files on local file system.</li> |
| <li><b>sheets</b> (0, ∞) String: List of Excel sheet names to read data from</li> |
| </ul> |
| |
| Output: |
| |
| <ul> |
| <li>List of Table EMF Objects</li> |
| </ul> |
| |
| Example: |
| |
| <pre ><code class="language-ecl">​global [val devicesInfo [ |
| read-excel-file "workspace:/excel/devices.xlsx" "Supported devices" "All devices" |
| | to-list |
| ]] |
| |
| |
| clear-log-view |
| |
| $devicesInfo | each [val table] { |
| log [format "Page name: %s" [$table | get pageName]] |
| $table | list [get rows] | each [val row] { |
| $row | list [get values] | each [val value] { |
| log $value |
| } |
| } |
| } |
| |
| read-excel-file "workspace:/excel/devices.xlsx" "Additional info" |
| | get rows | get values | log |
| </code></pre> |
| |
| |
| <br> |
| <h2>Additional commands</h2><hr> |
| |
| <h3>set-page-name</h3> |
| |
| Set page name to table |
| |
| Input: |
| |
| <ul> |
| <li><b>table</b> Table: Table to set page name to</li> |
| </ul> |
| |
| Parameters: |
| <ul> |
| <li><b>name</b> String: Page name to set</li> |
| </ul> |
| |
| Output: |
| |
| The value of 'table' argument |
| <br> <br> |
| Example: |
| |
| <pre ><code class="language-ecl">​get-view "Error Log" | get-tree | expand-all |
| get-view "Error Log" | get-tree | get-table-data |
| | set-page-name "Table" | write-excel-file "workspace:/MyProject/AssertData/table.xls" |
| |
| read-excel-file "workspace:/MyProject/AssertData/table.xls" |
| | get-page-name | equals "Table" | assert-true |
| </code></pre> |
| |
| |
| <br> |
| |
| <h3>list-as-table-data</h3> |
| |
| Converts input list to table data format |
| <br><br> |
| Input: |
| <br> |
| <ul><li><b>list</b> EclList: List of List of String to convert to Table</li></ul> |
| Output: |
| <ul><li> |
| Table EMF Object</li></ul> |
| <br> |
| Example: |
| |
| <pre ><code class="language-ecl">​proc newTable [val table] [val name] { |
| $table | list-as-table-data | set-page-name $name |
| } |
| |
| global [val devices [list |
| [list "Device Name" "Device Target"] |
| [list "Device 1" "Info 1"] |
| [list "Device 2" "Info 2"] |
| [list "Device 3" "Info 3"] |
| ]] |
| |
| newTable $devices "Devices" |
| | write-excel-file "workspace:/excel/devices.xls" |
| </code></pre> |
| |
| |
| <br> |
| |
| <h3>get-table-cells</h3> |
| |
| Gets cell values by excel names and writes them into the output pipe |
| <br><br> |
| Input: |
| <br> |
| <ul><li> |
| <b>table</b> Table: Table to get cells from</li> |
| </ul> |
| Parameters: |
| <ul><li><b>cells</b> (1, ∞) String: Cell names</li></ul> |
| Output: |
| <ul><li> |
| Cell values</li> |
| </ul> |
| Example: |
| |
| <pre ><code class="language-ecl">​read-excel-file "workspace:/excel/devices.xlsx" "Supported devices" |
| | get-table-cells A1 | eq "Device Name" | verify-true |
| </code></pre> |
| |
| |
| <br> |
| <h3>get-table-range</h3> |
| |
| Gets range by excel name and writes it into the output pipe |
| <br><br> |
| Input: |
| <br> |
| <ul> |
| <li><b>table</b> Table: Table to get rows data from</li> |
| </ul> |
| |
| Parameters: |
| <ul> |
| <li><b>range</b> String: Range name in the excel format (for example "A1:B2")</li> |
| </ul> |
| |
| Output: |
| <ul> |
| <li>Table EMF Object</li> |
| </ul> |
| |
| Example: |
| |
| <pre ><code class="language-ecl">​read-excel-file "workspace:/excel/devices.xlsx" "Supported devices" |
| | get-table-range "A2:B4" | list [get rows] | each [val row] { |
| $row | list [get values] | each [val value] { |
| log $value |
| } |
| } |
| </code></pre> |
| |
| |
| <br> |
| |
| <h3>set-table-cells</h3> |
| |
| Sets cell values to the table |
| |
| Input: |
| <ul><li> |
| <b>table</b> Table: Table to set cell values to |
| </li> |
| </ul> |
| |
| Parameters: |
| <ul> |
| <li><b>cells</b> EclMap: Map where key is cell name and value is cell value to set</li> |
| </ul> |
| |
| Output: |
| <ul> |
| <li>The value of 'table' argument</li> |
| </ul> |
| |
| Example: |
| |
| <pre ><code class="language-ecl">​read-excel-file "workspace:/excel/devices.xlsx" "Supported devices" |
| | set-table-cells [map [entry "A1" "New Device Name"] [entry "B1" "New Device Target"]] |
| | write-excel-file "workspace:/excel/devices.xlsx" -append |
| </code></pre> |
| </div> |
| </div> |
| </div> |
| |
| </section> |
| <script src="https://www.eclipse.org/rcptt/shared/js/main.js"></script> |
| </body> |