TestResults ExcelFile设置 [英] TestResults ExcelFile Settings

查看:72
本文介绍了TestResults ExcelFile设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


执行期间断言的通过/失败状态写入 CSV动态创建的文件(在测试
运行期间)。


走向测试运行结束时,来自此csv文件的数据将复制到已应用颜色编码的现有Excel模板
以指示通过/失败。


相同的代码如下:

 System.Diagnostics .Process.Start(string file1); 
Keyboard.SendKeys(" ^ a");
Keyboard.SendKeys(" ^ a");
Keyboard.SendKeys(" ^ c");
System.Diagnostics.Process.Start(string file2);



数据被复制要优秀,但列没有自动调整以正确显示内容,
甚至在为列设置AutoFit属性之后。



有没有我们可以在复制完成之前或之后设置列的AutoFit属性吗?



提前致谢


Saritha


解决方案

Saritha,


您是否使用UI录制来打开CSV文件和复制粘贴到Excel工作表?我希望你能使用C#Excel Interop:
从C#Excel开始 - 如何在C#.NET中控制Excel


要在Excel中使用编码的UI自动化,您应该使用
< span id ="x_ctl00_ctl00_WideContent_ProjectTitleControl1_TitleLabel"> Excel编码的UI技术提供程序示例
IMO,使用UI自动生成重新生成文件并不是一个好主意。


- Tejas。


Hi,

The pass/fail status of assertions during execution is written to a CSV file which is created dynamically (during the test run).

Towards the end of the test run, data from this csv file is copied to an existing excel template in which color coding is already applied to indicate pass/fail.

Code for the same is given below:

System.Diagnostics.Process.Start(string file1);
Keyboard.SendKeys("^a");
Keyboard.SendKeys("^a");
Keyboard.SendKeys("^c");
System.Diagnostics.Process.Start(string file2);


The data is getting copied to excel, but the columns are not getting auto fitted to display the contents properly,
even after setting the AutoFit property for columns.

Is there any means by which we can set the AutoFit property of columns prior or after copying is done?

Thanks in advance

Saritha

解决方案

Saritha,

Are you using UI recording to open the CSV file and copy paste the data to Excel sheet? I would sugegst you to work with C# Excel Interop: Begin with C# Excel- How to control Excel in C#.NET.

For using Coded UI automation in Excel, you should use Excel Coded UI Technology Provider Sample. IMO, using UI automation for genrating reproting file is not good idea.

-Tejas.


这篇关于TestResults ExcelFile设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