How to create nested test suites for Selenium IDE?

烂漫一生 提交于 2019-12-04 08:33:04

问题


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?


回答1:


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).




回答2:


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




回答3:


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




回答4:


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:

  • Favorites plugin for Selinium IDE
  • Extension Sequencer for Selenium IDE (needed for Run All)
  • Run All Favorites for Selenium IDE

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.




回答5:


This should be there in mainsuite.

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



回答6:


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.



来源:https://stackoverflow.com/questions/2023479/how-to-create-nested-test-suites-for-selenium-ide

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!