-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathhello.feature
54 lines (49 loc) · 1.5 KB
/
hello.feature
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
Feature: grpc
Background:
* def session = karate.consume('grpc')
* session.host = 'localhost'
* session.port = karate.properties['grpc.port']
* session.proto = 'classpath:karate/hello.proto'
* session.service = 'HelloService'
Scenario: unary
* session.method = 'Hello'
* session.send({ name: 'John' })
* match session.pop() == { message: 'hello John' }
* session.send({ name: 'Smith' })
* match session.pop() == { message: 'hello Smith' }
Scenario: server stream
* session.method = 'LotsOfReplies'
* session.count = 3
* session.send({ name: 'John' })
* def result = session.collect()
* match result ==
"""
[
{ message: 'hello John 1' },
{ message: 'hello John 2' },
{ message: 'hello John 3' }
]
"""
Scenario: client stream
* session.method = 'LotsOfGreetings'
* session.stream = true
* session.send({ name: 'John' })
* session.send({ name: 'Smith' })
* session.send({ name: 'Jane' })
* session.flush()
* match session.pop() == { message: 'hello [John, Smith, Jane]' }
Scenario: bidi
* session.method = 'BidiHello'
* session.stream = true
* session.count = 3
* session.send({ name: 'John' })
* session.send({ name: 'Smith' })
* session.send({ name: 'Jane' })
* match session.collect() ==
"""
[
{ message: 'hello [John]' },
{ message: 'hello [John, Smith]' },
{ message: 'hello [John, Smith, Jane]' }
]
"""