Skip to content

Commit

Permalink
ReportPortalHook: Tests WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
HardNorth committed Jan 8, 2024
1 parent 0c33fe8 commit b00232d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public void test_test_case_id(boolean report) {
} else {
results = TestUtils.runAsHook(rp, TEST_FEATURE);
}
assertThat(results.getFailCount(), equalTo(0));;
assertThat(results.getFailCount(), equalTo(0));

ArgumentCaptor<StartTestItemRQ> captor = ArgumentCaptor.forClass(StartTestItemRQ.class);
verify(client, times(1)).startTestItem(captor.capture());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@
import com.epam.reportportal.service.ReportPortalClient;
import com.epam.reportportal.util.test.CommonUtils;
import com.epam.ta.reportportal.ws.model.launch.StartLaunchRQ;
import com.intuit.karate.Results;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
import org.mockito.ArgumentCaptor;

import java.util.List;
Expand All @@ -37,6 +40,7 @@
import static org.mockito.Mockito.verify;

public class LaunchRequiredFieldsTest {
private static final String TEST_FEATURE = "classpath:feature/simple.feature";
private final String featureId = CommonUtils.namedId("feature_");
private final String scenarioId = CommonUtils.namedId("scenario_");
private final List<String> stepIds = Stream.generate(() -> CommonUtils.namedId("step_"))
Expand All @@ -51,9 +55,15 @@ public void setupMock() {
mockBatchLogging(client);
}

@Test
public void verify_start_launch_request_contains_required_fields() {
var results = TestUtils.runAsReport(rp, "classpath:feature/simple.feature");
@ParameterizedTest
@ValueSource(booleans = {true, false})
public void verify_start_launch_request_contains_required_fields(boolean report) {
Results results;
if (report) {
results = TestUtils.runAsReport(rp, TEST_FEATURE);
} else {
results = TestUtils.runAsHook(rp, TEST_FEATURE);
}
assertThat(results.getFailCount(), equalTo(0));

ArgumentCaptor<StartLaunchRQ> startCaptor = ArgumentCaptor.forClass(StartLaunchRQ.class);
Expand Down

0 comments on commit b00232d

Please sign in to comment.