Executing Karate jar with mock using external library Spring Framework

前端 未结 1 1618
你的背包
你的背包 2020-12-02 01:13

Good morning. I am working on a project that uses Karate Standalone. I am completely new to Karate to excuse my lack of knowledge here.

The standalone karate jar is

相关标签:
1条回答
  • 2020-12-02 01:44

    Thanks for asking this, and I think I've figured out a way to do this which opens up a lot of great possibilities. The solution is to use Java first-principles, and not use the -jar option. The Karate command-line-app (or CLI) class happens to be com.intuit.karate.Main. I'm going to provide a demo here of using SikuliX. First, the feature file test.feature:

    Feature: sikuli test
    
    Background:
    * def Screen = Java.type('org.sikuli.script.Screen')
    
    Scenario:
    * def s = new Screen()
    * def c = s.capture()
    * c.getFile('.')
    

    And with the karate.jar and sikulixapi.jar in the same folder on the command line, this works (for windows, use ; instead of : as the "path separator"):

    java -cp karate.jar:sikulixapi.jar com.intuit.karate.Main test.feature
    

    For those looking to customize the classpath for the Visual Studio Code "Karate Runner" extension, please refer this: https://github.com/intuit/karate/wiki/Karate-Robot-Windows-Install-Guide#change-command-line-settings

    0 讨论(0)
提交回复
热议问题