10

我需要在 Selenium 中创建一个嵌套测试套件,它将在 Selenium IDE 或 Selenium TestRunner 中运行。这基本上是我想要实现的结构:

MasterTestSuite.html
 - ComponentTestSuite.html
    - TestCase1.html
    - TestCase2.html
 - OtherComponentTestSuite.html
    - TestCase3.html
    - TestCase4.html

我需要能够实现与此等效的目标。我已经开始尝试包含扩展,它允许我包含另一个测试用例的内容,但我遇到了问题。你是如何做到这一点的?您可以就如何帮助我实现这一目标提出什么建议?

4

6 回答 6

3

这可能不是一个明确的答案,但我使用 Selenium IDE 玩了 3 个月。然后我发现 WebDriver 功能强大得多。您的情况对于 Selenium WebDriver 来说是小菜一碟。逻辑越复杂,使用源代码而不是 GUI 界面来定义工作流的效果就越好。如果没有正确记录,输入和输出参数会变得非常混乱。如果他们升级 Selenium IDE,他们很容易崩溃。Selenium IDE 非常擅长向新手程序员展示如何使用记录器自动化工作流程,但如果您是程序员,它会让您望而却步。

但是,如果您真的想完成您的情况,您可以开发自己的自定义 JavaScript 函数来调用其他函数(或其他测试用例)。

于 2013-06-13T05:02:30.873 回答
1

据我所知,Selenium IDE 不支持这个。大多数人这样做的方式是创建单独的测试套件并单独运行它们。

我在 C#/NUnit 中通过为每个主要区域创建一个 *.cs 文件然后为每个测试设置类别以获得额外的粒度来执行此操作

例如

namespace Test.The.World
{
   [TestFixture]
   public class UK 
   {
      [Test]
      [Category("Southern Counties")]
      public void Sussex_Brighton(){
          .....
      }
      [Test]
      [Category("Southern Counties")]
      public void Hampshire_Southampton(){
          .....
      }
   }
}

然后使用 NUnit 功能相应地运行测试。

我确信大多数语言的大多数框架都具有这种功能

于 2010-01-08T09:48:58.947 回答
1

I have a few dozen test suites built in Selenium IDE to assist with testing my Store Locator Plus WordPress plugin. Sometimes I need to run a single Selenium test suite. However when I release a new version of the base plugin I want to run a dozen test suites one-after-another.

While not a perfect fit for your use case of creating several "master suites", I did find a pair of Selenium IDE plugins that allow me to create a single "favorites list of suites" and run all of my favorites back-to-back.

It may be possible to investigate & modify the plugin JavaScript to create several different "favorites lists" that may suit your needs. In the meantime you can get at least one "master list of suites" by combining these Selenium IDE add-ons:

After installing each of these add-ons (technically Mozilla Firefox plugins) you will see a favorites button inside the Selenium IDE interface. Mark your favorite suites and you will have your "list". You can now select "Favorites / Run All" from the Selenium IDE menu.

You may want to be careful about the sequence in which you mark your favorites. I marked them in the order I wanted them to run. Open test suite #1, favorite, test suite #2 favorite etc. then "run all". Worked great and shows me the total run count and fail count across all suites (and thus tests) that were executed. The log, sadly, appears to be reset at each suite however.

于 2015-04-28T15:53:36.557 回答
1

我每天都在与 Selenium 一起使用基于模型的测试,并且通过模型,您可以将逻辑设置为应该如何执行测试以及测试本身。

有一些开源/免费软件“机器人”,例如http://www.xqual.com/ XStudio。我已经尝试了一点并且可以完成工作,但是使用起来很麻烦,但是如果您的测试环境不经常更改,那就很好了。您可以在这里每天开始自动执行等,并报告结果。

干杯,斯特凡

于 2010-05-20T12:50:05.737 回答
0

您需要 SeleniumRC 和一些编程语言工具来编写和运行测试。SeleniumIDE 允许以多种语言(C#、JAVA、PHP、Python 等)保存测试。使用您熟悉的一种。此外,如果没有 SetUp 和 TearDown,也很难进行良好的测试。Selenium IDE 不允许使用这些方法。

于 2010-10-13T17:32:54.650 回答
0

这应该在主套房中。

    public static Test suite() {
    TestSuite testSuite = new TestSuite();
    testSuite.addTest(ComponentTestSuite1.suite());
    testSuite.addTest(OtherComponentTestSuite2.suite());
    }
于 2010-12-29T05:36:59.360 回答