1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-12-12 10:55:20 +02:00
sap-jenkins-library/resources/metadata/gctsExecuteABAPUnitTests.yaml
Rinita Asani 278c47b808
Refactor of gctsExecuteABAPUnitTests (#3338)
* Update gctsExecuteABAPUnitTests.yaml

* Update gctsExecuteABAPUnitTests.go

* Update gctsExecuteABAPUnitTests.go

* Update gctsExecuteABAPUnitTests.yaml

* Add commit parameter

* Update gctsExecuteABAPUnitTests.yaml

* Update gctsExecuteABAPUnitTests.go

* Update gctsExecuteABAPUnitTests.go

* Update gctsExecuteABAPUnitTests.yaml

* Update gctsExecuteABAPUnitTests.go

* Change the commit parameter in Yaml file

* Adding scope paramter to gCTSExecuteABAPUnitTest

* Adding logs

* Adapting checkstyle for success case

* write ATC file

* add log

* time duration

* add log

* Improve log

* Improve unit test

* severity error

* Fix the xml file for Unit Tests

* Editing UnitTest Results for better parsing

* Change file name

* Add folder

* Add path to file

* Add src

* Add src and object type

* Add filename

* Add path

* Handling success cases

* complete refactoring

* fix for file path

* filname lower case

* Add log entry

* Delete ATC Results

* Change ATC name

* Functiongroups

* When ATC errors Pipeline fails

* Reading a file into chuncks

* escape string

* Fix for a bug

* Unesscape URL

* Change from fatal error to error

* When unit test fails pipeline fails too

* Severity errors

* Severity for Unit Test

* Fix for successful unit test

* Code review

* Telemetry was missing

* yaml file

* generate yaml file

* add logs

* fix location

* do not close body

* checkstyle severity

* checkstyle

* checkstyle2

* atc method

* line calculation

* global file

* method

* line

* fix

* add logs

* add log

* add logg

* unit test error

* Code checked and finalized

* change commit paramter to optional

* Add logs for current local and remote commit

* Add logs for object type and name

* parse ATC checks error

* add log of http response

* add log

* remove end of function findline

* log cleaning

* log extra cleaning

* cleaning log for unit test

* more cleaning

* double cleanser for your code

* more cleaning

* docu checks

* file name fix for function group

* handle programs-reports

* fix a bug

* fix regex

* fix regex for test class

* fix regexos

* fix dots

* fix a error message in unit tests

* calculate dynamically file extension

* add log for path

* add method name

* add method name-

* fix repo scope

* include table type

* Change paramter commitId to commit only

* change log output

* give more detailed examples

* Table Name in get file name

* change logs

* improve log entries

* improve log entries again

* final improvements

* Delete UnitTestResults

* Review

* Change text and comments

* fix a type in commit paramter

* change repository method name

* Fix typos in yaml file

* Remove empty lines in yaml file

* Remove blank lines in the end

* Add new line

* go generate

* Remove tabs

Co-authored-by: Martin Bredy <58846699+martin-bredy@users.noreply.github.com>
Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com>
2021-12-15 10:55:53 +01:00

151 lines
6.6 KiB
YAML

metadata:
name: gctsExecuteABAPUnitTests
description: Runs ABAP unit tests and ATC (ABAP Test Cockpit) checks for a specified object scope.
longDescription: |
This step executes ABAP unit test and ATC checks for a specified scope of objects that exist in a local Git repository on an ABAP system.
Depending on your use case, you can specify a scope of objects for which you want to execute the checks. In addition, you can choose whether you want to execute only ABAP units tests, or only ATC checks, or both.
By default, both checks are executed.
The results of the checks are stored in a [Checkstyle](https://checkstyle.sourceforge.io/) format. With the help of the Jenkins [Warnings-Next-Generation](https://plugins.jenkins.io/warnings-ng/) Plugin), you can view the issues found, and navigate to the exact line of the source code where the issue occurred.
To make the findings visible in Jenkins interface, you will need to use step recordIssues. An example will be shown in the Example section.
<br />
You can use this step as of SAP S/4HANA 2020.
spec:
inputs:
secrets:
- name: abapCredentialsId
description: ID taken from the Jenkins credentials store containing user name and password of the user that authenticates to the ABAP system on which you want to execute the checks.
type: jenkins
params:
- name: username
type: string
description: User that authenticates to the ABAP system. Note – Don´t provide this parameter directly. Either set it in the environment, or in the Jenkins credentials store, and provide the ID as value of the abapCredentialsId parameter.
scope:
- PARAMETERS
- STAGES
- STEPS
mandatory: true
secret: true
resourceRef:
- name: abapCredentialsId
type: secret
param: username
- name: password
type: string
description: Password of the ABAP user that authenticates to the ABAP system. Note – Don´t provide this parameter directly. Either set it in the environment, or in the Jenkins credentials store, and provide the ID as value of the abapCredentialsId parameter.
scope:
- PARAMETERS
- STAGES
- STEPS
mandatory: true
secret: true
resourceRef:
- name: abapCredentialsId
type: secret
param: password
- name: host
type: string
description: Protocol and host of the ABAP system, including the port. Please provide in the format <protocol>://<host>:<port>. Supported protocols are http and https.
scope:
- PARAMETERS
- STAGES
- STEPS
mandatory: true
- name: repository
type: string
description: Name (ID) of the local repository on the ABAP system
scope:
- PARAMETERS
- STAGES
- STEPS
mandatory: true
- name: client
type: string
description: Client of the ABAP system in which you want to execute the checks
scope:
- PARAMETERS
- STAGES
- STEPS
mandatory: true
- name: aUnitTest
type: bool
default: true
description: Indication whether you want to execute the unit test checks.
scope:
- PARAMETERS
- STAGES
- STEPS
- name: atcCheck
type: bool
default: true
description: Indication whether you want to execute the ATC checks.
scope:
- PARAMETERS
- STAGES
- STEPS
- name: atcVariant
type: string
default: "DEFAULT_REMOTE_REF"
description: Variant for ATC checks
scope:
- PARAMETERS
- STAGES
- STEPS
- name: scope
type: string
default: repository
enum:
- localChangedObjects
- remoteChangedObjects
- localChangedPackages
- remoteChangedPackages
- repository
- packages
description: |
Scope of objects for which you want to execute the checks:
* localChangedObjects - object delta between the commit that triggered the pipeline and the current commit in the local repository. The checks are executed for the individual objects.
* remoteChangedObjects - object delta between the commit that triggered the pipeline and the current commit in the remote repository. The checks are executed for the individual objects.
* localChangedPackages - object delta between the commit that triggered the pipeline and the current commit in the local repository. All objects are resolved into packages. The checks are executed for the packages.
* remoteChangedPackages - object delta between the commit that triggered the pipeline and the current commit in the remote repository. All objects are resolved into packages. The checks are executed for the packages.
* repository - all objects that are part of the local repository. The checks are executed for the individual objects. Packages (DEVC) are excluded. This is the default scope.
* packages - all packages that are part of the local repository . The checks are executed for the packages.
scope:
- PARAMETERS
- STAGES
- STEPS
- name: commit
type: string
description: ID of the commit that triggered the pipeline or any other commit to compare objects. For scopes localChangedObjects, remoteChangedObjects, localChangedPackages and remoteChangedPackages secifying a commit it's mandatory.
scope:
- PARAMETERS
- STAGES
- STEPS
mandatory: false
- name: workspace
type: string
description: Absolute path to directory which contains the source code that your CI/CD tool checks out. For example in Jenkins, the workspace parameter is /var/jenkins_home/workspace/<jobName>/
scope:
- PARAMETERS
- STAGES
- STEPS
mandatory: true
- name: atcResultsFileName
type: string
description: Specifies output file name for the results from the ATC checks
scope:
- PARAMETERS
- STAGES
- STEPS
mandatory: false
default: "ATCResults.xml"
- name: aUnitResultsFileName
type: string
description: Specifies output file name for the results from the AUnit tests
scope:
- PARAMETERS
- STAGES
- STEPS
mandatory: false
default: "AUnitResults.xml"