Ajax Functional Testing Fun | March 12th, 2008
It seems that no matter how much you look for information about Eclipse and how to setup different types of projects, your version Eclipse is innevitably not the same version of the person who makes the tutorial and nor are you as much of an Eclipse geek as the writer of the tutorial. The same things will probably be thought about what follows
First of all I am doing this in Eclipse 3.3 WTP.
I started by creating a new Java project.

Which should have resulted in a basic project that looks something like this.

Then right click on the project root and choose “Properties” from the context menu (Alt+Enter). Go to the “Java Build Path” section of the properties. There you can include source files from elsewhere on your computer - so for example if you keep your test code elsewhere on your system you can include the source folder which will include your Java files in the Java project so that they can be built and run as a Java program while still keeping the files in your source control folder as well. This way you also avoid checking in Java projects all over the place that are useless for everyone else.

Now we add some external Jars. Find the Selenium Java client Jar and the JUnit Jar on your system and add them.

Now your project should be ready to go and you can create Selenium tests using the Java API and run them from Eclipse using JUnit. How sweet it is!

May 5th, 2008 at 2:27 am
Sweet! I didn’t even know this was a possibility. I’m guessing there are gotta be some quirks to test execution using Eclipse and JUnit. Nonetheless, awesome tidbit here. Thank you
May 6th, 2008 at 8:19 pm
it actually works amazingly well!
May 20th, 2008 at 3:24 pm
This may sound like a silly question (I’m just beginning to play with Selenium as part of a summer internship), can you recommend good reference sources or publications that go beyond the basic how to’s? Are there other communities that outside of OpenQA that have lively and insightful conversations?
Thank you in advance.
May 20th, 2008 at 3:53 pm
I wish that I could help more but we didn’t really find that many good resources. It was a lot of messing around with it on our end.
If you have any specific questions feel free to post them here.
Good luck with it!
May 20th, 2008 at 5:37 pm
Dave,
Thanks for the quick response and the offer to bring questions here. I’m finding it to be the same on my end as far needing to play with the tool set to really explore it. With luck version 1.0 will move out of beta shortly and some solid documentation will begin to follow. It’s a great tool.
Cheers,
Matt
June 3rd, 2008 at 5:04 pm
Hi Dave,
If you have time, I have another question for you that maybe your experience can shed light onto. I want to create a JUnit Test Suite to test all my SeleneseTestCase classes. In JUnit i would do the following.
public class TestClassComposite extends TestCase {
public TestClassComposite(String method) {
super(method);
}
static public Test suite() {
TestSuite suite = new TestSuite();
// Run all tests in the Class
suite.addTestSuite(TestClassOne.class);
return suite;
}
}
However when I do this I receive an error that no tests where found in the TestClassOne. I looked through the API for Selenium RC and was unable to find a similar method for accomplishing the task.
Is there a JUnit-ish way to build a test suite or am I making a fundamental error in something that I’m doing or assuming.
Cheers,
Matt
June 4th, 2008 at 10:27 am
Oops, I found a typo in my previous comment. The error message states that no tests are found in the TestClassComposite Class, not the TestOneClass.
Cheers,
Matt