简体   繁体   English

测试用例管理和硒?

[英]Test case management and selenium?

Just wondering how other people manage their test cases that are written for selenium test automation? 只是想知道其他人如何管理为硒测试自动化编写的测试用例? I've been investigating maybe integrating with testlink to show the results and all, but I already have Jenkins set up for my environment and running my tests. 我一直在研究也许与testlink集成以显示结果和所有结果,但是我已经为我的环境设置了Jenkins并运行了测试。 What I'm really looking for is some way to nicely document my tests, like what steps each test performs for non-programmers. 我真正要寻找的是一种很好地记录我的测试的方法,例如每个测试对非程序员执行的步骤。

I'm using Selenium with python, and Jenkins to run the tests. 我将Selenium与python和Jenkins结合使用来运行测试。

I've tried two ways: 我尝试了两种方法:

1) You can use Cucumber to write test steps like this: 1)您可以使用Cucumber编写如下测试步骤:

  @sanity @home_page @test_628
Scenario: Launch Support FAQs & Guides from Home cog
  Given I navigate to Home page
  When I click "Support" user logo link
  Then I should see Support FAQs & Guides app launched

Each step written on Gherkin language (Given, When, Then) you can implement then using Selenium (I have to write on Ruby now, so I use Watir instead of Selenium). 用Gherkin语言编写的每个步骤(Given,何时,然后)都可以使用Selenium来实现(我现在必须在Ruby上编写,因此我使用Watir而不是Selenium)。

see https://github.com/cucumber/cucumber/wiki/Python 参见https://github.com/cucumber/cucumber/wiki/Python

2) But before that I used Robot Framework + Python + Selenium + Jenkins. 2)但在此之前,我使用了Robot Framework + Python + Selenium + Jenkins。 You can write test like this: 您可以这样编写测试:

Go To Google Page [Documentation] Go to google page and search something
    Open Browser to Google Page
    Input Search  selenium
    Submit Search

This is done using human readable keywords. 这是使用人类可读的关键字完成的。 It prints very nice reports and can be easily integrated with Jenkins. 它可以打印出非常漂亮的报告,并且可以轻松地与Jenkins集成。

see http://www.wallix.org/2011/07/26/how-to-use-robotframework-with-the-selenium-library/ 参见http://www.wallix.org/2011/07/26/how-to-use-robotframework-with-the-selenium-library/

To document a test case and that too for non-programmers, Behaviour-Driven Development (BDD) is the best way. 要记录一个测试用例,对于非程序员也要记录,用行为驱动开发(BDD)是最好的方法。 Some of the BDD tools are Cucumber, JBehave etc. 一些BDD工具是Cucumber,JBehave等。

For example, lets assume the we have an website to manage some employees and we have a test case in which admin wants to add a new employee. 例如,假设我们有一个网站来管理一些员工,而我们有一个测试用例,管理员想在其中添加新员工。

So the above test case can be documented using Cucumber as shown below: 因此,可以使用Cucumber记录上述测试用例,如下所示:

Feature: Admin : Employees : Add Employees : Add Employee Details
Scenario: Verify that admin user is able to add new employee
Given Joe is an admin user
Given Joe is logged into the admin account
When Joe clicks "Add Emplyee" button
And Joe enters "Test Employee" in "Employee Name" text box
And Joe enters "12/05/1988" in "Birth Date" text box
And Joe selects "Male" from "Gender" radio button
And Joe clicks on "Submit" button
Then Joe gets message that says "Employee is added successfully."

The above test case can be easily understood by a non-programmer and he can perform each steps as performed by the test. 非程序员可以轻松理解上述测试用例,并且他可以执行测试所执行的每个步骤。

Hierarchy of folders for this test case will be feature/Admin/Employees/Add Employees/Add Employee Details 此测试用例的文件夹层次结构为功能/管理员/员工/添加员工/添加员工详细信息

Hope this helps :) 希望这可以帮助 :)

I don't use TestLink. 我不使用TestLink。 I think it is much easier to use a Jenkins job server to schedule my tests and it can do nearly the same job as testlink can and, im my opinion, is easier for other people to understand. 我认为使用Jenkins作业服务器安排我的测试要容易得多,并且它可以完成与testlink几乎相同的工作,而且我认为其他人也更容易理解。 I check my test code into Subversion and Jenkins checks out the latest code before it runs my tests. 我将测试代码检入Subversion,Jenkins在运行测试之前检出最新代码。 Jenkins has plugins to handle JUnit and TestNG report formats and has email capability, etc. Jenkins具有用于处理JUnit和TestNG报告格式的插件,并具有电子邮件功能等。

NOTE: The only Gotcha is that if you use RemoteWebDriver and a grid, the tests need to be ran by a Jenkins slave server that is running in a foreground process ( not in the background as a service). 注意:唯一的问题是,如果您使用RemoteWebDriver和网格,则需要由在前台进程(而不是作为服务在后台)中运行的Jenkins从属服务器运行测试。 This is the case at least on Windows and might not be a problem on Linux. 至少在Windows上是这种情况,在Linux上可能不是问题。

We use Cucumber to create readable tests and have the results pulled back to Enterprise Tester, our Test Management platform. 我们使用Cucumber创建可读的测试,并将结果拉回到我们的测试管理平台Enterprise Tester。 We can also pull Selenium tests and jUnit tests from Jenkins into Enterprise Tester, also for visibility across both manual and automated tests and traceability back to stories / requirements. 我们还可以将Selenium测试和jUnit测试从Jenkins引入Enterprise Tester,还可以查看手动和自动测试的可视性以及追溯到故事/需求的可追溯性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM