kirksl / karate-runner

VSCode Extension for Karate
https://marketplace.visualstudio.com/items?itemName=kirkslota.karate-runner
MIT License
34 stars 11 forks source link

Issue running the tests with the runner #173

Closed carlos-vargas-pplus closed 1 year ago

carlos-vargas-pplus commented 1 year ago

Hello, I have been following this issue https://github.com/kirksl/karate-runner/issues/138 (added java -cp karate.jar:target/test-classes com.intuit.karate.Main) but still no luck Seems karate-config is not even recognized since the variables i am calling from there seems unexistant

I am using macOS and java 11

image

and this is my pom

`<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

4.0.0
<groupId>org.example</groupId>
<artifactId>KarateMvn</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <java.version>11</java.version>
    <maven.compiler.version>3.8.1</maven.compiler.version>
    <karate.version>1.3.1</karate.version>
</properties>

<dependencies>
    <dependency>
        <groupId>com.intuit.karate</groupId>
        <artifactId>karate-core</artifactId>
        <version>${karate.version}</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/com.intuit.karate/karate-junit5 -->
    <dependency>
        <groupId>com.intuit.karate</groupId>
        <artifactId>karate-junit5</artifactId>
        <version>${karate.version}</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind -->
    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-databind</artifactId>
        <version>2.14.2</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core -->
    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-core</artifactId>
        <version>2.14.2</version>
    </dependency>
</dependencies>
src/test/java **/*.java org.apache.maven.plugins maven-compiler-plugin ${maven.compiler.version} UTF-8 ${java.version} ${java.version} -Werror org.apache.maven.plugins maven-surefire-plugin 2.22.2

`

PD1: I am able to run everything with the intellij plugin but dont know why I cant on vscode PD2: Also I have the same issue on this project you posted on the issue https://github.com/kirksl/karate-maven-gradle

kirksl commented 1 year ago

Hi Carlos - Can you help me a little more with your repro steps.

  1. Clone karate-maven-gradle on macOS
  2. Add java -cp karate.jar:target/test-classes com.intuit.karate.Main ** Are you adding this to settings under Karate Runner > Karate Jar: Command Line Args?
  3. What are your next steps?
  4. I haven't used karate-config much with karate.jar, but I believe it requires some setup https://stackoverflow.com/questions/61913993/how-to-define-or-use-karate-config-js-in-standalone-jar

Since you can reproduce the issue with karate-maven-gradle, if you want to just create a PR with the repro steps I can pull it down and work on this. That PR should also pickup the changes you're making in Karate Runner settings too if you are changing that.

carlos-vargas-pplus commented 1 year ago

have cloned your repo

added the commandline: image

just clicked on run: image

and got this error (seems karate-config is not being recognized) image

carlos-vargas-pplus commented 1 year ago

update the issue I was tracking since I put the wrong link, this is the correct one https://github.com/kirksl/karate-runner/issues/138 seems the same issue

kirksl commented 1 year ago

HI @carlos-vargas-pplus did issue #138 resolve your issue or are you still having problems?

carlos-vargas-pplus commented 1 year ago

hello kirk, I followed the advise there but still have the same issue. Im pretty sure is something karate-config is not being recognized when running the tests

kirksl commented 1 year ago

@carlos-vargas-pplus Sorry for the delay. I believe you just need to ensure karate-config.js can be found by either placing it at the root of the project or using -Dkarate.config.dir=[path] variable. Here's a quick example with it working. This is karate.jar 1.3.1.

image

carlos-vargas-pplus commented 1 year ago

Hi kirk, thanks for your time

  1. karate-config is on src/test it has to be on the root of the project?
  2. Where I can configure -Dkarate.config.dir=[path]? seems I never configured that
kirksl commented 1 year ago

Putting karate-config in another location should be fine. I have not used this configuration much, but you should be able to set it as shown below https://github.com/karatelabs/karate/issues/1330

image

carlos-vargas-pplus commented 1 year ago

ok thanks, I think we can close this since is not exactly related to the extension

kirksl commented 1 year ago

@carlos-vargas-pplus Let us know if you need anything else. For Karate (not extension) questions feel free to reach out to Karate directly. They are very responsive on Github and Stackoverflow.