Skip to content

Commit 9e2727e

Browse files
committed
documentation improvements
1 parent a647840 commit 9e2727e

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,6 @@ Karate requires [Java](http://www.oracle.com/technetwork/java/javase/downloads/i
9191

9292
Karate is designed so that you can choose between the [Apache](https://hc.apache.org/index.html) or [Jersey](https://jersey.java.net) HTTP client implementations.
9393

94-
Prefer `karate-apache` unless you run into class-loading conflicts, for example - if an older version of the Apache libraries are being used within your project.
95-
9694
So you need two `<dependencies>`:
9795

9896
```xml
@@ -109,6 +107,8 @@ So you need two `<dependencies>`:
109107
<scope>test</scope>
110108
</dependency>
111109
```
110+
And if you run into class-loading conflicts, for example if an older version of the Apache libraries are being used within your project - then use `karate-jersey` instead of `karate-apache`.
111+
112112
### TestNG instead of JUnit
113113
If you want to use [TestNG](http://testng.org), use the artifactId [`karate-testng`](https://mvnrepository.com/artifact/com.intuit.karate/karate-testng). If you are starting a project from scratch, we strongly recommend that you use JUnit. Do note that [dynamic tables](#data-driven-features), [data-driven](#data-driven-tests) testing and [tag-groups](#cucumber-tags) are built-in to Karate, so that you don't need to depend on things like the TestNG [`@DataProvider`](http://testng.org/doc/documentation-main.html#parameters-dataproviders) anymore.
114114

karate-demo/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ as well as demonstrate various Karate features and best-practices.
1414
[`call-json-array.feature`](src/test/java/demo/callarray/call-json-array.feature) | This example loads JSON data from a file and uses it to call a `*.feature` file in a loop. This approach can enable very dynamic data-driven tests, since there are a variety of ways by which you can create the JSON data, for example by calling custom Java code.
1515
[`call-table.feature`](src/test/java/demo/calltable/call-table.feature) | This is a great example of how Karate combines with Cucumber and JsonPath to give you an extremely readable data-driven test. Karate's [`table`](https://github.com/intuit/karate#table) keyword is a super-elegant and readable way to create JSON arrays, perfect for setting up all manner of data-driven tests.
1616
[`call-dynamic-json.feature`](src/test/java/demo/calldynamic/call-dynamic-json.feature) | Shows how to dynamically create a JSON array and then use it to call a `*.feature` file in a loop. In this example, the JSON is created using a JavaScript function, but it can very well be the response from an HTTP call, the result of a JsonPath expression or even a List of HashMap-s acquired by [calling Java](https://github.com/intuit/karate#calling-java). This test actually calls a second `*.feature` file in a loop to validate a 'get by id'. Using JsonPath and [`match each`](https://github.com/intuit/karate#match-each) to validate all items within a JSON array is also demonstrated.
17-
[`call-once.feature`](src/test/java/demo/callonce/call-once.feature) | `Background:` steps in Cucumber are re-run for every `Scenario:` and unfortunately even for every `Examples:` row in any `Scenario Outline:` present. This is clearly not ideal especially for HTTP calls that are expensive and time-consuming and [this is still an open issue](https://github.com/cucumber/cucumber-jvm/issues/515) for the Cucumber-JVM project. Fortunately you can elegantly work-around this limitation of Cucumber with the help of Karate's Java interop.
17+
[`call-once.feature`](src/test/java/demo/callonce/call-once.feature) | `Background:` steps in Cucumber are re-run for every `Scenario:` and unfortunately even for every `Examples:` row in any `Scenario Outline:` present. This is clearly not ideal especially for HTTP calls that are expensive and time-consuming and [this is still an open issue](https://github.com/cucumber/cucumber-jvm/issues/515) for the Cucumber-JVM project. Fortunately you can elegantly work-around this limitation of Cucumber with the help of Karate's [Java interop](https://github.com/intuit/karate#calling-java).
1818

1919
## Best Practices
2020
| File | Demonstrates

karate-demo/src/test/java/demo/callonce/call-once.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Feature: how to implement 'run only once' or set-up that behaves like @BeforeClass
1+
Feature: test set-up routines that run only once, similar to how @BeforeClass works
22

33
Background:
44

0 commit comments

Comments
 (0)