2

I want to read the gitlab console output to fail the job when the test fails. I am running SoapUI tests using maven. Please see the screenshot below. I am new to gitlab. I have been working on this issue for 2 weeks. Also it is becoming hard for me to click on each job to see if it has passed or failed. If I can read the console output, I can put an if condition in the yml file stating that it should fail the job if it see the text "failed"

Console output screenshot

Here is the .yml file

# Wa API
.wa-stage:
  stage: wa
  needs: []

TC-396:
  extends: .wa-stage
  image: adoptopenjdk/maven-openjdk11
  variables:
   MAVEN_CLI_OPTS: "-Dmaven.test.failure.ignore=false"
  script:
  - 'mvn -f ./S/Wa/TC-396-soapui/pom.xml $MAVEN_CLI_OPTS test'
  allow_failure: true
  when: always

TC-397:
  extends: .wa-stage
  image: adoptopenjdk/maven-openjdk11
  variables:
   MAVEN_CLI_OPTS: "-Dmaven.test.failure.ignore=false"
  script:
  - 'mvn -f ./S/Wa/TC-397-soapui/pom.xml $MAVEN_CLI_OPTS test'
  allow_failure: true

  when: always

TC-398:
  extends: .wa-stage
  image: adoptopenjdk/maven-openjdk11
  variables:
   MAVEN_CLI_OPTS: "-Dmaven.test.failure.ignore=false"
  script:
  - 'mvn -f ./S/Wa/TC-398-soapui/pom.xml $MAVEN_CLI_OPTS test'
  allow_failure: true

  when: always

TC-399:
  extends: .wa-stage
  image: adoptopenjdk/maven-openjdk11
  variables:
   MAVEN_CLI_OPTS: "-Dmaven.test.failure.ignore=false"
  script:
  - 'mvn -f ./S/Wa/TC-399-soapui/pom.xml $MAVEN_CLI_OPTS test'
  allow_failure: true

  when: always

Screenshot if all the tests go well enter image description here

Bob Jones
  • 171
  • 1
  • 4
  • 22
  • This should happen without you having to do anything. But we’ll need to see your test setup to help. Can you show us your .gitab-ci.yml file and an example of a job which fails and then GitLab reports as a success? It’s hard to debug with only a case which succeeded and then (correctly) reported a success. – Michael Delgado Aug 18 '22 at 03:09
  • Thanks Michael for your response. Please see the yml attached. – Bob Jones Aug 18 '22 at 04:04
  • 1
    If you delete `allow_failure: true` does that resolve the problem? – Michael Delgado Aug 18 '22 at 14:21

0 Answers0