Skip to content

Commit

Permalink
Format tests and provide ref link in README (#164)
Browse files Browse the repository at this point in the history
  • Loading branch information
MarioFuchsTT authored and MartinGroscheTT committed Nov 15, 2024
1 parent d192cf9 commit d37e06c
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 60 deletions.
21 changes: 8 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,7 @@ node('windows') {
ttRunPackage testCasePath: 'sample.pkg', testConfig: [tbcPath: '', tcfPath: '', forceConfigurationReload: true, constants: [[label: 'sample', value: '\'sampleValue\'']]]
}
stage('Provide ecu.test logs in jenkins') {
ttProvideLogs(publishConfig: [allowMissing: true, timeout: 10, keepAll: true])
}
stage('Provide ecu.test trf/prf reports in jenkins') {
ttProvideReports(publishConfig: [allowMissing: true, timeout: 10, keepAll: true])
ttProvideLogs timeout: 60
}
stage('Generate Reports') {
ttGenerateReports 'HTML'
Expand Down Expand Up @@ -121,7 +118,7 @@ The [test.guide](https://www.tracetronic.com/products/test-guide/) authenticatio
[credential](https://www.jenkins.io/doc/book/using/using-credentials/) (username and password) to be used in the
*ttUploadReports* step.

Check out the [advanced usage docs](./docs/AdvancedUsage.md) for more detailed information
Check out the [advanced usage doc](./docs/AdvancedUsage.md) for more information.

## Migration

Expand Down Expand Up @@ -158,8 +155,7 @@ create an [issue](#contribution).
<a href="https://www.tracetronic.com/products/trace-check/">trace.check</a> compat matrix (min 2022.4) </summary>

| Version | latest - 3.5 | 3.4 - 3.1 | 3.0 |
|---------|:------------------:|:------------------:|:------------------:|
| 2024.3 | :heavy_check_mark: | :x: | :x: |
|:-------:|:------------------:|:------------------:|:------------------:|
| 2024.2 | :heavy_check_mark: | :x: | :x: |
| 2024.1 | :heavy_check_mark: | :heavy_check_mark: | :x: |
| 2023.4 | :heavy_check_mark: | :heavy_check_mark: | :x: |
Expand All @@ -172,13 +168,12 @@ create an [issue](#contribution).

</details>
<details>
<summary>optional: <a href="https://www.tracetronic.com/products/test-guide">test.guide</a> compat matrix (min 1.142.0)</summary>
<summary>optional: <a href="https://www.tracetronic.com/products/test-guide">test.guide</a> compat matrix (min 1.114.3)</summary>

| Version | latest - 3.6 | 3.5 - 3.0 |
|---------|--------------------|:------------------:|
| 1.178.0 | :heavy_check_mark: | :heavy_check_mark: |
| 1.147.0 | :x: | :heavy_check_mark: |
| 1.142.0 | :x: | :heavy_check_mark: |
| Version | latest - 3.0 |
|:-------:|:------------------:|
| 1.147.0 | :heavy_check_mark: |
| 1.142.0 | :heavy_check_mark: |

</details>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,11 @@ class RunPackageStepIT extends IntegrationTestBase {
def 'Run pipeline by declaring .tbc and .tcf files in testConfig'() {
given:
WorkflowJob job = jenkins.createProject(WorkflowJob.class, 'pipeline')
job.setDefinition(new CpsFlowDefinition("node { ttRunPackage testCasePath: 'test.pkg', testConfig: [tbcPath: 'test.tbc', tcfPath: 'test.tcf'] }", true))
job.setDefinition(new CpsFlowDefinition("node { ttRunPackage testCasePath: 'test.pkg', " +
"testConfig: [tbcPath: 'test.tbc', tcfPath: 'test.tcf'] }", true))

GroovyMock(RestApiClientFactory, global: true)
RestApiClientFactory.getRestApiClient() >> new MockRestApiClient()
GroovyMock(RestApiClientFactory, global: true)
RestApiClientFactory.getRestApiClient() >> new MockRestApiClient()

expect:
WorkflowRun run = job.scheduleBuild2(0).get()
Expand All @@ -185,7 +186,8 @@ class RunPackageStepIT extends IntegrationTestBase {
def 'Run pipeline by declaring KEEP in testConfig'() {
given:
WorkflowJob job = jenkins.createProject(WorkflowJob.class, 'pipeline')
job.setDefinition(new CpsFlowDefinition("node { ttRunPackage testCasePath: 'test.pkg', testConfig: [tbcPath: 'KEEP', tcfPath: 'KEEP'] }", true))
job.setDefinition(new CpsFlowDefinition("node { ttRunPackage testCasePath: 'test.pkg', " +
"testConfig: [tbcPath: 'KEEP', tcfPath: 'KEEP'] }", true))

GroovyMock(RestApiClientFactory, global: true)
RestApiClientFactory.getRestApiClient() >> new MockRestApiClient()
Expand All @@ -200,11 +202,12 @@ class RunPackageStepIT extends IntegrationTestBase {

def 'Run pipeline with invalid data type for testConfig'() {
given:
WorkflowJob job = jenkins.createProject(WorkflowJob.class, 'pipeline')
job.setDefinition(new CpsFlowDefinition("node { ttRunPackage testCasePath: 'test.pkg', testConfig: [] }", true))
WorkflowJob job = jenkins.createProject(WorkflowJob.class, 'pipeline')
job.setDefinition(new CpsFlowDefinition("node { ttRunPackage testCasePath: 'test.pkg', " +
"testConfig: [] }", true))

GroovyMock(RestApiClientFactory, global: true)
RestApiClientFactory.getRestApiClient() >> new MockRestApiClient()
GroovyMock(RestApiClientFactory, global: true)
RestApiClientFactory.getRestApiClient() >> new MockRestApiClient()

expect:
WorkflowRun run = jenkins.assertBuildStatus(Result.FAILURE, job.scheduleBuild2(0).get())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,49 +117,52 @@ class RunProjectStepIT extends IntegrationTestBase {

def 'Run pipeline by declaring .tbc and .tcf files in testConfig'() {
given:
WorkflowJob job = jenkins.createProject(WorkflowJob.class, 'pipeline')
job.setDefinition(new CpsFlowDefinition("node { ttRunProject testCasePath: 'test.prj', testConfig: [tbcPath: 'test.tbc', tcfPath: 'test.tcf'] }", true))
WorkflowJob job = jenkins.createProject(WorkflowJob.class, 'pipeline')
job.setDefinition(new CpsFlowDefinition("node { ttRunProject testCasePath: 'test.prj', " +
"testConfig: [tbcPath: 'test.tbc', tcfPath: 'test.tcf'] }", true))

GroovyMock(RestApiClientFactory, global: true)
RestApiClientFactory.getRestApiClient() >> new MockRestApiClient()
GroovyMock(RestApiClientFactory, global: true)
RestApiClientFactory.getRestApiClient() >> new MockRestApiClient()

expect:
WorkflowRun run = job.scheduleBuild2(0).get()
jenkins.assertLogContains("Executing project 'test.prj'...", run)
jenkins.assertLogContains("-> With TBC=test.tbc", run)
jenkins.assertLogContains("-> With TCF=test.tcf", run)
WorkflowRun run = job.scheduleBuild2(0).get()
jenkins.assertLogContains("Executing project 'test.prj'...", run)
jenkins.assertLogContains("-> With TBC=test.tbc", run)
jenkins.assertLogContains("-> With TCF=test.tcf", run)
}

def 'Run pipeline by declaring KEEP in testConfig'() {
given:
WorkflowJob job = jenkins.createProject(WorkflowJob.class, 'pipeline')
job.setDefinition(new CpsFlowDefinition("node { ttRunProject testCasePath: 'test.prj', testConfig: [tbcPath: 'KEEP', tcfPath: 'KEEP'] }", true))
WorkflowJob job = jenkins.createProject(WorkflowJob.class, 'pipeline')
job.setDefinition(new CpsFlowDefinition("node { ttRunProject testCasePath: 'test.prj', " +
"testConfig: [tbcPath: 'KEEP', tcfPath: 'KEEP'] }", true))

GroovyMock(RestApiClientFactory, global: true)
RestApiClientFactory.getRestApiClient() >> new MockRestApiClient()
GroovyMock(RestApiClientFactory, global: true)
RestApiClientFactory.getRestApiClient() >> new MockRestApiClient()

expect:
WorkflowRun run = job.scheduleBuild2(0).get()
jenkins.assertLogContains("Executing project 'test.prj'...", run)
jenkins.assertLogContains("-> With TBC=KEEP", run)
jenkins.assertLogContains("-> With TCF=KEEP", run)
WorkflowRun run = job.scheduleBuild2(0).get()
jenkins.assertLogContains("Executing project 'test.prj'...", run)
jenkins.assertLogContains("-> With TBC=KEEP", run)
jenkins.assertLogContains("-> With TCF=KEEP", run)

}

def 'Run pipeline with invalid data type for testConfig'() {
given:
WorkflowJob job = jenkins.createProject(WorkflowJob.class, 'pipeline')
job.setDefinition(new CpsFlowDefinition("node { ttRunProject testCasePath: 'test.prj', testConfig: [] }", true))
WorkflowJob job = jenkins.createProject(WorkflowJob.class, 'pipeline')
job.setDefinition(new CpsFlowDefinition("node { ttRunProject testCasePath: 'test.prj', " +
"testConfig: [] }", true))

GroovyMock(RestApiClientFactory, global: true)
RestApiClientFactory.getRestApiClient() >> new MockRestApiClient()
GroovyMock(RestApiClientFactory, global: true)
RestApiClientFactory.getRestApiClient() >> new MockRestApiClient()

expect:
WorkflowRun run = jenkins.assertBuildStatus(Result.FAILURE, job.scheduleBuild2(0).get())
jenkins.assertLogContains("java.lang.ClassCastException", run)
jenkins.assertLogContains("expects class " +
"de.tracetronic.jenkins.plugins.ecutestexecution.configs.TestConfig", run)
jenkins.assertLogContains("but received class java.util.ArrayList", run)
WorkflowRun run = jenkins.assertBuildStatus(Result.FAILURE, job.scheduleBuild2(0).get())
jenkins.assertLogContains("java.lang.ClassCastException", run)
jenkins.assertLogContains("expects class " +
"de.tracetronic.jenkins.plugins.ecutestexecution.configs.TestConfig", run)
jenkins.assertLogContains("but received class java.util.ArrayList", run)
}

def 'Run pipeline with package check'() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,23 +234,23 @@ class RunTestFolderStepIT extends IntegrationTestBase {

def 'Run pipeline with invalid data type for testConfig'() {
given:
setupTestFolder()
WorkflowJob job = jenkins.createProject(WorkflowJob.class, 'pipeline')
job.setDefinition(new CpsFlowDefinition(
"node { ttRunTestFolder recursiveScan: true, " +
"testCasePath: '${folder.getRoot().getAbsolutePath().replace('\\', '\\\\')}'" +
", testConfig: [] }",
true))
setupTestFolder()
WorkflowJob job = jenkins.createProject(WorkflowJob.class, 'pipeline')
job.setDefinition(new CpsFlowDefinition(
"node { ttRunTestFolder recursiveScan: true, " +
"testCasePath: '${folder.getRoot().getAbsolutePath().replace('\\', '\\\\')}'" +
", testConfig: [] }",
true))

GroovyMock(RestApiClientFactory, global: true)
RestApiClientFactory.getRestApiClient() >> new MockRestApiClient()
GroovyMock(RestApiClientFactory, global: true)
RestApiClientFactory.getRestApiClient() >> new MockRestApiClient()

expect:
WorkflowRun run = jenkins.assertBuildStatus(Result.FAILURE, job.scheduleBuild2(0).get())
jenkins.assertLogContains("java.lang.ClassCastException", run)
jenkins.assertLogContains("expects class " +
"de.tracetronic.jenkins.plugins.ecutestexecution.configs.TestConfig", run)
jenkins.assertLogContains("but received class java.util.ArrayList", run)
WorkflowRun run = jenkins.assertBuildStatus(Result.FAILURE, job.scheduleBuild2(0).get())
jenkins.assertLogContains("java.lang.ClassCastException", run)
jenkins.assertLogContains("expects class " +
"de.tracetronic.jenkins.plugins.ecutestexecution.configs.TestConfig", run)
jenkins.assertLogContains("but received class java.util.ArrayList", run)
}

def 'Run recursive scan pipeline'() {
Expand Down

0 comments on commit d37e06c

Please sign in to comment.