Contributions
Re: Gherkin Integration in TestComplete
you might be looking for a more 'official' way to integrate Gherkin into your tests but I like organizing my tests using comments and the TestComplete group object. I could give a 30 minute talk (at least) on how we use groups and comments and log messaging to organize our tests. It works out great for us. And unlike using Gherkin in Selenium, everything is in one file. You don't have the Gherkin in one file and the code (actions) in a separate file. Having everything multiple files makes you have to jump around here and there and it's easy to get lost if stuff is distributed over too many files ... it just makes it difficult to keep a mental picture of the file structure (start having to memorize the file structure or make a physical picture/drawing of the file structure). The important thing with using comments and groups is to make up a set of rules on how to use these features that your entire testing team agrees on and follows. Additionally, implementing Gherkin this way means it's one less layer of code (libraries) which would have the potential of introducing bugs into your test suite.4Views0likes0CommentsRe: When change a name in NameMapping, Then the object name in script tests would also update
I will say that one good thing about this handicap is that it forced me to use the keyword test section for most of my main testing which turned out for the best. It forced me to learn something new. Otherwise, I probably would have relied more on scripting than necessary on scripting (just because that is what I was familiar with ... not necessarily because scripting was the easiest in the long run). Still this feature request still would be a nice feature.10Views0likes0CommentsRe: Testcomplete desktop keywords for loop help
I think TestComplete might have a better tool than their for-loop to iterate through a datatable. Look at this video and see if this is what you want. What you would want to do is shown around minute 2:20. https://support.smartbear.com/testcomplete/videos/testcomplete-basics-data-driven-tests/ If this is not what you are looking for, and you really did want to loop through the datatable programatically using C#, then the following article might help: https://support.smartbear.com/testcomplete/docs/app-objects/specific-tasks/grids/ms-datagrid/index.html14Views1like1CommentRe: Excel: how do you change sheet name in Excel file
I ended up just creating a C# program that will open the excel file, change the sheet name to be equal to the sheet name which is stored in TC Files. This was I could then successfully use TestComplete's excel compare tool. The TC excel compare tool requires the sheet name in the actual excel file to be the same as the sheet name in the expected (stored) file. For some reason the developers I work with put the date as part of the tab name (so the tab name always changes). The C# program was short and works. <SPAN class="token keyword">using</SPAN> <SPAN class="token namespace">Microsoft<SPAN class="token punctuation">.</SPAN>Office<SPAN class="token punctuation">.</SPAN>Interop<SPAN class="token punctuation">.</SPAN>Excel</SPAN><SPAN class="token punctuation">;</SPAN> <SPAN class="token comment">// command line execution example:</SPAN> <SPAN class="token comment">// C:\ExcelChangeSheetName\bin\Debug\net6.0>ExcelChangeSheetName.exe "C:\\Temp\\Task_2024_3_11 16_59_34.xlsx"</SPAN> <SPAN class="token keyword">class</SPAN> <SPAN class="token class-name">Program</SPAN> <SPAN class="token punctuation">{</SPAN> <SPAN class="token keyword">static</SPAN> <SPAN class="token return-type class-name"><SPAN class="token keyword">int</SPAN></SPAN> <SPAN class="token function">Main</SPAN><SPAN class="token punctuation">(</SPAN><SPAN class="token class-name"><SPAN class="token keyword">string</SPAN><SPAN class="token punctuation">[</SPAN><SPAN class="token punctuation">]</SPAN></SPAN> args<SPAN class="token punctuation">)</SPAN> <SPAN class="token punctuation">{</SPAN> <SPAN class="token class-name"><SPAN class="token keyword">var</SPAN></SPAN> argCount <SPAN class="token operator">=</SPAN> args<SPAN class="token punctuation">.</SPAN>Length<SPAN class="token punctuation">;</SPAN> <SPAN class="token keyword">if</SPAN><SPAN class="token punctuation">(</SPAN>argCount <SPAN class="token operator">></SPAN> <SPAN class="token number">0</SPAN><SPAN class="token punctuation">)</SPAN> <SPAN class="token punctuation">{</SPAN> Console<SPAN class="token punctuation">.</SPAN><SPAN class="token function">WriteLine</SPAN><SPAN class="token punctuation">(</SPAN><SPAN class="token string">"ARG 0 is: "</SPAN> <SPAN class="token operator">+</SPAN> args<SPAN class="token punctuation">[</SPAN><SPAN class="token number">0</SPAN><SPAN class="token punctuation">]</SPAN><SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">;</SPAN> <SPAN class="token comment">// Create microsoft application object</SPAN> <SPAN class="token class-name"><SPAN class="token keyword">var</SPAN></SPAN> xlApp <SPAN class="token operator">=</SPAN> <SPAN class="token keyword">new</SPAN> <SPAN class="token constructor-invocation class-name">Application</SPAN><SPAN class="token punctuation">(</SPAN><SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">;</SPAN> <SPAN class="token comment">// Create Excel workbook object</SPAN> <SPAN class="token class-name"><SPAN class="token keyword">var</SPAN></SPAN> xlWorkbook <SPAN class="token operator">=</SPAN> xlApp<SPAN class="token punctuation">.</SPAN>Workbooks<SPAN class="token punctuation">.</SPAN><SPAN class="token function">Open</SPAN><SPAN class="token punctuation">(</SPAN>args<SPAN class="token punctuation">[</SPAN><SPAN class="token number">0</SPAN><SPAN class="token punctuation">]</SPAN><SPAN class="token punctuation">,</SPAN> <SPAN class="token number">0</SPAN><SPAN class="token punctuation">,</SPAN> <SPAN class="token boolean">false</SPAN><SPAN class="token punctuation">,</SPAN> Type<SPAN class="token punctuation">.</SPAN>Missing<SPAN class="token punctuation">,</SPAN> <SPAN class="token string">""</SPAN><SPAN class="token punctuation">,</SPAN> <SPAN class="token string">""</SPAN><SPAN class="token punctuation">,</SPAN> <SPAN class="token boolean">true</SPAN><SPAN class="token punctuation">,</SPAN> XlPlatform<SPAN class="token punctuation">.</SPAN>xlWindows<SPAN class="token punctuation">,</SPAN> Type<SPAN class="token punctuation">.</SPAN>Missing<SPAN class="token punctuation">,</SPAN> Type<SPAN class="token punctuation">.</SPAN>Missing<SPAN class="token punctuation">,</SPAN> Type<SPAN class="token punctuation">.</SPAN>Missing<SPAN class="token punctuation">,</SPAN> Type<SPAN class="token punctuation">.</SPAN>Missing<SPAN class="token punctuation">,</SPAN> <SPAN class="token boolean">true</SPAN><SPAN class="token punctuation">,</SPAN> Type<SPAN class="token punctuation">.</SPAN>Missing<SPAN class="token punctuation">,</SPAN> Type<SPAN class="token punctuation">.</SPAN>Missing<SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">;</SPAN> <SPAN class="token comment">// Grab the worksheet and get it's name</SPAN> <SPAN class="token class-name"><SPAN class="token keyword">var</SPAN></SPAN> xlWorksheet <SPAN class="token operator">=</SPAN> <SPAN class="token punctuation">(</SPAN>Worksheet<SPAN class="token punctuation">)</SPAN>xlWorkbook<SPAN class="token punctuation">.</SPAN>Sheets<SPAN class="token punctuation">[</SPAN><SPAN class="token number">1</SPAN><SPAN class="token punctuation">]</SPAN><SPAN class="token punctuation">;</SPAN> <SPAN class="token class-name"><SPAN class="token keyword">var</SPAN></SPAN> sheetName <SPAN class="token operator">=</SPAN> xlWorksheet<SPAN class="token punctuation">.</SPAN>Name<SPAN class="token punctuation">;</SPAN> <SPAN class="token comment">// Find the start of the date</SPAN> <SPAN class="token class-name"><SPAN class="token keyword">var</SPAN></SPAN> indexOfDate <SPAN class="token operator">=</SPAN> sheetName<SPAN class="token punctuation">.</SPAN><SPAN class="token function">IndexOf</SPAN><SPAN class="token punctuation">(</SPAN><SPAN class="token string">"_20"</SPAN><SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">;</SPAN> <SPAN class="token comment">// If the date exists, remove it from the name of the sheet and save the workbook</SPAN> <SPAN class="token keyword">if</SPAN> <SPAN class="token punctuation">(</SPAN>indexOfDate <SPAN class="token operator">!=</SPAN> <SPAN class="token operator">-</SPAN><SPAN class="token number">1</SPAN><SPAN class="token punctuation">)</SPAN> <SPAN class="token punctuation">{</SPAN> <SPAN class="token class-name"><SPAN class="token keyword">var</SPAN></SPAN> baseName <SPAN class="token operator">=</SPAN> sheetName<SPAN class="token punctuation">.</SPAN><SPAN class="token function">Substring</SPAN><SPAN class="token punctuation">(</SPAN><SPAN class="token number">0</SPAN><SPAN class="token punctuation">,</SPAN> indexOfDate<SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">;</SPAN> xlWorksheet<SPAN class="token punctuation">.</SPAN>Name <SPAN class="token operator">=</SPAN> baseName<SPAN class="token punctuation">;</SPAN> xlWorkbook<SPAN class="token punctuation">.</SPAN><SPAN class="token function">Save</SPAN><SPAN class="token punctuation">(</SPAN><SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">;</SPAN> <SPAN class="token punctuation">}</SPAN> <SPAN class="token comment">// Close the workbook and the application</SPAN> xlWorkbook<SPAN class="token punctuation">.</SPAN><SPAN class="token function">Close</SPAN><SPAN class="token punctuation">(</SPAN><SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">;</SPAN> xlApp<SPAN class="token punctuation">.</SPAN><SPAN class="token function">Quit</SPAN><SPAN class="token punctuation">(</SPAN><SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">;</SPAN> <SPAN class="token punctuation">}</SPAN> <SPAN class="token keyword">else</SPAN> <SPAN class="token punctuation">{</SPAN> Console<SPAN class="token punctuation">.</SPAN><SPAN class="token function">WriteLine</SPAN><SPAN class="token punctuation">(</SPAN><SPAN class="token string">"EXPECTED 1 argument. The argument should be the path to the excel workbook which needs it's sheet name modified."</SPAN><SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">;</SPAN> <SPAN class="token punctuation">}</SPAN> <SPAN class="token keyword">return</SPAN> <SPAN class="token number">0</SPAN><SPAN class="token punctuation">;</SPAN> <SPAN class="token punctuation">}</SPAN> <SPAN class="token punctuation">}</SPAN>3Views0likes1CommentExcel: how do you change sheet name in Excel file
How do you change the name of a sheet in excel? This is what I have so far but can't find the method which changes the sheet 'Title'. Please do not delete this question: <SPAN class="token keyword">function</SPAN> <SPAN class="token function">changeExcelTabName</SPAN><SPAN class="token punctuation">(</SPAN><SPAN class="token punctuation">)</SPAN> <SPAN class="token punctuation">{</SPAN> <SPAN class="token keyword">var</SPAN> excelFile <SPAN class="token operator">=</SPAN> Excel<SPAN class="token punctuation">.</SPAN><SPAN class="token function">Open</SPAN><SPAN class="token punctuation">(</SPAN><SPAN class="token string">"C:\\Users\\chk\\Downloads\\Task groups with no tasks_2024_3_11 16_59_34.xlsx"</SPAN><SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">;</SPAN> excelFile<SPAN class="token punctuation">.</SPAN><SPAN class="token function">SheetByIndex</SPAN><SPAN class="token punctuation">(</SPAN><SPAN class="token number">0</SPAN><SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">.</SPAN>Title <SPAN class="token operator"><</SPAN>the code to change sheet title would go here<SPAN class="token operator">></SPAN> excelFile<SPAN class="token punctuation">.</SPAN><SPAN class="token function">Save</SPAN><SPAN class="token punctuation">(</SPAN><SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">;</SPAN> <SPAN class="token punctuation">}</SPAN>Solved46Views0likes5Comments- 36Views1like0Comments
- 41Views0likes1Comment