|
| 1 | +/* |
| 2 | + * Copyright 2025 EPAM Systems |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * https://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | + |
1 | 17 | package com.epam.reportportal.example.karate; |
2 | 18 |
|
3 | | -import com.epam.reportportal.karate.KarateReportPortalRunner; |
| 19 | +import com.epam.reportportal.karate.ReportPortalHook; |
4 | 20 | import com.intuit.karate.Results; |
| 21 | +import com.intuit.karate.Runner; |
5 | 22 | import org.junit.jupiter.api.Assertions; |
6 | 23 | import org.junit.jupiter.api.Test; |
7 | 24 |
|
8 | 25 | public class KarateRunnerTest { |
9 | 26 |
|
10 | 27 | @Test |
11 | 28 | public void testAll() { |
12 | | - Results results = KarateReportPortalRunner // Our runner with a Karate Hook |
| 29 | + ReportPortalHook karateHook = new ReportPortalHook(); // Initialize ReportPortal runtime Karate hook |
| 30 | + Results results = Runner // Regular Karate runner |
13 | 31 | .path("classpath:features") // Path with feature files |
| 32 | + .hook(karateHook) // Add Karate hook |
14 | 33 | .outputCucumberJson(true) // Generate cucumber report |
15 | 34 | .tags("~@ignore") // Ignore tests marked with the tag |
16 | 35 | .parallel(2); // Run in 2 Threads |
| 36 | + // Here you can additionally run tests, retries, etc. |
| 37 | + karateHook.finishLaunch(); // Finish execution on ReportPortal |
17 | 38 | Assertions.assertEquals(0, results.getFailCount(), "Non-zero fail count.\n Errors:\n" + results.getErrorMessages()); |
18 | 39 | } |
19 | 40 | } |
0 commit comments