1

I've been messing around with Selenium 2 for a while now, with the purpose of running automated tests My goal is to write tests in Java and run each test in different browsers, simultaneously if possible. My question to you is: Why use a Testing framework such as JUnit for this? It appears to be the most commonly used method for doing this. However, JUnit makes it much harder to work with multiple threads. I tried to just use plain old java without a testing framework, and this appears to work just fine. So I ask you, Is there a reason I should use JUnit? MultiThreadding is a much easier task without it. Also, are there easy ways to multithread with JUnit?

Thanks in advance

3
  • 1
    The benefit of JUnit is that it generates a nice report and there are plenty of tools that integrate with it (like most IDEs). You might want to check TestNG, which is another unit testing framework, but has mutithreaded support. Commented Aug 3, 2012 at 10:01
  • Is the 'nice report' worth it tho? Similar things can be done with some simple try-catch's for NoSuchElementException? Commented Aug 3, 2012 at 10:46
  • If you don't think you need to use junit, then don't use it. But you might want to check that you're not experiencing the Not-Invented-Here syndrome. Commented Aug 3, 2012 at 10:51

2 Answers 2

0

Yes, you should be using TestNG www.testng.org. It makes writing tests a breeze, and probably does everything you are writing from hand in Java. Why reinvent the wheel ?

Sign up to request clarification or add additional context in comments.

Comments

0

In theory you can coerce JUnit into working with multiple parallel threads. Refer this best practices article on how to write multi-threaded tests using JUnit. There are JUnit extensions which will help you in this. So that should not be a big problem. Otherwise you can start off with TestNG

However if I were you I would be more concerned if WebDriver plays well in multi-threaded test environment. There are several open issues pertaining to multi-threaded use (IE driver, especially).

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.