带有 sikulixapi 的 JMeter

JMeter with sikulixapi

我想在 JMeter 中使用 sikulixapi。

这是我在 JMeter Beanshell 采样器中的代码。

import org.sikuli.script.Pattern;
import org.sikuli.script.Screen;
import org.sikuli.script.FindFailed;
import org.sikuli.script.KeyModifier;
import org.sikuli.script.Match;
import java.io.IOException;
Screen screen = new Screen();
Pattern VNCviewer = new Pattern ("C:\patterns\openvncviewer\eclipse.png");
screen.click(VNCviewer);

我在执行 JMeter 脚本时遇到以下错误。

Response code:500
Response message:org.apache.jorphan.util.JMeterException:
Error invoking bsh method: eval Sourced file: inline evaluation of: 
`` import org.sikuli.script.Pattern; import 
org.sikuli.script.Screen; import org.s . . . '' 
Typed variable declaration : Object constructor

我正在使用 sikulixapi-2.0。5.jar 并且此 jar 已复制到 lib/ext 文件夹。

请告诉我这里有什么问题。

  1. 您需要将 jar 放入“lib”文件夹,“lib/ext”用于 JMeter Components and Plugins

  2. 单独
  3. sikulixapi-2.0.5.jar是不够的,还需要加上它的dependencies。完整列表类似于:

    animal-sniffer-annotations-1.17.jar
    ant-1.9.7.jar
    ant-launcher-1.9.7.jar
    antlr-3.5.2.jar
    antlr-runtime-3.5.2.jar
    asm-7.1.jar
    asm-analysis-7.1.jar
    asm-commons-7.1.jar
    asm-tree-7.1.jar
    asm-util-7.1.jar
    bcpkix-jdk15on-1.62.jar
    bcprov-jdk15on-1.62.jar
    checker-compat-qual-2.5.5.jar
    commons-beanutils-1.9.2.jar
    commons-cli-1.4.jar
    commons-collections-3.2.1.jar
    commons-compress-1.19.jar
    commons-exec-1.3.jar
    commons-io-2.8.0.jar
    commons-logging-1.2.jar
    error_prone_annotations-2.3.2.jar
    failureaccess-1.0.1.jar
    fontbox-2.0.21.jar
    ghost4j-1.0.1.jar
    guava-28.0-android.jar
    icu4j-59.1.jar
    itext-2.1.7.jar
    j2objc-annotations-1.3.jar
    jai-imageio-core-1.4.0.jar
    java-sizeof-0.0.5.jar
    javassist-3.22.0-GA.jar
    javax.servlet-api-3.1.0.jar
    jbig2-imageio-3.0.3.jar
    jboss-logging-3.1.4.GA.jar
    jboss-vfs-3.2.15.Final.jar
    jffi-1.2.19-native.jar
    jffi-1.2.20.jar
    jline-2.14.5.jar
    jna-5.6.0.jar
    jna-platform-5.6.0.jar
    jnr-a64asm-1.0.0.jar
    jnr-constants-0.9.12.jar
    jnr-ffi-2.1.10.jar
    jnr-netdb-1.1.6.jar
    jnr-posix-3.0.50.jar
    jnr-x86asm-1.0.2.jar
    jsr305-3.0.2.jar
    jython-slim-2.7.2.jar
    lept4j-1.13.2.jar
    listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar
    log4j-1.2.17.jar
    netty-buffer-4.1.45.Final.jar
    netty-codec-4.1.45.Final.jar
    netty-common-4.1.45.Final.jar
    netty-handler-4.1.45.Final.jar
    netty-resolver-4.1.45.Final.jar
    netty-transport-4.1.45.Final.jar
    opencv-4.3.0-3.jar
    pdfbox-2.0.21.jar
    pdfbox-debugger-2.0.21.jar
    pdfbox-tools-2.0.21.jar
    py4j-0.10.9.1.jar
    reflections8-0.11.6.jar
    sikulix2tigervnc-1.1.4.jar
    sikulixapi-2.0.5.jar
    slf4j-api-1.7.30.jar
    slf4j-nop-1.7.28.jar
    ST4-4.0.8.jar
    tess4j-4.5.4.jar
    xmlgraphics-commons-1.4.jar
    
  4. Since JMeter 3.1 it's recommended to use JSR223 Test Elements and Groovy language for scripting mainly because Groovy performance is much better, moreover Groovy has better Java compatibility and offers a lot of enhancements on top of normal Java SDK. See Apache Groovy - Why and How You Should Use It 文章了解更多信息。

使用 SikuliX 2.0.5 的 Maven 坐标 API 应该注意依赖关系。

来自 SikuliX 的 RaiMan