Class RunCommand

java.lang.Object
io.karatelabs.cli.RunCommand
All Implemented Interfaces:
Callable<Integer>

public class RunCommand extends Object implements Callable<Integer>
The 'run' subcommand for executing Karate tests.

Usage examples:

 # Run all tests (uses karate-pom.json if present)
 karate run

 # Run specific paths (inherits other settings from karate-pom.json)
 karate run src/test/resources

 # Run with specific tags and environment
 karate run -t @smoke -e dev src/test/resources

 # Run with custom pom file
 karate run -p custom-pom.json

 # Run ignoring karate-pom.json
 karate run --no-pom src/test/resources
 
  • Field Details

  • Constructor Details

    • RunCommand

      public RunCommand()
  • Method Details

    • call

      public Integer call()
      Specified by:
      call in interface Callable<Integer>
    • isFormatEnabled

      public static boolean isFormatEnabled(List<String> formats, String format, boolean defaultValue)
      Check if a format is enabled based on the -f/--format flag. Supports negation with ~ prefix (e.g., ~html disables html). Reused by KarateOptionsHandler when parsing the karate.options system property.
      Parameters:
      formats - the parsed formats list (may be null)
      format - the format name (e.g., "html", "cucumber:json")
      defaultValue - the default value if format not mentioned
      Returns:
      true if format is enabled
    • runWithPaths

      public Integer runWithPaths(List<String> legacyPaths)
      Run with paths provided externally (for legacy command handling).
      Parameters:
      legacyPaths - paths from legacy command invocation
      Returns:
      exit code
    • getPaths

      public List<String> getPaths()
    • getTags

      public List<String> getTags()
    • getThreads

      public Integer getThreads()
    • getEnv

      public String getEnv()
    • getScenarioName

      public String getScenarioName()
    • getOutputDir

      public String getOutputDir()
    • getConfigDir

      public String getConfigDir()
    • isDryRun

      public Boolean isDryRun()
    • getPomFile

      public String getPomFile()
    • getWorkingDir

      public String getWorkingDir()
    • getPathOptions

      public List<String> getPathOptions()
    • getFormats

      public List<String> getFormats()
    • getLogReport

      public String getLogReport()
    • getLogConsole

      public String getLogConsole()