Merging of two projects

Both Simon Stewart and Jason Huggins thought that it would be a really good idea to merge the two projects together. This was then called Selenium 2.

The Selenium core developers have been working really hard to simplify the code base and remove as much duplication as possible. We have created what is known as Selenium Atoms, which is then shared between the two projects.

Now that we know the basics of how it all hangs together, let's set up a project that we can use for the rest of the chapter. By performing the steps in the link given below, we would be able to set up our Java environment:

  1. Install JDK 1.6 or higher from the Oracle website: http://www.oracle.com/technetwork/java/javase/downloads/index.html.
  2. To set up Java environment, refer to http://www.tutorialspoint.com/java/java_environment_setup.htm.

Setting up the IntelliJ IDEA project

We will be setting up IntelliJ IDEA project using JUnit as the testing framework to drive our tests. Let's get started with the following steps:

  1. Open IDEA and create a new project:
    Setting up the IntelliJ IDEA project
  2. Create a directory at the root of the project called test using New | Directory:
    Setting up the IntelliJ IDEA project
  3. Click on File | Project structure.
  4. Click on Modules on the left-hand side of the dialog box that has loaded.
  5. Click on the test folder that you created in the folder tree on the right-hand side of the dialog box:
    Setting up the IntelliJ IDEA project
  6. Click on the Test Sources button and the test folder should turn green. It will look like the following screenshot:
    Setting up the IntelliJ IDEA project
  7. Click on File | Project structure.
  8. Then, click on Global libraries.
  9. Click on the + button to add a New Global library. Then, select Java.
  10. Click on Attach Classes and add selenium.jar and common.jar. This should be in the same place as your Selenium-Server.jar. When added, it should look like the following screenshot:
    Setting up the IntelliJ IDEA project
  11. Do the same for JUnit now. You can create a New Global library for it or add it to the Selenium Global Library.
  12. Click on the Modules link on the left-hand side again.
  13. Click on the Dependencies tab.
  14. Click on Add and then click on Global Libraries. Add the Selenium and JUnit libraries.
  15. Click on Apply.
  16. We are now ready to run Selenium Server. We do this by running java–jar selenium-server.jar from Command Prompt or from a terminal, depending on your operating system.

Your project is ready to have tests added to it. Each of the files that we create from now on will be placed in the test directory and can be run when we need to.