diff --git a/include/TestFacility.h b/include/TestFacility.h
index ac336e60194a9d42830584ff2a50bde58ed13ef0..6d2be730f7c578768cbb2180cc28e1c61619bafb 100644
--- a/include/TestFacility.h
+++ b/include/TestFacility.h
@@ -42,6 +42,11 @@ namespace ChimeraTK {
       for(auto& pv : pvManager->getAllProcessVariables()) {
         callForType(pv->getValueType(), [&pv, this](auto arg) {
           if(!pv->isWriteable()) return;
+          if(pv->getVersionNumber() != VersionNumber(nullptr)) {
+            throw ChimeraTK::logic_error("The variable '" + pv->getName() +
+                "' has been written before TestFacility::runApplication() was called. Instead use "
+                "TestFacility::setScalarDefault() resp. setArrayDefault() to set initial values.");
+          }
           typedef decltype(arg) T;
           auto pv_casted = boost::dynamic_pointer_cast<NDRegisterAccessor<T>>(pv);
           auto table = boost::fusion::at_key<T>(defaults.table);