Thursday, March 17, 2011

JMeter -- Process Setup 02 -- Downloads and Installations

This is part two of the JMeter Process Setup.  Part one can be found here:

The real heart of the Automated JMeter execution process is your Ant build.xml file.  This is so essential that the JMeter guys have already included the Ant ant-jmeter-1.0.9.jar file for us in the extras folder!  Ah, but I'm getting ahead of myself, let's start from scratch -- this will all be geared toward a setup on a Windows machine -- either a Windows Server or Windows XP/Vista/7.

  1. Download and Install the Java JDK(Java Developers Toolkit).
    1. The Java Runtime Environment (Java JRE) is included in the JDK
    2. The JRE and part of the JDK are required for everything to work properly.
      1. If the JDK's tools.jar is missing, Ant complains about it, which is why we are downloading it.
    3. You can either
      1. Download the .exe file and then run it (following the prompts to set it up)
      2. Or you can just directly run it as it is downloading
      Downloading the Java Development Toolkit
    4. By default, it should install to C:\Program Files\Java\jre6
  2. Download JMeter on the computer you want to install it on.
    1. The JMeter download page.
    2. I'd recommend downloading the Binary Zip -- seems the least confusing to me.
  3. Unzip the file.
    1. Right click and choose the "Extract All..." option
    2. Extracting in Windows XP
    3. Extract to the C drive [C:\].  (Note you can extract to anywhere you want, but for simple set up and ease of explaining, I'll assume you're just going to follow this guide, step by step.)
    4. Extracting in Windows 7
    5. This will install it in a subfolder named after the zip file, which at the time of this writing is jakatarta-jmeter-2.4
  4. Download Apache Ant on the computer you want to install it on.
    1. The Apache Ant download page.
    2. Again, I'd recommend getting the Binary Zip.
    3. Unzip the file using the same method above.

    • Java JRE, JMeter, and Ant are all downloaded.
    • Java was installed.
    • JMeter and Ant were both extracted.

    To get everything to work together properly, we need to do a couple of things:
    1. Add environment variables so that we can call these programs from the command line with less typing.
    2. Add .jar files to the proper class paths.

    Windows Key + R will open the command prompt
    1. Open up a command prompt (Windows Key + r) > cmd.
    2. In the command prompt enter the command:
    3. java -version
      • If you never had Java installed, you might get an error at this point that says
        • 'java' is not recognized as an internal or external command, operable program or batch file.
      • If it is installed correctly, it will display something like
        • java version "1.6.0_24"
          Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
          Java HotSpot(TM) Client VM (build 19.1-b02, mixed mode, sharing)
          Java is not installed (on XP)
          Java is installed (on XP)
    4. Click start > Right click on My Computer (XP) / Computer (7)  > Click on Properties.
      1. If you're in XP, click on the Advanced tab.
      2. Environment Variables in XP
      3. If you're in Vista/7, click on Advanced System Settings in the left navigation section.
        1. Environment Variables in Windows 7
      4. Click on Environment Variables (at the bottom).
      5. In the System Variables section, Add a "New..." variable named JAVA_HOME with the value C:\Program Files\Java\jdk1.6.0_24 (or wherever you have it installed).
      6. In the System Variables section, Add a "New..." variable named ANT_HOME with the value C:\apache-ant-1.8.2 (or wherever you have it installed).
      7. In the System Variables section, "Edit.." the Path variable.
        1. After the last entry in the value, add a semi-colon ;
        2. Then enter the Ant bin location, either C:\apache-ant-1.8.2\bin; or %ANT_HOME%\bin;
      8. Click Okay to accept the changes to the Environment Variables and Okay to accept the chagnes to the System Settings.
      9. Verify that ant works correctly now.
        1. In the command prompt type
          • ant -version
        2. If at all nothing is happening, reboot your computer and try it again.  You should get a message saying:
          • Apache Ant(TM) version 1.8.2 compiled on December 20 2010
        3. If it still refuses to work, manually go to the Ant/bin folder and execute the ant.bat file. Sometimes this seems to kick it into working.
        4. You can look here for more information on properly installing Ant.
      10. Add JMeter functionality to Ant.
        1. In Windows Explorer, navigate to JMeter's extras folder and copy the file ant-jmeter-1.0.9.jar.
        2. Navigate to Ant's lib folder and paste it.  This is referred to as "adding the JMeter classpath to Ant."
    Congratulations!!  You've not got most of the setup completed!  The next steps will be to extend Ant's capability further by adding two more classpaths, and then to create our buildfile, and our folder setup!

    No comments:

    Post a Comment

    Related Posts Plugin for WordPress, Blogger...