-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
karate.config.dir can set the dir in which config files will be looked for if karate.env is set, karate-config-<env>.js will be looked for in the config dir which defaults to .karate in working dir working dir should be the maven project base dir / or within the root so teams can keep env over-rides in this one file
- Loading branch information
Showing
10 changed files
with
103 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
function() { | ||
return { confoverride: 'success' }; | ||
} |
26 changes: 26 additions & 0 deletions
26
karate-junit4/src/test/java/com/intuit/karate/junit4/config/ConfigTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.intuit.karate.junit4.config; | ||
|
||
import com.intuit.karate.cucumber.CucumberRunner; | ||
import org.junit.Test; | ||
|
||
/** | ||
* | ||
* @author pthomas3 | ||
*/ | ||
public class ConfigTest { | ||
|
||
@Test | ||
public void testOverrideDir() { | ||
System.setProperty("karate.config.dir", "src/test/java/com/intuit/karate/junit4/config"); | ||
System.setProperty("karate.env", "custom"); | ||
CucumberRunner.runFeature(this.getClass(), "config-dir.feature", null, true); | ||
System.clearProperty("karate.config.dir"); | ||
} | ||
|
||
@Test | ||
public void testOverrideEnv() { | ||
System.setProperty("karate.env", "confdemo"); | ||
CucumberRunner.runFeature(this.getClass(), "config-env.feature", null, true); | ||
} | ||
|
||
} |
6 changes: 6 additions & 0 deletions
6
karate-junit4/src/test/java/com/intuit/karate/junit4/config/config-dir.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
@ignore | ||
Feature: config dir over-ride | ||
|
||
Scenario: check if ./karate-config-custom.js was invoked | ||
* match diroverride == 'worked' | ||
* match envoverride == 'done' |
5 changes: 5 additions & 0 deletions
5
karate-junit4/src/test/java/com/intuit/karate/junit4/config/config-env.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
@ignore | ||
Feature: config over-ride per environment | ||
|
||
Scenario: check if .karate/karate-config-confdemo.js was invoked | ||
* match confoverride == 'success' |
3 changes: 3 additions & 0 deletions
3
karate-junit4/src/test/java/com/intuit/karate/junit4/config/karate-config-custom.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
function() { | ||
return { envoverride: 'done' }; | ||
} |
3 changes: 3 additions & 0 deletions
3
karate-junit4/src/test/java/com/intuit/karate/junit4/config/karate-config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
function() { | ||
return { diroverride: 'worked' }; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters