51Testing软件测试论坛

标题: 新人求助,如何用eclipse运行JMeter代码 [打印本页]

作者: brilliant18    时间: 2009-3-8 22:34
标题: 新人求助,如何用eclipse运行JMeter代码
由于毕设的要求需要看一下JMeter的代码,我下载了jakarta-jmeter-2.3.2_src.zip,然后我自己试着导入了一下,但是有很多错误,不知道应该导入才能正确运行呢?请指点,不胜感激!
作者: happyeveday    时间: 2009-4-24 13:47
ant
作者: ljonathan    时间: 2009-8-19 16:03
楼上的没说清楚

ant?
作者: ljonathan    时间: 2009-8-21 23:06
楼上明示
作者: mklodoss    时间: 2009-12-17 21:05
标题: eclipse3.2 下编译jmeter源代码
1,下载jakarta-jmeter-2.2_src.zip和jakarta-jmeter-2.2.zip解压。
2,下载3个jar包,(很重要要不会有n多的错误),分别是mail.jar,jms.jar,activation.jar
3,将jakarta-jmeter-2.2.zip下的lib中的jar包拷到jakarta-jmeter-2.2_src.zip下的lib目录中并加上下载的三个jar包。并且修改
commons-logging1.1.jar为commons-logging.jar。然后在lib目录下新增两个空文件夹ext,junit.
4,从jakarta-jmeter-2.2.zip解压的目录下复制ApacheJMeter.jar和jmeter.properties到jakarta-jmeter-2.2_src.zip解压的目录下。
5,然后打开eclipse,新建java工程,命名,选择import,选择从文件导入,选择jakarta-jmeter-2.2_src.zip解压后的目录,选择除src目录以外的所有目录。之后再导入src目录(因为新建java工程是已经有src目录了),所以要分别导入。
6,关闭eclipse将jakarta-jmeter-2.2_src.zip下的eclipse.classpath中的内容复制一份替换工程下的.classpath的内容,同时增加几个jar包。内容如下:
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
    <classpathentry utput="build/jorphan" kind="src" path="src/jorphan"/>
    <classpathentry utput="build/examples" kind="src" path="src/examples"/>
    <classpathentry utput="build/junit" kind="src" path="src/junit"/>
    <classpathentry utput="build/reports" kind="src" path="src/reports"/>
    <classpathentry utput="build/test" kind="src" path="test/src"/>
    <classpathentry utput="build/protocol/jms" kind="src" path="src/protocol/jms"/>
    <classpathentry utput="build/protocol/mail" kind="src" path="src/protocol/mail"/>
    <classpathentry excluding="org/apache/jmeter/images/|org/apache/jmeter/resources/*.properties" utput="build/core" kind="src" path="src/core"/>
    <classpathentry utput="build/components" kind="src" path="src/components"/>
    <classpathentry utput="build/functions" kind="src" path="src/functions"/>
    <classpathentry utput="build/protocol/http" kind="src" path="src/protocol/http"/>
    <classpathentry utput="build/protocol/ftp" kind="src" path="src/protocol/ftp"/>
    <classpathentry utput="build/protocol/jdbc" kind="src" path="src/protocol/jdbc"/>
    <classpathentry utput="build/protocol/java" kind="src" path="src/protocol/java"/>
    <classpathentry utput="build/protocol/ldap" kind="src" path="src/protocol/ldap"/>
    <classpathentry utput="build/protocol/tcp" kind="src" path="src/protocol/tcp"/>
    <classpathentry utput="build/monitor/model" kind="src" path="src/monitor/model"/>
    <classpathentry utput="build/monitor/components" kind="src" path="src/monitor/components"/>
    <classpathentry utput="build/htmlparser" kind="src" path="src/htmlparser"/>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
    <classpathentry kind="lib" path="lib/excalibur-logger-1.1.jar"/>
    <classpathentry kind="lib" path="lib/avalon-framework-4.1.4.jar"/>
    <classpathentry kind="lib" path="lib/jakarta-oro-2.0.8.jar"/>
    <classpathentry kind="lib" path="lib/js.jar"/>
    <classpathentry kind="lib" path="lib/junit.jar"/>
    <classpathentry kind="lib" path="lib/logkit-1.2.jar"/>
    <classpathentry kind="lib" path="lib/Tidy.jar"/>
    <classpathentry kind="lib" path="lib/commons-collections.jar"/>
    <classpathentry kind="lib" path="lib/commons-codec-1.3.jar"/>
    <classpathentry kind="lib" path="lib/soap.jar"/>
    <classpathentry kind="lib" path="lib/jdom-1.0.jar"/>
    <classpathentry kind="lib" path="lib/xalan.jar"/>
    <classpathentry kind="lib" path="lib/xercesImpl.jar"/>
    <classpathentry kind="lib" path="lib/xml-apis.jar"/>
    <classpathentry kind="lib" path="lib/commons-httpclient-3.0.1.jar"/>
    <classpathentry kind="lib" path="lib/commons-logging.jar"/>
        <classpathentry kind="lib" path="lib/commons-jexl-1.0.jar"/>
    <classpathentry kind="lib" path="lib/excalibur-datasource-1.1.1.jar"/>
    <classpathentry kind="lib" path="lib/excalibur-instrument-1.0.jar"/>
    <classpathentry kind="lib" path="lib/excalibur-pool-1.2.jar"/>
    <classpathentry kind="lib" path="lib/xstream-1.1.3.jar"/>
    <classpathentry kind="lib" path="lib/xpp3_min-1.1.3.4.I.jar"/>
    <classpathentry kind="lib" path="lib/batik-awt-util.jar"/>
    <classpathentry kind="lib" path="lib/jCharts-0.7.5.jar"/>
    <classpathentry kind="lib" path="lib/bsf-2.3.0.jar"/>
        <classpathentry kind="lib" path="lib/mail.jar"/>
        <classpathentry kind="lib" path="lib/activation.jar"/>
        <classpathentry kind="lib" path="lib/jms.jar"/>
    <classpathentry kind="output" path="lib/ext"/>
                                          
</classpath>
然后重新开启eclipse,选择工程编译,此时会有20个错误吧,是junit的错误,定位到java文件修改下代码(前几行有正确的格式assertequal函数的参数有错)。编译成功了。

8,选择build.xml使用ant打包.
9,之后可参考http://people.apache.org/~mkostrze/jmeter-eclipse/index.html的后半部份,这样就可以用eclipse来进行debug了。




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2