2018 bis heute | 2017 2016 2015 2014 | 2013 | 2012 | 2011 2010 2009 | 2008 | 2007

(ältere Archiveinträge vor 2007 nicht dargestellt, aber in der Suche enthalten)

Mailingliste - Einträge 2012


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[QF-Test] QF-Test and Gradle...


  • Subject: [QF-Test] QF-Test and Gradle...
  • From: "Berg, Klaus-Peter" <klaus-peter.berg@?.com>
  • Date: Wed, 28 Mar 2012 18:31:24 +0200

Hi all,
 
does anyone has experience in using the build system Gradle to run QF-Test suites and to check the process result return value?
 
Gradle's marketing [http://www.gradle.org]  tells us: "Gradle is build automation evolved.
Gradle combines the power and flexibility of Ant with the dependency management and conventions of Maven into a more effective way to build.
Powered by a Groovy DSL..."
 
Especially the possibility to integrate QF-Test suite execution with Groovy -- that is already a QF-Test scripting language - could make this approach interesting.
However, I'm not sure if my first Gradle solution is really an optimal solution.
 
So, perhaps other QF-Test users have ideas or comments ...
 
Best regards
Klaus Peter Berg
__________________________________________
/*
 QF-Test GRADLE build file for Windows OS.
*/
   
defaultTasks 'runAllTests'
 
def basedir = "."
def logdir = "$basedir"
def suite = "../../Test_Suites/AllTests"
def testcase = "Run all tests"
def reportDir = "$basedir/report"
def qftest = null
env = System.getenv()
 
task checkProperties {
    if (!env.QFTEST_HOME) {
        throw new Exception("No Windows environment variable 'QFTEST_HOME' found!")
    }
    qftest = "${env.QFTEST_HOME}/bin/qftest.exe"
}
 

task runAllTests(dependsOn: 'checkProperties') {
    def reportDirFile = new File(reportDir)
    if (reportDirFile.exists()) {
        reportDirFile.deleteDir() // delete directory with all it's subdirectories and files
    }
    else {
        reportDirFile.mkdirs()
    }
 
    def result = 0
    try {
        result = exec {
            executable = qftest
            args = ['-J-Duser.language=en', '-batch', '-runlog', "$logdir/+b", '-report', reportDir, '-test', testcase, "${suite}.qft"]
        }          
    }
    catch (org.gradle.process.internal.ExecException ex) {
        def regex = /^.+finished with \(non-zero\) exit value ([1-3])\.$/
        def matcher = (ex.message =~ regex)
        def exitCode = matcher[0][1]
        switch (exitCode) {
            case '1': println "\nTest terminated with warnings."
                break
            case '2': println "\nTest terminated with errors!"
                break
            case '3': println "\nTest terminated with exceptions!"
                break
            default:
                println "Test result undetermined: $exitCode"
        }
        println()
    }
    if (result == 0) {
        println "Test terminated successfully."
    }
}