Skip to content

Commit

Permalink
Add the first integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
HardNorth committed Dec 11, 2023
1 parent 5b13d5d commit 44a1210
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 4 deletions.
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ dependencies {
testImplementation "org.junit.jupiter:junit-jupiter-engine:${project.junit_version}"
testImplementation "org.mockito:mockito-core:${project.mockito_version}"
testImplementation "org.mockito:mockito-junit-jupiter:${project.mockito_version}"
testImplementation 'org.hamcrest:hamcrest-core:2.2'
}

test {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import java.util.*;
import java.util.stream.Collectors;

public class KarateReportPortalRunner extends Suite {
public class KarateReportPortalRunner {

public static <T extends Builder<T>> Builder<T> path(String... paths) {
Builder<T> builder = new Builder<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.epam.reportportal.listeners.ListenerParameters;
import com.epam.reportportal.service.Launch;
import com.epam.reportportal.utils.ReflectUtils;
import com.epam.reportportal.karate.utils.ReflectUtils;
import com.epam.ta.reportportal.ws.model.FinishExecutionRQ;
import com.epam.ta.reportportal.ws.model.FinishTestItemRQ;
import com.epam.ta.reportportal.ws.model.StartTestItemRQ;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.epam.reportportal.karate.coderef;

import com.epam.reportportal.karate.utils.TestUtils;
import org.junit.jupiter.api.Test;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;

public class ScenarioCodeRefTest {
@Test
public void test_scenario_code_reference() {
var results = TestUtils.run("classpath:feature/simple.feature");
assertThat(results.getFailCount(), equalTo(0));
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.epam.reportportal.utils;
package com.epam.reportportal.karate.utils;

import java.lang.reflect.Field;

Expand All @@ -16,4 +16,4 @@ public static void setField(Object object, Field fld, Object value) {
throw new RuntimeException("Failed to set " + fieldName + " of object", e);
}
}
}
}
16 changes: 16 additions & 0 deletions src/test/java/com/epam/reportportal/karate/utils/TestUtils.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.epam.reportportal.karate.utils;

import com.epam.reportportal.karate.KarateReportPortalRunner;
import com.intuit.karate.Results;

public class TestUtils {
private TestUtils() {
}

public static Results run(String... paths) {
return KarateReportPortalRunner
.path(paths)
.outputCucumberJson(false)
.parallel(1);
}
}
5 changes: 5 additions & 0 deletions src/test/resources/feature/simple.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Feature: the very basic test to run by Karate
Scenario: Verify response code
Given url 'https://example.com/'
When method GET
Then status 200

0 comments on commit 44a1210

Please sign in to comment.