Explicit test environment for Selenium RC

I am going to use Selenium RC to repeat some tests for a website. I want to run these tests from a Java test environment in order to get good reports of how many tests failed, etc.

Which java test platform should I use? Is JUnit the preferred framework for this purpose?

+4
source share
4 answers

We use Selenium in conjunction with JUnit. The beauty of this method lies in the simplicity of creating JUnit tests, because we write Selenium tests in the Selenium IDE and then simply export them to JUnit (although often a little setup is required). Then you can easily integrate them into your continuous integration assembly and set up a task to run them every hour or whatever suits you. What I like about the JUnit approach is that everyone on my team is already familiar with JUnit, so no learning curve is required.

I also recommend checking out the Selenium Grid , which allows you to run your tests in parallel, letting you go a lot more in a shorter time, especially if you can take advantage of running them on multiple machines.

+5
source

Below are some of my impressions.

JUnit has “rules” that reduce the amount of template code. For example, a rule can start a servlet container before a test and stop it after, create and enter an instance of Selenium, and so on. This makes the tests more elegant.

TestNG supports groups (and their dependencies). This is extremely useful for integration testing - for example, you can enable specific groups in certain environments. JUnit 4.8 introduces "categories" that may be somewhat similar.

Spring Test has a very good approach with “test run listeners” that can “prepare” your test instances. This is somewhat similar to JUnit rules. Spring Test is also an agnostig test framework, i.e. your tests will be almost the same on JUnit or TestNG. There are also “profiles” that are similar to TestNG groups.

Here is a sample of the tested Selenium JSF application based on TestNG. Also look at my Hifaces20 Testing , you might find some useful ideas.

+2
source

We used JUnit for this purpose, and it worked quite well. The Selenium test is simply processed as JUnit tests and runs on the selenium server.

Although the Selenium test seems closer to integration exams, you should evaluate the NG test once if it suits your needs better. TestNG gives you more configuration control. In our case, we were satisfied with the web driver and the JUnit configuration method for us, so we did not switch to TestNG.

+1
source

Only to support one of the answers
Yahoo adapt selenium + testng for web pages for automatic testing.

Junit vs. Testng:
Testng can have more control, for example, group test cases, run in parallel, retry an unsuccessful test case, more flexible in annotating the test case.

0
source

Source: https://habr.com/ru/post/1307816/


All Articles