Skip to content

Latest commit

 

History

History
276 lines (196 loc) · 12 KB

README.md

File metadata and controls

276 lines (196 loc) · 12 KB

Testerra HPQC connector

Maven Central

SetupDocumentationSupportContributeContributorsLicensing

About this module

This module provides additional features for Testerra Framework for automated tests.

This module provides an automatic test result synchronization to MicroFocus Application Lifecycle Management, former called HP QualityCenter. The module will register automatically by using ModuleHook.

See more details about the MicroFocus ALM REST API here: https://admhelp.microfocus.com/alm/en/12.55/api_refs/REST_TECH_PREVIEW/ALM_REST_API_TP.html

Setup

Requirements

HPQC connector Testerra
1.0 1.0.0 .. 1.11
1.1 >= 1.12
2.0 >= 2.0

You need at least JDK11 or later.

Usage

Include the following dependency in your project.

Gradle:

implementation 'io.testerra:qc11-connector:2.0'

Maven:

<dependency>
  <groupId>io.testerra</groupId>
  <artifactId>qc11-connector</artifactId>
  <version>2.0</version>
</dependency>

Documenation

Synchronization

The easiest way to setup your project for automatic synchronization is by adding a qcconnection.properties file to your /src/test/resources/ directory.

qc.connection.server=
qc.connection.domain=
qc.connection.project=
qc.connection.user=
qc.connection.password=
qc.sync.active=true
qc.upload.screenshots=true
qc.upload.videos=true

Basically the synchronization will work by two explicit annotations that can be set.

Annotated class mode

To enable synchronization you must add the annotation QCTestset to your class containing the test methods. The given value must match the complete path of Quality Center or Application Lifecycle Management test set, for an example see code snipped below:

@QCTestset("\\Root\\My\\Full\\Path\\TestSet")
public class CorrectClassAnnotationTest extends TesterraTest {

    @Test
    public void testMethodPass() {
      Assert.assertTrue(true);
    }

This little snippet will search for a test set called \\Root\\My\\Full\\Path\\TestSet. If found, the method name will be extracted and searched as test name in QC/ALM and the result will be synchronized to this test case.

Annotated test method mode

While the class annotation is necessary, the method annotation is not. In case, you don't use the method names as test names you can set the QCTestname at each test method. The hpqc-connector will then lookup the given value as test name instead of the method name itself.

@QCTestset("\\Root\\My\\Full\\Path\\TestSet")
public class CorrectClassAnnotationTest extends TesterraTest {

    @Test
    @QCTestname("Pass_Test_01")
    public void testMethodPass() {
        Assert.assertTrue(true);
    }
}

Instead of QC testname you can use the QC test id:

@QCTestset("\\Root\\My\\Full\\Path\\TestSet")
public class CorrectClassAnnotationTest extends TesterraTest {

    @Test
    @QCTestname(testId = 123)
    public void testMethodPass() {
        Assert.assertTrue(true);
    }
}

If you have added a QC testcase more than one to your testset, QC created a new test instance of the same testcase. Only the instance number is ascending by 1.

@QCTestset("\\Root\\My\\Full\\Path\\TestSet")
public class CorrectClassAnnotationTest extends TesterraTest {

    // The second test instance of test 'Pass_Test_01' will sync.
    // Default instanceCount is '1'
    @Test
    @QCTestname("Pass_Test_01", instanceCount = 2)
    public void testMethodPass() {
        Assert.assertTrue(true);
    }
}

Cucumber tests

You can use tags at your feature files to synchronize scenarios to QC.

@QCTestset("Root\Testerra\QCSyncResultTests\QcSyncResultTests")
Feature: tests related to @Fails tag

  @QCTestname("T01_QcSyncResultFailed")
  Scenario: basic failing scenario
    When the user does a step
    Then it fails

The format is nearly the same as the Java annotations but keep in mind that Cucumber tags are only strings.

Please use single \, not quoted \\!

Instead of QC testname you can use the QC test id:

@QCTestset("Root\Testerra\QCSyncResultTests\QcSyncResultTests")
Feature: tests related to @Fails tag

  @QCTestId("123")
  Scenario: basic failing scenario
    When the user does a step
    Then it fails

Properties

Property Default Description
qc.sync.active true Enables synchronization fo test results
qc.connection.server URI of ALM / QC server
qc.connection.user User to use for synchronization
qc.connection.password Password of user used for synchronization
qc.connection.domain Domain of user to log in
qc.connection.project Project of user to log in
qc.version 12 Version of Quality Center or ALM 11, 12 or higher
qc.field.mapping.testrun Customize field-value mapping for synchronize properties to the quality center testrun. Use the format key:value|key2:value2 for multiple values.
qc.upload.screenshots false Enable the upload of screenshots
qc.upload.videos false Enable the upload of vides

Unit test

qc-restclient

  • Add a qcconnection.properties to qc-restclient/src/test/resources
  • Run gradle testRestClient

qc11-connector

The test includes two single test runs:

  • The testundertest creates different scenarios for result synchronization. The result has failed tests.

  • The suite verifies the result of synchronization by connecting to HP QC via REST API to check the Run items.

  • Add a qcconnection.properties to qc11-connector/src/test/resources

  • You need a Selenium server for testundertest suite

  • Run gradle testQCConn -Ptestundertest

  • Run gradle testQCConn -Psuite

Publication

This module is deployed and published to Maven Central. All JAR files are signed via Gradle signing plugin.

The following properties have to be set via command line or ~/.gradle/gradle.properties

Property Description
moduleVersion Version of deployed module, default is 1-SNAPSHOT
deployUrl Maven repository URL
deployUsername Maven repository username
deployPassword Maven repository password
signing.keyId GPG private key ID (short form)
signing.password GPG private key password
signing.secretKeyRingFile Path to GPG private key

If all properties are set, call the following to build, deploy and release this module:

gradle publish closeAndReleaseRepository

Contributing

Thank you for considering contributing to the Testerra framework! The contribution guide can be found here: CONTRIBUTING.md.

License

The Testerra framework is open-sourced software licensed under the Apache License Version 2.0.

Code of Conduct

This project has adopted the Contributor Covenant in version 2.0 as our code of conduct. Please see the details in our CODE_OF_CONDUCT.md. All contributors must abide by the code of conduct.

Working Language

We decided to apply English as the primary project language.

Consequently, all content will be made available primarily in English. We also ask all interested people to use English as language to create issues, in their code (comments, documentation etc.) and when you send requests to us. The application itself and all end-user faing content will be made available in other languages as needed.

Support and Feedback

The following channels are available for discussions, feedback, and support requests:

Type Channel
Issues
Other Requests

How to Contribute

Contribution and feedback is encouraged and always welcome. For more information about how to contribute, the project structure, as well as additional contribution information, see our Contribution Guidelines. By participating in this project, you agree to abide by its Code of Conduct at all times.

Contributors

At the same time our commitment to open source means that we are enabling -in fact encouraging- all interested parties to contribute and become part of its developer community.

Licensing

Copyright (c) 2021 Deutsche Telekom AG.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.

You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0.

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the LICENSE for the specific language governing permissions and limitations under the License.