Skip to content

Commit c736f56

Browse files
committed
adding abort example to demo for discussion ref #755
1 parent 8a844ea commit c736f56

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package demo.abort;
2+
3+
import com.intuit.karate.junit4.Karate;
4+
import org.junit.BeforeClass;
5+
import org.junit.runner.RunWith;
6+
7+
/**
8+
*
9+
* @author pthomas3
10+
*/
11+
@RunWith(Karate.class)
12+
public class AbortRunner {
13+
14+
@BeforeClass
15+
public static void beforeClass() {
16+
// skip 'callSingle' in karate-config.js
17+
System.setProperty("karate.env", "mock");
18+
}
19+
20+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Feature: abort should skip (but not fail) a test
2+
3+
Scenario: you can conditionally exit a test
4+
but please use sparingly
5+
6+
* print 'before'
7+
* eval if (true) karate.abort()
8+
* print 'after'
9+

karate-junit4/src/test/java/com/intuit/karate/junit4/demos/examples.feature

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Given def cat =
1616
Then match cat.kittens[*].id == [23, 42]
1717
Then match cat.kittens[*].id contains 23
1818
Then match cat.kittens[*].id contains [42, 23]
19+
Then match cat..name == ['Billie', 'Bob', 'Wild']
1920
Then match each cat.kittens contains { id: '#number' }
2021
Then match each cat.kittens == { id: '#notnull', name: '#regex [A-Z][a-z]+' }
2122

0 commit comments

Comments
 (0)