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
our obtenir des informations à jour sur chaque version - y compris les versions mineures - vous pouvez
nous pouvez vous abonner au flux RSS ou nous suivre sur les médias sociaux.
Alternativement, QF-Test fournit également des informations sur la version elle-même.
Une autre source d'information est notre blog, qui contient des articles actuels sur des thèmes généraux, sur l'entreprise QFS et aussi divers "how-tos", veuillez vous
ABonner au Blog
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [QF-Test] Exception thrown in a procedure is not catched properly in the calling Jython script
Hello Greg, ok, I see that my solution is a little bit complicated. Only reusability might be an advantage.. Thank you for simplify it. BR Bernhad ======================================================================== Bernhard Schmitt Consultant Softwaretest E-Mail: bernhard.schmitt@?.de ------------------------------------------------------------------------ imbus Rhein-Main GmbH, Kirschgartenstraße 15, 65719 Hofheim, DEUTSCHLAND Tel. +49 6192 92192-0, Fax +49 6192 92192-50 info@?.de http://www.imbus.de Geschäftsführer: Frank Schmeißner, Tilo Linz, Thomas Roßner Sitz der Gesellschaft: Hofheim Registergericht: Frankfurt am Main, HRB 52155 ======================================================================== -----Ursprüngliche Nachricht----- Von: Gregor Schmid [mailto:Gregor.Schmid@?.de] Gesendet: Mittwoch, 25. Januar 2017 14:00 An: qftest-list@?.de Cc: Bernhard Schmitt Betreff: Re: [QF-Test] Exception thrown in a procedure is not catched properly in the calling Jython script Hello Bernhard, The problem is that the script can catch the UserException, but in contrast to Try/Catch nodes QF-Test doesn't know about that at the time when the exception is thrown an logged. You implemented a clever workaround which, however, is needlessly complex. The easiest solution is + Try + Script + Catch UserException In that construct you can use try:/except: in your script and react to the exception in the except: clause as you would expect. The outer Try/Catch with QF-Test nodes suppresses the exception state in the run-log. Of course you can also write a plain script and handle the exception in the Catch node. Both ways are possibly and may be applicable depending on the context. The same applies to try {...} catch {...} in Groovy scripts. Best regards, Greg Bernhard Schmitt <bernhard.schmitt@?.de> writes: > Hello, > > ok, I could answer my question on my own. I just created a wrapper function to handle the exception. > > The call of this wrapper function is done in the original jython script: > > Name = ,first' > > Paras = {,p1':1,'p2',2} > > rc.callProcedure("wrap",{"procName":Name,"procParas":Paras}) > > The procedure "wrap" with parameters "procName" and "procParas" hast the following content: > > Try > > Jython Server Script 1 > > Catch User Exception > > Jython Server Script 2 # log the exception > > The Jython Server Script 1 comes here: > > import ast > > paras = ast.literal_eval(rc.lookup("procPara")) > > rc.callProcedure(rc.lookup("procName"),paras) > > Maybe it is not the smartest solution but it seems tob e working. > > BR > > Bernhard > > ======================================================================== > > Bernhard Schmitt > > Consultant Softwaretest > > E-Mail: bernhard.schmitt@?.de > > ------------------------------------------------------------------------ > > imbus Rhein-Main GmbH, Kirschgartenstraße 15, 65719 Hofheim, DEUTSCHLAND > > Tel. +49 6192 92192-0, Fax +49 6192 92192-50 > > info@?.de http://www.imbus.de > > Geschäftsführer: Frank Schmeißner, Tilo Linz, Thomas Roßner > > Sitz der Gesellschaft: Hofheim > > Registergericht: Frankfurt am Main, HRB 52155 > > ======================================================================== > > _______________________________________________ > qftest-list mailing list > qftest-list@?.de > https://archive.qfs.de/mailman/listinfo/qftest-list -- Gregor Schmid E: gregor.schmid@?.de T: +49 8171 38648-11 F: +49 8171 38648-16 Quality First Software GmbH | www.qfs.de Tulpenstr. 41 | 82538 Geretsried | Germany GF Gregor Schmid, Dr. Martina Schmid, Karlheinz Kellerer HRB München 140833
|