mirror of
https://github.com/SAP/jenkins-library.git
synced 2025-04-07 07:10:18 +02:00
* 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>
3.4 KiB
3.4 KiB
${docGenStepName}
${docGenDescription}
Prerequisites
- ATC checks are enabled in transaction ATC in the ABAP systems where you want to use the step.
- gCTS is available and configured in the ABAP systems where you want to use the step.
- The Warnings-Next-Generation Plugin is installed in Jenkins.
${docGenParameters}
${docGenConfiguration}
${docJenkinsPluginDependencies}
Example
Example configuration for the use in a Jenkinsfile.
gctsExecuteABAPUnitTests(
script: this,
host: 'https://abap.server.com:port',
client: '000',
abapCredentialsId: 'ABAPUserPasswordCredentialsId',
repository: 'myrepo',
scope: 'localChangedObjects',
commit: "${GIT_COMMIT}",
workspace: "${WORKSPACE}"
)
Example configuration for the use in a yaml config file (such as .pipeline/config.yaml
).
steps:
<...>
gctsExecuteABAPUnitTests:
host: 'https://abap.server.com:port'
client: '000'
abapCredentialsId: 'ABAPUserPasswordCredentialsId'
repository: 'myrepo'
scope: 'remoteChangedObjects'
commit: '38abb4814ae46b98e8e6c3e718cf1782afa9ca90'
workspace: '/var/jenkins_home/workspace/myFirstPipeline'
Example configuration when you define scope: repository or packages. For these two cases you do not need to specify a commit.
steps:
<...>
gctsExecuteABAPUnitTests:
host: 'https://abap.server.com:port'
client: '000'
abapCredentialsId: 'ABAPUserPasswordCredentialsId'
repository: 'myrepo'
scope: 'repository'
workspace: '/var/jenkins_home/workspace/myFirstPipeline'
Example configuration when you want to execute only ABAP Unit Test.
steps:
<...>
gctsExecuteABAPUnitTests:
host: 'https://abap.server.com:port'
client: '000'
abapCredentialsId: 'ABAPUserPasswordCredentialsId'
repository: 'myrepo'
atcCheck: false
scope: 'packages'
workspace: '/var/jenkins_home/workspace/myFirstPipeline'
Example configuration for the use of recordIssue step to make the findings visible in Jenkins interface.
stage('ABAP Unit Tests') {
steps{
script{
try{
gctsExecuteABAPUnitTests(
script: this,
commit: "${GIT_COMMIT}",
workspace: "${WORKSPACE}")
}
catch (Exception ex) {
currentBuild.result = 'FAILURE'
unstable(message: "${STAGE_NAME} is unstable")
}
}
}
}
stage('Results in Checkstyle') {
steps{
recordIssues(
enabledForFailure: true, aggregatingResults: true,
tools: [checkStyle(pattern: 'ATCResults.xml', reportEncoding: 'UTF8'),checkStyle(pattern: 'AUnitResults.xml', reportEncoding: 'UTF8')]
)
}
}
}
Note: If you have disabled atcCheck or aUnitTest, than you also need to remove the corresponding ATCResults.xml or AUnitResults.xml from recordIssues step. In the example below the atcCheck was disabled, so ATCResults.xml was removed.
recordIssues(
enabledForFailure: true, aggregatingResults: true,
tools: [checkStyle(pattern: 'AUnitResults.xml', reportEncoding: 'UTF8')]
)