Skip to content

Commit 24f8db7

Browse files
committed
Ad Karate example
1 parent 088d578 commit 24f8db7

File tree

4 files changed

+87
-0
lines changed

4 files changed

+87
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package com.epam.reportportal.example.karate;
2+
3+
import com.epam.reportportal.karate.ReportPortalHook;
4+
import com.intuit.karate.Results;
5+
import com.intuit.karate.Runner;
6+
import org.junit.jupiter.api.Assertions;
7+
import org.junit.jupiter.api.Test;
8+
9+
public class KarateRunnerTest {
10+
11+
@Test
12+
public void testAll() {
13+
Results results = Runner.builder()
14+
.path("classpath:features")
15+
.hook(new ReportPortalHook())
16+
.outputCucumberJson(true)
17+
.tags("~@ignore")
18+
.parallel(2);
19+
20+
Assertions.assertEquals(0, results.getFailCount(), "Non-zero fail count.\n Errors:\n" + results.getErrorMessages());
21+
}
22+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Feature: Demonstrate screenshot capturing on a test failure
2+
3+
Background:
4+
* configure driver = { type: 'chrome' }
5+
6+
Scenario: I report scenario with a screenshot on failure
7+
Given driver 'https://www.example.com'
8+
When var expectedTitle = java.lang.System.getenv('RP_EXPECTED_TITLE');
9+
Then match driver.title == expectedTitle
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
~ Copyright 2024 EPAM Systems
4+
~
5+
~ Licensed under the Apache License, Version 2.0 (the "License");
6+
~ you may not use this file except in compliance with the License.
7+
~ You may obtain a copy of the License at
8+
~
9+
~ http://www.apache.org/licenses/LICENSE-2.0
10+
~
11+
~ Unless required by applicable law or agreed to in writing, software
12+
~ distributed under the License is distributed on an "AS IS" BASIS,
13+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
~ See the License for the specific language governing permissions and
15+
~ limitations under the License.
16+
-->
17+
18+
<configuration>
19+
20+
<!-- Send debug messages to System.out -->
21+
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
22+
<!-- By default, encoders are assigned the type ch.qos.logback.classic.encoder.PatternLayoutEncoder -->
23+
<encoder>
24+
<pattern>%d{HH:mm:ss.SSS} %-5level %logger{5} - %thread - %msg%n</pattern>
25+
</encoder>
26+
</appender>
27+
28+
<appender name="RP" class="com.epam.reportportal.logback.appender.ReportPortalAppender">
29+
<encoder>
30+
<!--Best practice: don't put time and logging level to the final message. Appender do this for you-->
31+
<pattern>%d{HH:mm:ss.SSS} [%t] %-5level - %msg%n</pattern>
32+
<pattern>[%t] - %msg%n</pattern>
33+
</encoder>
34+
</appender>
35+
36+
<!-- We turned off framework logging by setting root level="WARN" to avoid logging encoded data into console. By setting level="TRACE"
37+
for "binary_data_logger" and connected it only to RP appender to log that data to ReportPortal. The 'additivity' flag is important!
38+
Without it logback will double-log log messages -->
39+
<logger name="binary_data_logger" level="TRACE" additivity="false">
40+
<appender-ref ref="RP"/>
41+
</logger>
42+
<logger name="com.epam.reportportal.example" level="TRACE"/>
43+
44+
<!-- By default, the level of the root level is set to DEBUG -->
45+
<root level="WARN">
46+
<appender-ref ref="RP"/>
47+
<appender-ref ref="STDOUT"/>
48+
</root>
49+
50+
</configuration>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
rp.endpoint=http://example.com
2+
rp.api.key=api-key
3+
rp.launch=launch-name
4+
rp.project=project-name
5+
rp.attributes=key:value;value
6+
rp.reporting.async=true

0 commit comments

Comments
 (0)