-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Labels
Description
Steps to reproduce:
- Create a new skeleton project with
mvn archetype:generate \
-DarchetypeGroupId=com.intuit.karate \
-DarchetypeArtifactId=karate-archetype \
-DarchetypeVersion=1.0.1 \
-DgroupId=com.mycompany \
-DartifactId=myproject
- Replace
karate-config.js
with env specific configkarate-config-sandbox.js
function fn() {
return {
baseUrl: 'https://jsonplaceholder.typicode.com'
}
}
- Replace fixed url in
users.feature
to configurable urlbaseUrl
Feature: sample karate test script
for help, see: https://github.com/intuit/karate/wiki/IDE-Support
Background:
* url baseUrl
- Run test and log
>> mvn clean test -Dkarate.env=sandbox
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------------< com.mycompany:myproject >-----------------------
[INFO] Building myproject 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ myproject ---
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ myproject ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/ngobrian/Workspace/sandbox/myproject/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ myproject ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ myproject ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 3 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ myproject ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 2 source files to /Users/ngobrian/Workspace/sandbox/myproject/target/test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.22.2:test (default-test) @ myproject ---
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running examples.ExamplesTest
10:08:23.800 [main] INFO com.intuit.karate.Runner - using system property 'karate.env': sandbox
10:08:24.679 [pool-1-thread-2] ERROR com.intuit.karate - classpath:examples/users/users.feature:5
* url baseUrl
>>>> js failed:
01: baseUrl
<<<<
org.graalvm.polyglot.PolyglotException: ReferenceError: "baseUrl" is not defined
- <js>.:program(Unnamed:1)
classpath:examples/users/users.feature:5
10:08:24.679 [pool-1-thread-1] ERROR com.intuit.karate - classpath:examples/users/users.feature:5
* url baseUrl
>>>> js failed:
01: baseUrl
<<<<
org.graalvm.polyglot.PolyglotException: ReferenceError: "baseUrl" is not defined
- <js>.:program(Unnamed:1)
classpath:examples/users/users.feature:5
---------------------------------------------------------
feature: classpath:examples/users/users.feature
scenarios: 2 | passed: 0 | failed: 2 | time: 0.0191
---------------------------------------------------------
10:08:25.138 [pool-2-thread-1] INFO com.intuit.karate.Suite - <<fail>> feature 1 of 1 (0 remaining) classpath:examples/users/users.feature
Karate version: 1.0.1
======================================================
elapsed: 1.34 | threads: 5 | thread time: 0.02
features: 1 | skipped: 0 | efficiency: 0.00
scenarios: 2 | passed: 0 | failed: 2
======================================================
>>> failed features:
>>>> js failed:
01: baseUrl
<<<<
org.graalvm.polyglot.PolyglotException: ReferenceError: "baseUrl" is not defined
- <js>.:program(Unnamed:1)
classpath:examples/users/users.feature:5
>>>> js failed:
01: baseUrl
<<<<
org.graalvm.polyglot.PolyglotException: ReferenceError: "baseUrl" is not defined
- <js>.:program(Unnamed:1)
classpath:examples/users/users.feature:5
<<<
How did I find this bug?
I'm upgrading karate v0.9.6 to v1.0.1, the env specific config was working fine but stopped working on the new version.