How to change client session variables during a functional browser test?
I am not sure if the storage you use to save the my_session_key attribute is shared between the testrunner and the site that gets tested, and that could explain why the test fails.

Why not test exactly the case of the inbound path processing, e.g.:

public function testToken() {
  $options = [
    'query' =&gt; [
      'param' =&gt; 'value',
    ]
  ];
  $this-&gt;drupalGet('&lt;front&gt;', $options);
  // Check site name is NOT Drupal.
  $this-&gt;assertSession()-&gt;elementTextNotContains('css', '.block-system-branding-block', 'Drupal');
}


Good luck in any case!