English 中文(简体)
How to create nested test suites for Selenium IDE?
原标题:

I need to create a nested test suite in Selenium that will run in the Selenium IDE or the Selenium TestRunner. This is basically the structure that I m trying to achieve:

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

I NEED to be able to achieve something equivalent to this. I have started to try an Include extension, which allows me to include the contents of another test case, but I am running into problems with it. How have you achieved this? What advice can you give on how to help me achieve this?

问题回答

This might not be an explicit answer, but I played with Selenium IDE for 3 months. Then I found out that WebDriver is so much more powerful. Your situation is a piece of cake with Selenium WebDriver. The more complex the logic, the better off you are using source code instead of a GUI interface to define your workflows. The input and output parameters can get very confusing if not documented properly. And they can break very easily if they upgrade Selenium IDE. The Selenium IDE is very good at showing a novice programmer how to automate a workflow with a recorder, but if you are a programmer, it ll hold you back.

However, if you really want to accomplish your situation, you can develop your own custom JavaScript function that calls other functions (or other test cases).

As far as I know, Selenium IDE does not support this. The way most people do this is to create the individual test suites and run them individually.

I do this in C#/NUnit by creating a *.cs file for each main area and then setting categories for each of the tests to get the extra granularity

e.g.

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

And then use the NUnit functionality to run tests accordingly.

I am sure most frameworks for most languages have this kind of feature

I m using model based testing together with Selenium on a daily basis and with a model you can put the logic how the tests should be executed and as well the tests its self.

There are some Open Source/Free Software "robots" like http://www.xqual.com/ XStudio. I have tried it a bit and does the work but quite messy to work with but good if your test environment does not change to often. You can here put start automatic executions at a daily basis etc and does report back the results.

Cheers, Stefan

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.

This should be there in mainsuite.

    public static Test suite() {
    TestSuite testSuite = new TestSuite();
    testSuite.addTest(ComponentTestSuite1.suite());
    testSuite.addTest(OtherComponentTestSuite2.suite());
    }

You need SeleniumRC and some programming language tool to write and run tests. SeleniumIDE allow to save test in several languages (C#, JAVA, PHP, Python and etc.) Use one you familiar with. Also with out SetUp and TearDown it is difficult to do good tests. Selenium IDE does not allow these methods.





相关问题
Javascript communication with Selenium (RC)

My Application has a lot of calculation being done in JavaScript according to how and when the user acts on the application. The project prints out valuable information (through console calls) as to ...

Running automated Web browser tests under Hudson

I m running Hudson for my automated builds and love it. I d now like to create automated Web browser tests using either WaTiN (preferred) or Selenium. As my Hudson runs as a Windows service (under ...

Using a Java library with Scala reserved words

I m using an external library written in Java (Selenium). One of the function calls has the signature type(String, String), and I keep getting compiler errors when trying to call it from Scala, that ...

Heightened privilege selenium browsers on Windows 7 (x64)

I make use of *firefox and *iexplore etc. within my selenium tests to get around the issue of self-signed SSL certificates on my local machine. Unfortunately, now that I ve moved from XP over to 7, ...

Selenium not working with Firefox 3.x on linux

I am using selenium-server , selenium rc for UI testing in my application . My dev box is Windows with FireFox 3.5 and every thing is running fine and cool. But when i try to run selenium tests on my ...

Selenium IDE: Incrementing values by 1 and 71

Currently I m incrementing a value called wert by 1 with the following code: getEval storedVars[ wert ]=${wert}+1; The value wert is something like 80401299. I want to add 1 to the value, if it ...

热门标签