List Icon
Archive de la liste de diffusion

La liste de diffusion est fermée depuis juillet 2022, mais sert toujours d'archive d'informations sur QF-Test.
Cependant, si vous souhaitez rester informé des nouveautés concernant QF-Test, vous pouvez simplement vous abonner à la newsletter :
abonner à la newsletter 

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

Re: [QF-Test] Re-run failed test cases

  • Subject: Re: [QF-Test] Re-run failed test cases
  • From: "Robert Lahmer, QFS support" <support@?.de>
  • Date: Wed, 21 May 2014 16:42:40 +0200

Hello Nouran,

at the moment, there is no built-in mechanism to re-run failed test-cases.
You'll need to create your own solution which might look as shown below.

1.) First create a TestRunListener which tracks the failing test-cases:

from de.qfs.apps.qftest.extensions.qftest import TestRunListener
from de.qfs.apps.qftest.shared.extensions import RunContext
import qfcommon
import os

rc = qfcommon.globalDict['__rc']

class RetryTracer(TestRunListener):
   def __init__(self, fileName):
       self._fileName = fileName
       self._f = None

   def nodeEntered(self, event):

   def nodeExited(self, event):

   def problemOccurred(self, event):
       if event.getState() >= 3:
           # Exception occured
           tc = rc.lookup("qftest", "testcase.qname")
           if not self._f:
               self._f = open(self._fileName, "w")
           self._f.write(tc + "\n")

   def runStarted(self, event):

   def runStopped(self, event):
       if self._f:
       self._f = None

global retryTracer


retryTracer = RetryTracer(os.path.join(os.getenv("TMP"), "failedTCs.txt"))

Save the above code as

2.) Install the TestRunListener, run the test and get the retry list when
finished. The following .bat file shows how this can be done:

@echo off
setlocal enabledelayedexpansion

set suite=c:\mysuites\mysuite.qft
set qfdir=c:\programs\qftest\qftest-3.5.6
set logdir=c:\mylogs

set retry=%TMP%\failedTCs.txt

copy %qfdir%\..\jython >nul
del %retry% >nul 2>&1
pushd %qfdir%\bin
qftestc -batch -jythonrun "import retryListener" -runlog %logdir%\+b

if not exist %retry% (
   echo No test-cases to run again.
   goto end

echo retrying ...
for /f "delims=" %%x in (%retry%) do (
   set tests=!tests! -test "%%x"
qftestc -batch -runlog %logdir%\retry_+b %tests% %suite%

echo done.

Adapt the variables 'suite', 'qfdir' and 'logdir' accordingly and then run
the .bat file: Every test-case that failed with an exception is stored in
the file


and will run once again afterwards (do not change the path or if so, adapt
the .py file as well).

By the way, please do not send a question to "qftest-list" and "qftest" at
the same time. You may either address the QF-Test mailing list (in case of
questions of public interest) or ask for support through QFS developers (in
case you have a valid maintenance contract).

Best regards,

--On Dienstag, Mai 20, 2014 12:28:57 +0000 "Halawa, Nouran"
<Nouran_Halawa@?.com> wrote:

Hi all,

We need a way to re-run failed test cases only reported in the run log.
Is there a way to do this automatically form QFS side?

Best Regards,
Nouran Halawa


Get the most out of QF-Test - Support directly from the authors
* Training & consulting:
* Phone & email support:

Robert Lahmer
Development & Support

E: support@?.de
T: +49 (0)8171 38648-20
F: +49 (0)8171 38648-16

Quality First Software GmbH |
Tulpenstr. 41 | 82538 Geretsried | Germany
GF Gregor Schmid, Karlheinz Kellerer
HRB München 140833