diff --git a/Modules/Applications/AppMathParserX/test/CMakeLists.txt b/Modules/Applications/AppMathParserX/test/CMakeLists.txt
index d47965119441f779323e725e553dc87aa54b2ded..65e464ffec60931c951646d2e77d2a31575c841f 100644
--- a/Modules/Applications/AppMathParserX/test/CMakeLists.txt
+++ b/Modules/Applications/AppMathParserX/test/CMakeLists.txt
@@ -29,5 +29,6 @@ target_link_libraries(OTBBandMathXAppTest ${OTBAppMathParserX-Test_LIBRARIES})
 otb_module_target_label(OTBBandMathXAppTest)
 
 otb_add_test(NAME apTvUtBandMathX COMMAND OTBBandMathXAppTest
+  $<TARGET_FILE_DIR:otbapp_BandMathX>
   ${INPUTDATA}/apTvUtExportBandMathX.txt
   )
\ No newline at end of file
diff --git a/Modules/Applications/AppMathParserX/test/otbBandMathXAppTests.cxx b/Modules/Applications/AppMathParserX/test/otbBandMathXAppTests.cxx
index d754ad4b812a579c82b7e90ee6e38cb1225fce55..b2d425fc0632ff9f3c4cd85adb3572160bcfee87 100644
--- a/Modules/Applications/AppMathParserX/test/otbBandMathXAppTests.cxx
+++ b/Modules/Applications/AppMathParserX/test/otbBandMathXAppTests.cxx
@@ -69,6 +69,7 @@ int main(int , char * argv[] )
   VectorImageType::IndexType index;
   index.Fill(3); // Center of the images
   std::cout<<"Create application"<<std::endl;
+  otb::Wrapper::ApplicationRegistry::SetApplicationPath(argv[1]);
   auto app = otb::Wrapper::ApplicationRegistry::CreateApplication("BandMathX");
   app->AddImageToParameterInputImageList("il", img1);
   app->UpdateParameters();
@@ -113,8 +114,7 @@ int main(int , char * argv[] )
     return_val++;
   }
 
-  std::string context_path(argv[1]);
-  app->SetParameterString("incontext",argv[1]);
+  app->SetParameterString("incontext",argv[2]);
   // val is set in the context to 1
   app->UpdateParameters();
   desc = app->GetParameterDescription("exp");