2

グラインダーツールの使用を開始しましたが、スクリプトを実行するたびに次のエラーが発生します。

ImportError: No module named net.grinder.script. Grinder

これは私が実行しようとしているスクリプトです

# A minimal script that tests The Grinder logging facility.
#
# This script shows the recommended style for scripts, with a
# TestRunner class. The script is executed just once by each worker
# process and defines the TestRunner class. The Grinder creates an
# instance of TestRunner for each worker thread, and repeatedly calls
# the instance for each run of that thread.

  from net.grinder.script.Grinder import grinder
  from net.grinder.script import Test

# A shorter alias for the grinder.logger.info() method.
  log = grinder.logger.info

# Create a Test with a test number and a description. The test will be
# automatically registered with The Grinder console if you are using
# it.
  test1 = Test(1, "Log method")

# Instrument the info() method with our Test.
  test1.record(log)

# A TestRunner instance is created for each thread. It can be used to
# store thread-specific data.
 class TestRunner:

# This method is called for every run.
 def __call__(self):
    log("Hello World")

このスクリプトを実行すると、インポート エラーが発生します。

CLASSPATH および JAVA_HOME 環境変数も設定しました。誰でも私を助けることができますか?

4

3 に答える 3

0

@私が投稿した詳細と照合していただけますか

http://stackoverflow.com/questions/19148365/cant-run-grinder-java-test-framework/19429771#19429771

パスの問題のようです。上記の解決策のいずれも機能しない場合は、「sys.path()」を使用してパスを手動で設定し、サンプル Jython スクリプト内に出力して、出力をここに貼り付けてください。

print sys.path
于 2014-05-05T07:15:52.810 に答える