Skip to content

Repository files navigation

TestRail4J CI/CDMavenCentralReadTheDocsAlertStatusCoverage

Java HTTP-client for the TestRail API.

TestRail4J represented by two client modules with gson and Jackson2 models respectively. This is done for the convenience of the end user, so as not to use unnecessary dependencies in the project if one of the presented models is already used in the project.

Full documentation is available on the testrail4j.readthedocs.io.

Briefly

  • Add repository and necessary feign client
<dependency>
<groupId>org.touchbit.testrail4j</groupId>
<artifactId>jackson2-feign-client</artifactId>
<version>${testrail4j.version}</version>
</dependency>

or

<dependency>
<groupId>org.touchbit.testrail4j</groupId>
<artifactId>gson-feign-client</artifactId>
<version>${testrail4j.version}</version>
</dependency>
  • Build client using TestRailClientBuilder and call the necessary method
publicclassExample {
publicstaticvoidmain(String[] a) {
TestRailClientclient = TestRailClientBuilder
.build("user", "pass", "http://localhost");
Projectproject = client.addProject("name", "announcement", true, 3);
Sectionsection = newSection()
.withName(UUID.randomUUID().toString())
.withDescription(UUID.randomUUID().toString());
Sectionsection = client.addSection(section, project.getId());
Casecaze = newCase()
.withTitle("test_20190101201312")
.withPriorityId(CRITICAL.getId())
.withSuiteId(section.getSuiteId())
.withRefs("JIRA-123")
.withTypeId(ACCEPTANCE.getId())
.withTemplateId(TEST_CASE_TEXT.getId())
.withEstimate("1m 45s")
.withCustomPreconds("withCustomPreconds")
.withCustomSteps("withCustomSteps")
.withCustomExpected("withCustomExpected")
.withCustomStepsSeparated(null);
Casecaze = client.addCase(caze, section);
System.out.println(caze.getId());
}
}
  • You can build the Feign client yourself and customize it to fit your needs.
TestRailClientclient = newFeign.Builder()
.client(newClient.Proxied(sslContextFactory, hostnameVerifier, proxy))
.encoder(newGsonEncoder())
.decoder(newGsonDecoder())
.logger(newCustomLogger())
.logLevel(FULL)
.requestInterceptors(Arrays.asList(interceptors))
.options(newRequest.Options(10, TimeUnit.SECONDS, 60, TimeUnit.SECONDS, true))
.errorDecoder(newCustomTestRailErrorDecoder())
.target(TestRailClient.class, "https://testrail.custom");

Modules (org.touchbit.testrail4j)

  • jackson2-feign-client - Feign client with jackson2 models.
  • gson-feign-client - Feign client with gson models.
  • gson-api-model - Gson annotated models (DTO).
  • jackson2-api-model - Jackson2 annotated models (DTO).
  • testrail4j-core - Base implementation of common classes for the Feign client (without depend of models).
  • testrail4j-schema - Json schemas for TestRail API.

Restrictions

TestRailClient#addCaseField(TRCaseField)

The returned object for the method of creating a new test case custom field is not available until the correction of the defect

About

Java HTTP-client for the TestRail API

Topics

Resources

Stars

16 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages