当前时区为 UTC + 8 小时



发表新帖 回复这个主题  [ 1 篇帖子 ] 
作者 内容
1 楼 
 文章标题 : Automated Tests - 自动化测试
帖子发表于 : 2013-05-09 9:17 

注册: 2013-05-09 9:11
帖子: 9
系统: UbuntuKylin 13.04
送出感谢: 0 次
接收感谢: 0 次
*温馨提示:本人英文能力有限,翻译不当之处还望大家跟帖指正,共同学习、进步!*

http://qa.ubuntu.com/getting-involved/automated-tests/
Automated Tests
自动化测试

There are a couple ways to get involved in writing automated tests. The quality team is involved in writing autopkg and autopilot tests for ubuntu packages. Autopilot tests are functional tests, intended to simulate user interaction. Autopkg tests on the other hand are run at build time and are intended to be integration and lower level tests. See below for more information on each kind of testing.
我们有几种方式来参与编写自动化测试。质量团队参与为ubuntu软件包编写autopkg和autopilot测试。Autopilot测试是用于模拟用户交互的功能测试。Autopkg测试则是运行在构建时间、用于集成的、低水平的测试。想要了解更多信息,请看下面的各种测试。

Autopilot
Autopilot测试

What is autopilot test?
什么是Autopilot测试?

Autopilot is a testing tool capable of introspecting applications and generating keyboard and mouse events. Autopilot tests are utilized for functional testing, including GUI testing and simulating end user interaction. The tests are written in python and can be user executed or scripted via a test runner such as UTAH or jenkins to run and publish results automatically. The quality team maintains a project repository for autopilot testcases.
Autopilot是一种能够自检所需的应用程序、生成键盘和鼠标事件的测试工具。Autopilot测试用于功能测试,包括GUI测试和模拟最终用户交互。本测试是用python语言编写的,用户可以通过执行或撰写一个诸如UTAH或者jenkins的测试去自动执行和发布结果。质量团队维护着一个Autopilot测试用例的项目存储库。

Writing an autopilot testcase
编写一个Autopilot测试用例

STEP 1: Choose an application
步骤1:选择一个应用程序

Choose an application you wish to write the testcase for. An excellent place to begin is by looking at the needed tests from the list. Branch the current testcases by issuing bzr branch lp:ubuntu-autopilot-tests.
选择一个你需要写测试用例的应用程序。通过查看所需的测试列表是一个好的开始。分支当前测试用例的通过发行bzr相同分支lp:ubuntu-autopilot-tests。

STEP 2: Familiarize yourself with Autopilot
步骤2:熟悉Autopilot

Take a look at the basic walk-through, parts one and two. Next, learn more about using the autopilot launch and vis tools to introspect your application by reading last part of the tutorial here. Also be sure to reference the official documentation andtutorial.
看看基本演练的一、二部分。然后,通过阅读在这里阅读教程的最后一部分学习更多关于使用Autopilot启动和编辑的工具来自检你的应用程序。

STEP 3: Write the test
步骤3:编写一个测试

Run the application you’ve chosen and pick a few of the primary features of the application. Document each feature you’ve chosen and write down step by step instructions in order to utilize the feature. You should template out your planned feature tests, and document each step as a comment. For example, if I want to ensure the bookmark manager in firefox works properly, I would write tests to test the ability to open, save, delete, edit and order a bookmark. These step by step instructions will be transformed into automated actions to be performed by your code.
运行你选择的应用程序,并且挑选几个该应用的主要功能。为能很好的利用特性,用文档记录下你选择的每个特性和一步步指示。你应该将你计划的功能测试形成模板,并用文档记录下每个步骤作为注释。例如,如果我想要确保firefox的书签管理器正常工作,我会编写一个测试用例测试其打开、保存、删除、编辑和订阅一个书签的能力。根据一步步指示,由你编写的代码将转变为自动处理执行。

Run through the steps you wrote down to ensure they exercise the feature you targeted. As you step through your instructions, record what happens for each step so you can add them to the test case. These will become your assertions in the testcase. For example, If I press Ctrl+o while in gedit, the expected result might be that an open window will appear.
通过你写下的这些步骤确保他们运行你指定的功能。当你一步通过你的指示,记录每一步发生了什么,这样你就可以将它们添加到测试用例了。这些将成为你在测试用例中的定论。例如,如果我在gedit(文本编辑器)中按下Ctrl+o,预期的结果可能是出现一个打开文件窗口。

