编码UI - 从头开始构建框架。最佳做法。 [英] Coded UI - Framework build from scratch. Best practices.
问题描述
Hello all,
我的目标是使用CodedUI为(巨大的)WPF应用程序构建一个自动化框架,我想知道你是否有人有一些建议可以分享。 *我将手动编写测试代码,而不使用UI地图,我感觉有点受限,因为我只有基本对象
面向C#的编程知识。
Hello all,
My goal is to build an automation framework using CodedUI for a (huge) WPF application and I was wondering if any of you have some advice to share. *I will manually code the tests, without using the UI maps and I feel a bit limited since I only have basic object
oriented programming knowledge in C#.
如果有人愿意分享经验,我会对以下内容感兴趣:
If anyone would like to share from experience, I would be interested in the following:
1)如何构建代码?是否有应该始终应用的标准规则/最佳实践?
1) How to structure the code? Are there any standard rules / best practices that should be always applied?
我的方法是为应用程序中的每个页面创建一个主类,并为页面内可用的每个控件添加方法。这样的事情:
//// TestCaseClass:
My approach is to create a main class for every page in the application and add methods for every control available inside the page.Something like this:
////TestCaseClass:
WpfButton buttonAppMenu = AppMenu.ButtonApplicationMenu(AppMenu.MainWindow());
Mouse.Click(buttonAppMenu);
WpfButton buttonAppMenu = AppMenu.ButtonApplicationMenu(AppMenu.MainWindow());
Mouse.Click(buttonAppMenu);
// endTestCaseClass
//endTestCaseClass
// endAppMenu class
//endAppMenu class
2)我应该先尝试自动化什么?(我知道这很难概括)并且取决于很多应用程序,但是我很感兴趣,如果有任何最佳实践)
3)我当时正在考虑使用log4net来生成测试结果报告,这是一种更好的方法?是否值得投入时间来构建HTML报告?
任何链接,文档都非常赞赏。
2) What should I try to automate first?(I know this is hard to generalize and is depending a lot of the application but again, I'm interested if there are any best practices)
3)I was thinking to use log4net for generating the tests result reports, is it a better way? Would it worth investing time in building a html report?
Any links, documentation highly appreciated.
推荐答案
朋友,
>> 1)如何构造代码?是否应该始终应用任何标准规则/最佳实践?
>> 2)我应该首先尝试自动化?(我知道这个很难概括,并且取决于很多应用程序,但是,如果有任何最佳实践,我很感兴趣)
有一个专为建筑而设计的项目CUIT测试不依赖于记录/回放:
There is a project which is designed for building CUIT tests without the dependency on record/playback:
http://codeduicodefirst.codeplex。 com /
您将获得它的详细信息。
you will get the details of it.
3)我当时想用log4net来生成测试结果报告,这是一种更好的方法吗?是否值得投入时间来构建HTML报告?
通过设置" EqtTraceLevel "来获取html报告QTAgent32.exe.config或QTAgent32_40.exe.config中的值为"4"更容易。
To get the html report by setting "EqtTraceLevel" to the value of "4" in QTAgent32.exe.config or QTAgent32_40.exe.config is easier.
祝你好运,
Fletch
这篇关于编码UI - 从头开始构建框架。最佳做法。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!