Sto cercando di utilizzare Jenkins xUnit plug-in per il mio progetto test di unità Qt, ma non riesco a farlo funzionare ...Mostrando il risultato di QTestlib con Jenkins xUnit plug-in
Ecco quello che ho fatto finora:
prima di tutto, io costruisco il mio progetto di test di unità con qmakebuilder plug-in (che fornisce il .pro per il plug-in qmakebuilder), poi aggiungo una sezione Execute Shell
accumulo dove ho rm -f
il TestResult file xml, in seguito a ciò, eseguo il test binario con il flag -xunitxml
per far sì che generi il file xml per me E chiamo il file xml testResult.xml
, in altre parole:
rm -f /home/guest/QT/unitTest/testResult.xml
cd /home/guest/QT/unitTest
./tst_unittesttest -xunitxml > testResult.xml
Infine in Post costruire Azione, seleziono Publish xUnit test result
e specificare il motivo come *.xml
.
Costruire il lavoro non riuscirà, però, Ecco l'output che ottengo quando si costruisce il lavoro con Jenkins:
[xUnit] [INFO] - Starting to record.
[xUnit] [INFO] - Processing QTestlib-Version N/A
[xUnit] [INFO] - [QTestlib-Version N/A] - 1 test report file(s) were found with
the pattern '*.xml' relative to '/home/guest/QT/unitTest' for the testing framework
'QTestlib-Version N/A'.
[xUnit] [ERROR] - The converted file for the result file '/home/guest/QT/unitTest
/testResult.xml' (during conversion process for the metric 'QTestlib') is not
valid.
The report file has been skipped.
[xUnit] [ERROR] - The plugin hasn't been performed correctly: hudson.util.IOException2:
Failed to read /home/guest/QT/unitTest/generatedJUnitFiles/QTestlib/TEST--735044756.xml
Build step 'Publish xUnit test result report' changed build result to FAILURE
Build step 'Publish xUnit test result report' marked build as failure
Finished: FAILURE
Come potete vedere non v'è problema di conversione mia prova file xml risultato a ciò xUnit plug in grado di leggere. Il mio file testResult.xml si presenta così:
<?xml version="1.0" encoding="UTF-8" ?>
<testsuite errors="2" failures="0" tests="4" name="UnitTestTest">
<properties>
<property value="4.7.4" name="QTestVersion"/>
<property value="4.7.4" name="QtVersion"/>
</properties>
<testcase result="pass" name="initTestCase">
<!-- message="called before everything else" type="qdebug" -->
</testcase>
<testcase result="pass" name="myFirstTest"/>
<testcase result="pass" name="mySecondTest"/>
<testcase result="pass" name="cleanupTestCase">
<!-- message="called after myFirstTest and mySecondTest" type="qdebug" -->
</testcase>
<system-err>
<![CDATA[called before everything else]]>
<![CDATA[called after myFirstTest and mySecondTest]]>
</system-err>
</testsuite>
ma TEST--735044756.xml
è un file XML di una riga: <?xml version="1.0" encoding="UTF-8"?>
Qualcuno ha idea di dove sono io che faccio quello che di sbagliato? Ci dovrebbe essere un problema con la generazione del file xml di output.
Su una nota diversa, ho aggiunto le thingi di registro nel sistema di log di menu Jenkins, non sembra essere la ragione di questo problema però ... almeno IMO
Penso che dipenda dal formato selezionato nella configurazione del plugin xUnit. Il formato "QTestLib-Version N/A" (che è stato aggiunto nella versione 1.50 del plug-in) prevede il formato '-xml' di QTestLib. – Ignitor