code: public function getServiceContext($testDefinitionUri, $testCompilationUri, $testExecutionUri, $userUri = null)
      {
          // create a service context based on the provided URI
          // initialize the test session and related objects
          $serviceContext = new QtiRunnerServiceContext($testDefinitionUri, $testCompilationUri, $testExecutionUri);
          $serviceContext->setServiceManager($this->getServiceManager());
          $serviceContext->setTestConfig($this->getTestConfig());
          $serviceContext->setUserUri($userUri);
  
          $sessionService = $this->getServiceManager()->get(TestSessionService::SERVICE_ID);
          $sessionService->registerTestSession(
              $serviceContext->getTestSession(),
              $serviceContext->getStorage(),
              $serviceContext->getCompilationDirectory()
          );
  
          return $serviceContext;
      }
docs: Gets the test session for a particular delivery execution
  
  This method is called before each action (moveNext, moveBack, pause, ...) call.
  
  @param string $testDefinitionUri The URI of the test
  @param string $testCompilationUri The URI of the compiled delivery
  @param string $testExecutionUri The URI of the delivery execution
  @param string $userUri User identifier. If null current user will be used
  @return QtiRunnerServiceContext
  @throws \common_Exception