0

So, the title pretty much gives it away. We're using Jenkins 2 with PHPUnit 6.5.12 and a couple of days before, everything worked fine. Now, every build we do and has failures (or worse, errors) in the PHPUnit section is not marked as unstable / failed at all. For tests, we're using PHPUnit + Selenium Standalone 3.4.0 with the newest geckodriver. (Yeah, there are newer versions of Selenium available, but they always kill the tests with exceptions and don't run at all - 3.4.0 is working nicely.)

Part of our pipeline that runs the unit tests can be seen below:

stage ('UnitTests') {
            steps {
                sh 'cd module/App/test/ && chmod a+r+w+x runtests.sh && ./runtests.sh'
            }
        }
    }
    post {
        success {
            slackSend  color: '#458B00', message: "Build success for Pipeline ${env.JOB_NAME} [#${env.BUILD_NUMBER}]"
            sh 'rm -rf \\"${WORKSPACE}/data/cache/*\\"'
            sh 'rm -rf ${WORKSPACE}/data/cache/*'
            sh 'rsync --delete -r "${WORKSPACE}"/* myhost:/path
        }
        failure {
           slackSend color: '#8C1717', message: "Build failed for Pipeline ${env.JOB_NAME} [#${env.BUILD_NUMBER}]"
        }
        unstable {
           slackSend color: '#FF8C00', message: "Build unstable for Pipeline ${env.JOB_NAME} [#${env.BUILD_NUMBER}]"
        }
    }

runtests.sh essentially starts the PHPUnit tests (and also the Selenium standalone server) and kills Selenium and every remaining Firefox session in the end.

Now from what I gathered, PHPUnit SHOULD have some exit codes, like 1 for failure, 0 for success and so on. So, did something happen here? From what I've seen, no new version came out which touched any of that.

I've also read that one could possibly have PHPUnit spit out a report which in turn could be picked up by jUnit and then use this to check wether everything worked or not, but as I said - it worked before, with exactly this configuration.

Hope that anyone has some ideas, because I sure do not.

0

You should check the exit code of both phpunit and your script. Jenkins when using the sh step, only takes into consideration the exit code of your whole script and not anything in it. Maybe previously it worked because of a failure to kill the workers? AFAIK the other functionality you talk about is delivered by JUnit plugin.

  • And right you are. Killing any processes after the phpunit tests of course return different exit codes... could've thought of that myself. Thanks! – Philip Weisel May 15 at 8:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.