You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The XML options of Qt Test library is a major feature for integration with external tools.
It can be used for produce test log that will be then be parse by IDE ( Eclipse Unit Tests runner) or continuous integration ( Jenkins XUnit)
As is with the actual MultiTest, those integration need an extra scripting phase for :
Create a single consistent XML output.
Save to different files each cases result
Note that other options provides by Qt Test Lib ( lightxml and xunitxml) should be concerned too.
Consistent single file
The purpose will be to have a single consistent XML file that cover all test suite.
Each case have a section.
I've experiment that it's possible to produce a similar file in few steps from the output of current MultiTest runner with the -xml option
Create a top level <TestCase name=testSuite> XML element
For all cases remove XML header and output them are children of the test suite element
(Optional for Eclipse) : BenchmarkResult need a rename of WalltimeMilliseconds to walltime
Append after the cases results a list of all messages
Close the top level </TestCase>
File splitting
The purpose is to be able to save into one directory a XML file for each of the test case.
The XML header is an easy tag to detect the start of a new case.
Name of outputs files can just be incremented from one case to the next one ( result_1.xml, result_2.xml, etc.)
The text was updated successfully, but these errors were encountered:
In order to achieve the Consistent single file, a cout redirection can be useful. It can be a non-intrusive way of including each XML output provide by the Qt runner (for each case) into a unique normalized XML
Here is an example on how that can be provided :
#include<string>
#include<sstream>
#include<iostream>
std::streambuf* m_oldCoutStreamBuf;
std::ostringstream m_strCout;
/** * @brief Start redirect cout to a local buffer * @return TRUE if redirection succeed, FALSE else (redirection was already placed)*/boolAutoTestUtils::coutRedirectionStart(void){
if( m_oldCoutStreamBuf ){
returnfalse;
}
m_oldCoutStreamBuf = std::cout.rdbuf(); // Backup cout
std::cout.rdbuf( m_strCout.rdbuf() ); // Redirect cout to a local bufferreturntrue;
}
/** * @brief Stop the cout redirection*/voidAutoTestUtils::coutRedirectionStop(void){
// Restore old cout
std::cout.rdbuf( m_oldCoutStreamBuf );
m_oldCoutStreamBuf = 0;
}
/** * @brief Clear the content of cout redirection buffer*/voidAutoTestUtils::coutRedirectionClear(void){
m_strCout.clear();
}
/** * @brief Get the content of cout redirection buffer as a QString * @return QString with the content of cout redirection buffer*/
QString AutoTestUtils::coutRedirectionQString(void){
returnQString::fromStdString( coutRedirectionContent() );
}
/** * @brief Get the content of cout redirection buffer * @return The content of buffer as string*/
std::string AutoTestUtils::coutRedirectionContent(void){
return m_strCout.str();
}
The XML options of Qt Test library is a major feature for integration with external tools.
It can be used for produce test log that will be then be parse by IDE ( Eclipse Unit Tests runner) or continuous integration ( Jenkins XUnit)
As is with the actual MultiTest, those integration need an extra scripting phase for :
Note that other options provides by Qt Test Lib (
lightxml
andxunitxml
) should be concerned too.Consistent single file
The purpose will be to have a single consistent XML file that cover all test suite.
Each case have a section.
I've experiment that it's possible to produce a similar file in few steps from the output of current MultiTest runner with the
-xml
option<TestCase name=testSuite>
XML elementBenchmarkResult
need a rename ofWalltimeMilliseconds
towalltime
</TestCase>
File splitting
The purpose is to be able to save into one directory a XML file for each of the test case.
The XML header is an easy tag to detect the start of a new case.
Name of outputs files can just be incremented from one case to the next one (
result_1.xml
,result_2.xml
, etc.)The text was updated successfully, but these errors were encountered: