diff --git a/Testing/Code/otbTestHelper.cxx b/Testing/Code/otbTestHelper.cxx
index e522aebef4a01c99aec5234339b65c770ed6b0b0..683c1f4999115dccd772f6636c3b27ea09bb0285 100644
--- a/Testing/Code/otbTestHelper.cxx
+++ b/Testing/Code/otbTestHelper.cxx
@@ -133,9 +133,6 @@ int TestHelper::RegressionTestAsciiFile(const char * testAsciiFileName, const ch
   {
     strfileref = *itRef;
     strfiletest = *itTest;
-    otb::StringStream buffstreamRef, buffstreamTest;
-    buffstreamRef << strfileref;
-
 
     //Check is the current line should be ignored
     bool ignoreCurrentLineRef = false;
@@ -164,6 +161,8 @@ int TestHelper::RegressionTestAsciiFile(const char * testAsciiFileName, const ch
     //ignored one if the order does not matter
     if ((!ignoreCurrentLineRef) && (!ignoreCurrentLineTest))
     {
+      otb::StringStream buffstreamRef, buffstreamTest;
+      buffstreamRef << strfileref;
       buffstreamTest << strfiletest;
       //Number of differences in the current line
       bool differenceFoundInCurrentLine = false;