Utilize autopilot’s mouse, keyboard, and data manipulation to perform the same steps. Write each feature test as a separate test function. Run your code and ensure all your intended actions are performed.
利用Autopilot的鼠标、键盘和数据处理来执行相同步骤。为每个功能测试编写单独的测试函数。运行你的代码并确保你所有打算的操作都执行。

Add in the assertions your made about the state of the application as the code executes your testcase. Every line doesn’t necessarily need an assertion, provided the main actions of the testcase have assertions.
添加你的关于你的测试用例代码执行应用程序的状态定论。并不一定每行都需要定论,提供测试用例的主要操作的定论。

STEP 4: Contribute your new test!
步骤4:贡献你的新测试

Once your test is ready, commit your changes and push them to a branch in launchpad. Then submit a merge request that includes your new testcase to theproject.
一旦你的测试准备好了,提交你的变更并上传到launchpad上的一个分支。然后提交一个包含你关于某程序的新测试用例的融合请求。

I want to help, but I got lost somewhere!
我想帮忙,但我迷失在了某个地方!

I’d encourage you to visit our wiki pages on contributing testcases for more in-depth instructions and help. In addition, let us know about your work! Send an email to the QA Community Coordinator and/or the mailing list, ubuntu-quality@lists.ubuntu.com. They are happy to help you!
我想鼓励你访问我们的wiki页面有关贡献测试用例的地方得到更深入的指导和帮助。此外,让我们知道你的工作!
发邮件到QA社区协管员和/或者邮件列表,ubuntu-quality@lists.ubuntu.com。他们会很乐意帮助你!

What testcases need to be written?
测试用例需要写些什么?

Testcases for any package in the ubuntu archive is welcome! If you are looking for ideas, here is a list of current work items. Pick an item from the list and have at it!
测试用例对于Ubuntu归档的任何包都是受欢迎的!如果你正在寻找主意,这里是当前工作项目的列表。从列表中选择一个项目并用它工作吧!

How do I contribute an autopilot test?
如何贡献一个Autopilot测试?

Contributions can be submitted by branching the code, bzr branch lp:ubuntu-autopilot-tests, and submitting merge requests.
贡献可以被分支代码提交,bzr分支lp:ubuntu-autopilot-tests,并提交融合请求。

What happens to my contribution?
我的贡献发生了什么?

Once accepted and merged, your test will be available to run on the jenkins QA instance. This will allow the test to run against the new builds of the package as they become available.
一旦接受并融合,你的测试将可被运行在jenkins QA实例中。这将允许测试违反包可用的新构建。

How do I get more information?
如何获取更多的信息?

The autopilot team has documentation with further information on writing an autopilot testcase, including examples of tests and a walkthrough on writing testcases.
Autopilot团队有编写Autopilot测试用例的深入的信息文档,包含测试和一个编写测试用例走查的例子。

Autopkg
Autopkg测试

What’s an autopkg test?
什么是Autopkg测试?

Autopkg tests are run at build time automatically by the buildbots for the package. The goal of these tests is to provide system and integration testing to guarantee basic functionality. Autopackage tests are written and submitted as additions to an individual package. They are low-level tests that verify functionality and are run during package build time. Autopkg tests can be written for any ubuntu package. The tests follow the DEP 8 specification for including tests as part of a deb package.
Autopkg测试由buildbots包运行在自动构建时期。这些测试的目的是提供系统、综合的测试以保证基本功能。Autopackage测试作为一个独立包的补充被编写和提交。它们是验证功能的低级测试,在包构建期间运行。Autopkg测试可以为任何ubuntu包编写。测试依照DEP 8规范包含测试作为一个deb包的一部分。

Writing an autopkg testcase
编写一个Autopkg测试用例

STEP 1: Choose an application
步骤1:选择一个应用程序

Choose an application you wish to write the testcase for. An excellent place to begin is by looking at the needed tests from the list.
选择一个你需要写测试用例的应用程序。通过查看所需的测试列表是一个好的开始。

STEP 2: Familiarize yourself with Autopkg
步骤2:熟悉Autopkg

Take a look at the basic walk-through at contributing an autopkg testcase, including examples of tests to understand how autopkg tests work and function.
看看贡献一个Autopkg测试用例的基本演练,包括理解Autopkg如何测试工作和功能的测试例子。

STEP 3: Write the test
步骤3:编写一个测试

Start by branch the package you wish to add the test for; bzr branch ubuntu:<packagename>
You’ll need to perform some basic modifications to ready the package for autopkg.
Add a source section in debian/control called XS-Testsuite: autopkgtest
Add a debian/tests/control which specifies the requirements for the testbed.
Next, add the tests to debian/tests/ folder. A test can be written in a myriad of languages. Common examples are C, bash, python and perl. The tests focus on ensuring low-level compatibility with the basic features of the package. For example, an autopkg test for a pkzip library may check to ensure the library starts without crashing, and can perform zip and unzip features.
首先添加你需要的测试的包到分支;bzr相同分支ubuntu:<packagename>
你需要执行一些基本修改去准备好Autopkg的包。
·在debian/control添加一个源,名为XS-Testsuite: autopkgtest
·添加一个对测试台指定需求的源debian/tests/control
接下来,在debian/tests/文件夹添加测试。一个测试使用无数种语言编写。常见的有C、bash、python和perl。测试聚焦于确保包基本特征的低级兼容性。例如,一个压缩程序库的Autopkg测试可以是检查确保程序库正常的启动,并且可以执行压缩和解压缩功能。

STEP 4: Contribute your new test!
步骤4:贡献你的新测试

Once your test is ready, commit your changes and push them to a branch in launchpad. Then submit a merge request that includes your new testcase to theproject.
一旦你的测试准备好了,提交你的变更并上传到launchpad上的一个分支。然后提交一个包含你关于某程序的新测试用例的融合请求。

I want to help, but I got lost somewhere!
我想帮忙,但我迷失在了某个地方!

I’d encourage you to visit our wiki pages on contributing testcases for more in-depth instructions and help. In addition, let us know about your work! Send an email to the QA Community Coordinator and/or the mailing list, ubuntu-quality@lists.ubuntu.com. They are happy to help you!
我想鼓励你访问我们的wiki页面有关贡献测试用例的地方得到更深入的指导和帮助。此外,让我们知道你的工作!
发邮件到QA社区协管员和/或者邮件列表,ubuntu-quality@lists.ubuntu.com。他们会很乐意帮助你!

What testcases need to be written?
测试用例需要写些什么?

Testcases for any package in the ubuntu archive is welcome! If you are looking for ideas, here is a list of current work items. Pick an item from the list and have at it!
测试用例对于Ubuntu归档的任何包都是受欢迎的!如果你正在寻找主意,这里是当前工作项目的列表。从列表中选择一个项目并用它工作吧!

How do I contribute an autopilot test?
如何贡献一个Autopilot测试?

Getting the test into ubuntu follows the normal ubuntu developer process. In short, you
Branch the source of the package you wish to add a test
Edit the debian/control and debian/tests/control file to enable the tests
Add the test(s) to debian/tests folder
Commit your changes and propose a merge
让测试遵循ubuntu标准的ubuntu开发过程。简而言之,就是你可以:
1.分支你想要添加测试的包的源
2.编辑debian/control和debian/tests/control文件来启用测试。
3.添加测试到debian/tests文件夹
4.提交你的变更并提出一个融合。

What happens to my contribution?
我的贡献发生了什么?

Once accepted and merged, your test will be run everytime that package or it’s dependencies are built. You can see the live jenkins output of all the tests that have been contributed and are currently being automatically run here.
一旦接受并融合,你的测试将运行在每次包或者它的依赖建立时。你可以看到已贡献的和正在这里自动运行的所有测试的实时jenkins输出。

How do I get more information?
如何获取更多的信息?

The ubuntu developer documentation has further information on contributing an autopkg testcase, including examples of tests and a walkthrough on writing testcases.
Ubuntu开发文档有关于贡献一个Autopkg测试用例的深入信息,包含测试和一个编写测试用例走查的例子。


页首
 用户资料  
 
显示帖子 :  排序  
发表新帖 回复这个主题  [ 1 篇帖子 ] 

当前时区为 UTC + 8 小时


在线用户

正在浏览此版面的用户:没有注册用户 和 1 位游客


不能 在这个版面发表主题
不能 在这个版面回复主题
不能 在这个版面编辑帖子
不能 在这个版面删除帖子
不能 在这个版面提交附件

前往 :  
本站点为公益性站点,用于推广开源自由软件,由 DiaHosting VPSBudgetVM VPS 提供服务。
我们认为:软件应可免费取得,软件工具在各种语言环境下皆可使用,且不会有任何功能上的差异;
人们应有定制和修改软件的自由,且方式不受限制,只要他们自认为合适。

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
简体中文语系由 王笑宇 翻译