diff --git a/composer.json b/composer.json
index ecec97a..6422f00 100644
--- a/composer.json
+++ b/composer.json
@@ -4,7 +4,7 @@
     "type": "drupal-module",
     "license": "GPL-2.0",
     "require": {
-        "drupal/core": "^8.7.7 || ^9"
+        "drupal/core": "^9 || ^10"
     },
     "require-dev": {
         "drupal/simplenews": "~2.0",
diff --git a/modules/demo/monitoring_demo.install b/modules/demo/monitoring_demo.install
index dfec607..ecccbe9 100644
--- a/modules/demo/monitoring_demo.install
+++ b/modules/demo/monitoring_demo.install
@@ -107,7 +107,7 @@ function monitoring_demo_install() {
   $sensor_manager->enableSensor('monitoring_disappeared_sensors');
 
   // Generate some image style derivative errors.
-  $file = file_save_data($random->name());
+  $file = \Drupal::service('file.repository')->writeData($random->name(), 'public://');
   /** @var \Drupal\file\FileUsage\FileUsageInterface $usage */
   $usage = \Drupal::service('file.usage');
   foreach ($nodes as $node) {
@@ -127,7 +127,7 @@ function monitoring_demo_install() {
       ]
     );
   }
-  $file = file_save_data($random->name());
+  $file = \Drupal::service('file.repository')->writeData($random->name(), 'public://');
   \Drupal::logger('image')->notice('Source image at %source_image_path not found while trying to generate derivative image at %derivative_path.', [
       '%source_image_path' => $file->getFileUri(),
       '%derivative_path' => 'hash://styles/preview/5678.jpeg',
diff --git a/modules/demo/tests/src/Functional/MonitoringDemoTest.php b/modules/demo/tests/src/Functional/MonitoringDemoTest.php
index 49a5043..00a2a62 100644
--- a/modules/demo/tests/src/Functional/MonitoringDemoTest.php
+++ b/modules/demo/tests/src/Functional/MonitoringDemoTest.php
@@ -16,22 +16,22 @@ class MonitoringDemoTest extends MonitoringTestBase {
    *
    * @var string[]
    */
-  public static $modules = ['monitoring_demo'];
+  protected static $modules = ['monitoring_demo'];
 
   /**
    * Asserts the demo instructions on the frontpage.
    */
   public function testInstalled() {
     $this->drupalGet('');
-    $this->assertText('Monitoring');
-    $this->assertText(t('Welcome to the Monitoring demo installation.'));
-    $this->assertLink(t('Monitoring sensors overview'));
-    $this->assertLink(t('Monitoring sensors settings'));
-    $this->assertText(t('Sensor example: "Installed modules"'));
-    $this->assertLink(t('Configure'));
-    $this->assertLink(t('Uninstall'), 0);
-    $this->assertLink(t('Uninstall'), 1);
-    $this->assertText(t('Drush integration - open up your console and type in # drush monitoring-sensor-config'));
+    $this->assertSession()->pageTextContains('Monitoring');
+    $this->assertSession()->pageTextContains(t('Welcome to the Monitoring demo installation.'));
+    $this->assertSession()->linkExists(t('Monitoring sensors overview'));
+    $this->assertSession()->linkExists(t('Monitoring sensors settings'));
+    $this->assertSession()->pageTextContains(t('Sensor example: "Installed modules"'));
+    $this->assertSession()->linkExists(t('Configure'));
+    $this->assertSession()->linkExists(t('Uninstall'), 0);
+    $this->assertSession()->linkExists(t('Uninstall'), 1);
+    $this->assertSession()->pageTextContains(t('Drush integration - open up your console and type in # drush monitoring-sensor-config'));
   }
 
 }
diff --git a/modules/monitoring_mail/tests/src/Kernel/MonitoringMailKernelTest.php b/modules/monitoring_mail/tests/src/Kernel/MonitoringMailKernelTest.php
index 517854a..fc0a98c 100644
--- a/modules/monitoring_mail/tests/src/Kernel/MonitoringMailKernelTest.php
+++ b/modules/monitoring_mail/tests/src/Kernel/MonitoringMailKernelTest.php
@@ -30,7 +30,7 @@ class MonitoringMailKernelTest extends MonitoringUnitTestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     $this->installSchema('dblog', ['watchdog']);
diff --git a/modules/multigraph/tests/src/Functional/MultigraphServicesTest.php b/modules/multigraph/tests/src/Functional/MultigraphServicesTest.php
index 4712183..c77137d 100644
--- a/modules/multigraph/tests/src/Functional/MultigraphServicesTest.php
+++ b/modules/multigraph/tests/src/Functional/MultigraphServicesTest.php
@@ -40,7 +40,7 @@ class MultigraphServicesTest extends MonitoringTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
 
     $this->servicesAccount = $this->drupalCreateUser([
@@ -55,7 +55,7 @@ class MultigraphServicesTest extends MonitoringTestBase {
     $this->drupalLogin($this->servicesAccount);
 
     $response_data = $this->doJsonRequest('monitoring-multigraph');
-    $this->assertResponse(200);
+    $this->assertSession()->statusCodeEquals(200);
 
     /** @var \Drupal\monitoring_multigraph\MultigraphInterface[] $multigraphs */
     $multigraphs = \Drupal::entityTypeManager()
@@ -64,28 +64,28 @@ class MultigraphServicesTest extends MonitoringTestBase {
 
     // Test the list of multigraphs.
     foreach ($multigraphs as $name => $multigraph) {
-      $this->assertEqual($response_data[$name]['id'], $multigraph->id());
-      $this->assertEqual($response_data[$name]['label'], $multigraph->label());
-      $this->assertEqual($response_data[$name]['description'], $multigraph->getDescription());
-      $this->assertEqual($response_data[$name]['sensors'], $multigraph->getSensorsRaw());
-      $this->assertEqual($response_data[$name]['uri'], Url::fromRoute('rest.monitoring-multigraph.GET' , ['id' => $multigraph->id(), '_format' => 'json'])->setAbsolute()->toString());
+      $this->assertEquals($response_data[$name]['id'], $multigraph->id());
+      $this->assertEquals($response_data[$name]['label'], $multigraph->label());
+      $this->assertEquals($response_data[$name]['description'], $multigraph->getDescription());
+      $this->assertEquals($response_data[$name]['sensors'], $multigraph->getSensorsRaw());
+      $this->assertEquals($response_data[$name]['uri'], Url::fromRoute('rest.monitoring-multigraph.GET' , ['id' => $multigraph->id(), '_format' => 'json'])->setAbsolute()->toString());
     }
 
     // Test response for non-existing multigraph.
     $name = 'multigraph_that_does_not_exist';
     $this->doJsonRequest('monitoring-multigraph/' . $name);
-    $this->assertResponse(404);
+    $this->assertSession()->statusCodeEquals(404);
 
     // Test the predefined multigraph.
     $name = 'watchdog_severe_entries';
     $response_data = $this->doJsonRequest('monitoring-multigraph/' . $name);
-    $this->assertResponse(200);
+    $this->assertSession()->statusCodeEquals(200);
     $multigraph = $multigraphs[$name];
-    $this->assertEqual($response_data['id'], $multigraph->id());
-    $this->assertEqual($response_data['label'], $multigraph->label());
-    $this->assertEqual($response_data['description'], $multigraph->getDescription());
-    $this->assertEqual($response_data['sensors'], $multigraph->getSensorsRaw());
-    $this->assertEqual($response_data['uri'], Url::fromRoute('rest.monitoring-multigraph.GET' , ['id' => $multigraph->id(), '_format' => 'json'])->setAbsolute()->toString());
+    $this->assertEquals($response_data['id'], $multigraph->id());
+    $this->assertEquals($response_data['label'], $multigraph->label());
+    $this->assertEquals($response_data['description'], $multigraph->getDescription());
+    $this->assertEquals($response_data['sensors'], $multigraph->getSensorsRaw());
+    $this->assertEquals($response_data['uri'], Url::fromRoute('rest.monitoring-multigraph.GET' , ['id' => $multigraph->id(), '_format' => 'json'])->setAbsolute()->toString());
   }
 
 }
diff --git a/modules/multigraph/tests/src/Functional/MultigraphWebTest.php b/modules/multigraph/tests/src/Functional/MultigraphWebTest.php
index 8eb47e5..9b93487 100644
--- a/modules/multigraph/tests/src/Functional/MultigraphWebTest.php
+++ b/modules/multigraph/tests/src/Functional/MultigraphWebTest.php
@@ -27,7 +27,7 @@ class MultigraphWebTest extends BrowserTestBase {
    *
    * @var string[]
    */
-  public static $modules = [
+  protected static $modules = [
     'dblog',
     'node',
     'monitoring',
@@ -66,27 +66,28 @@ class MultigraphWebTest extends BrowserTestBase {
       'description' => $this->randomString(),
       'sensor_add_select' => 'dblog_404',
     ];
-    $this->drupalPostForm('admin/config/system/monitoring/multigraphs/add', $values, t('Add sensor'));
-    $this->assertText(t('Sensor "Page not found errors" added. You have unsaved changes.'));
+    $this->drupalGet('admin/config/system/monitoring/multigraphs/add');
+    $this->submitForm($values, t('Add sensor'));
+    $this->assertSession()->pageTextContains(t('Sensor "Page not found errors" added. You have unsaved changes.'));
 
-    $this->drupalPostForm(NULL, [
+    $this->submitForm([
       'sensor_add_select' => 'user_failed_logins',
     ], t('Add sensor'));
-    $this->assertText(t('Sensor "Failed user logins" added. You have unsaved changes.'));
+    $this->assertSession()->pageTextContains(t('Sensor "Failed user logins" added. You have unsaved changes.'));
 
-    $this->drupalPostForm(NULL, [
+    $this->submitForm([
       'sensor_add_select' => 'user_successful_logins',
     ], t('Add sensor'));
-    $this->assertText(t('Sensor "Successful user logins" added. You have unsaved changes.'));
+    $this->assertSession()->pageTextContains(t('Sensor "Successful user logins" added. You have unsaved changes.'));
 
     // And last but not least, change all sensor label values and save form.
-    $this->drupalPostForm(NULL, [
+    $this->submitForm([
       'sensors[dblog_404][label]' => 'Page not found errors (test)',
       'sensors[user_failed_logins][label]' => 'Failed user logins (test)',
       'sensors[user_successful_logins][label]' => 'Successful user logins (test)',
     ], t('Save'));
-    $this->assertText(t('Multigraph settings saved.'));
-    $this->assertText('Page not found errors (test), Failed user logins (test), Successful user logins (test)');
+    $this->assertSession()->pageTextContains(t('Multigraph settings saved.'));
+    $this->assertSession()->pageTextContains('Page not found errors (test), Failed user logins (test), Successful user logins (test)');
   }
 
   /**
@@ -98,13 +99,13 @@ class MultigraphWebTest extends BrowserTestBase {
     // Go to multigraph overview and test editing pre-installed multigraph.
     $this->drupalGet('admin/config/system/monitoring/multigraphs');
     // Check label, description and sensors (before editing).
-    $this->assertText('Watchdog severe entries');
-    $this->assertText('Watchdog entries with severity Warning or higher');
-    $this->assertText('404, Alert, Critical, Emergency, Error');
+    $this->assertSession()->pageTextContains('Watchdog severe entries');
+    $this->assertSession()->pageTextContains('Watchdog entries with severity Warning or higher');
+    $this->assertSession()->pageTextContains('404, Alert, Critical, Emergency, Error');
 
     // Edit.
     $this->drupalGet('admin/config/system/monitoring/multigraphs/watchdog_severe_entries');
-    $this->assertText('Edit Multigraph');
+    $this->assertSession()->pageTextContains('Edit Multigraph');
 
     // Change label, description and add a sensor.
     $values = [
@@ -112,30 +113,31 @@ class MultigraphWebTest extends BrowserTestBase {
       'description' => 'Watchdog entries with severity Warning or higher (test)',
       'sensor_add_select' => 'user_successful_logins',
     ];
-    $this->drupalPostForm(NULL, $values, t('Add sensor'));
-    $this->assertText('Sensor "Successful user logins" added. You have unsaved changes.');
+    $this->submitForm($values, t('Add sensor'));
+    $this->assertSession()->pageTextContains('Sensor "Successful user logins" added. You have unsaved changes.');
 
     // Remove a sensor.
     $this->getSession()->getPage()->pressButton('remove_dblog_404');
     // (drupalPostAjaxForm() lets us target the button precisely.)
-    $this->assertText(t('Sensor "Page not found errors" removed.  You have unsaved changes.'));
-    $this->drupalPostForm(NULL, [], t('Save'));
+    $this->assertSession()->pageTextContains(t('Sensor "Page not found errors" removed. You have unsaved changes.'));
+    $this->submitForm([], t('Save'));
+    $this->drupalGet('admin/config/system/monitoring/multigraphs/watchdog_severe_entries');
 
     // Change weights and save form.
-    $this->drupalPostForm('admin/config/system/monitoring/multigraphs/watchdog_severe_entries', [
+    $this->submitForm([
       'sensors[user_successful_logins][weight]' => -2,
       'sensors[dblog_event_severity_error][weight]' => -1,
       'sensors[dblog_event_severity_critical][weight]' => 0,
       'sensors[dblog_event_severity_emergency][weight]' => 1,
       'sensors[dblog_event_severity_alert][weight]' => 2,
     ], t('Save'));
-    $this->assertText(t('Multigraph settings saved.'));
+    $this->assertSession()->pageTextContains(t('Multigraph settings saved.'));
 
     // Go back to multigraph overview and check changed values.
     $this->drupalGet('admin/config/system/monitoring/multigraphs');
-    $this->assertText('Watchdog severe entries (test)');
-    $this->assertText('Watchdog entries with severity Warning or higher (test)');
-    $this->assertText('Successful user logins, Error, Critical, Emergency, Alert');
+    $this->assertSession()->pageTextContains('Watchdog severe entries (test)');
+    $this->assertSession()->pageTextContains('Watchdog entries with severity Warning or higher (test)');
+    $this->assertSession()->pageTextContains('Successful user logins, Error, Critical, Emergency, Alert');
   }
 
   /**
@@ -145,16 +147,17 @@ class MultigraphWebTest extends BrowserTestBase {
     // Go to multigraph overview and check for pre-installed multigraph.
     $this->drupalGet('admin/config/system/monitoring/multigraphs');
     // Check label and description (before deleting).
-    $this->assertText('Watchdog severe entries');
-    $this->assertText('Watchdog entries with severity Warning or higher');
+    $this->assertSession()->pageTextContains('Watchdog severe entries');
+    $this->assertSession()->pageTextContains('Watchdog entries with severity Warning or higher');
+    $this->drupalGet('admin/config/system/monitoring/multigraphs/watchdog_severe_entries/delete');
 
     // Delete.
-    $this->drupalPostForm('admin/config/system/monitoring/multigraphs/watchdog_severe_entries/delete', [], t('Delete'));
-    $this->assertText('The Watchdog severe entries (test) multigraph has been deleted');
+    $this->submitForm([], t('Delete'));
+    $this->assertSession()->pageTextContains('The Watchdog severe entries (test) multigraph has been deleted');
 
     // Go back to multigraph overview and check that multigraph is deleted.
     $this->drupalGet('admin/config/system/monitoring/multigraphs');
-    $this->assertNoText('Watchdog severe entries');
-    $this->assertNoText('Watchdog entries with severity Warning or higher');
+    $this->assertSession()->pageTextNotContains('Watchdog severe entries');
+    $this->assertSession()->pageTextNotContains('Watchdog entries with severity Warning or higher');
   }
 }
diff --git a/modules/multigraph/tests/src/Unit/Entity/MultigraphUnitTest.php b/modules/multigraph/tests/src/Unit/Entity/MultigraphUnitTest.php
index d1a6057..cd08bbc 100644
--- a/modules/multigraph/tests/src/Unit/Entity/MultigraphUnitTest.php
+++ b/modules/multigraph/tests/src/Unit/Entity/MultigraphUnitTest.php
@@ -19,14 +19,14 @@ class MultigraphUnitTest extends UnitTestCase {
   /**
    * A mock entity manager.
    *
-   * @var \Drupal\Core\Entity\EntityTypeManagerInterface|\PHPUnit_Framework_MockObject_MockObject
+   * @var \Drupal\Core\Entity\EntityTypeManagerInterface|\PHPUnit\Framework\MockObject\MockObject
    */
   protected $entityTypeManager;
 
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     $this->entityTypeManager = $this->createMock(EntityTypeManagerInterface::class);
 
     $container = new ContainerBuilder();
@@ -78,7 +78,7 @@ class MultigraphUnitTest extends UnitTestCase {
    * @param array $id
    *   An ID to set on the sensor.
    *
-   * @return \Drupal\monitoring\Entity\SensorConfig|\PHPUnit_Framework_MockObject_MockObject
+   * @return \Drupal\monitoring\Entity\SensorConfig|\PHPUnit\Framework\MockObject\MockObject
    *   The mock sensor object.
    */
   protected function getMockSensor($id) {
diff --git a/modules/test/monitoring_test.info.yml b/modules/test/monitoring_test.info.yml
index c3b8e8a..a212918 100644
--- a/modules/test/monitoring_test.info.yml
+++ b/modules/test/monitoring_test.info.yml
@@ -1,7 +1,7 @@
 name: Monitoring Test
 description: Monitoring base test module.
 package: Monitoring
-core_version_requirement: ^8.7.7 || ^9
+core_version_requirement: ^9 || ^10
 hidden: TRUE
 type: module
 
diff --git a/monitoring.api.php b/monitoring.api.php
index 6ea957c..d45fc1a 100644
--- a/monitoring.api.php
+++ b/monitoring.api.php
@@ -1,4 +1,5 @@
 <?php
+use Drupal\monitoring\Entity\SensorConfig;
 /**
  * @file
  * Monitoring API documentation.
@@ -15,7 +16,7 @@
  *
  * @see \Drupal\monitoring\Controller\SensorList::content()
  */
-function hook_monitoring_sensor_links_alter(&$links, \Drupal\monitoring\Entity\SensorConfig $sensor_config) {
+function hook_monitoring_sensor_links_alter(&$links, SensorConfig $sensor_config) {
 
 }
 
diff --git a/monitoring.info.yml b/monitoring.info.yml
index 2c45c8d..dc7be1c 100644
--- a/monitoring.info.yml
+++ b/monitoring.info.yml
@@ -2,7 +2,7 @@ name: Monitoring
 type: module
 description: Monitoring base.
 package: Monitoring
-core_version_requirement: ^8.7.7 || ^9
+core_version_requirement: ^9 || ^10
 configure: monitoring.settings
 dependencies:
  - drupal:views
diff --git a/monitoring.install b/monitoring.install
index d71a5dd..437b881 100644
--- a/monitoring.install
+++ b/monitoring.install
@@ -81,7 +81,7 @@ function monitoring_event_severities() {
 function monitoring_update_8101() {
   // Only create if the sensor config does not exist yet.
   if (!SensorConfig::load('temporary_files_usages')) {
-    $config_path = drupal_get_path('module', 'monitoring') . '/config/install/monitoring.sensor_config.temporary_files_usages.yml';
+    $config_path = \Drupal::service('extension.list.module')->getPath('monitoring') . '/config/install/monitoring.sensor_config.temporary_files_usages.yml';
     $data = Yaml::decode(file_get_contents($config_path));
     \Drupal::service('monitoring.sensor_manager')->clearCachedDefinitions();
     SensorConfig::create($data)->trustData()->save();
diff --git a/src/Plugin/monitoring/SensorPlugin/EnabledModulesSensorPlugin.php b/src/Plugin/monitoring/SensorPlugin/EnabledModulesSensorPlugin.php
index 0a81f38..f744e40 100644
--- a/src/Plugin/monitoring/SensorPlugin/EnabledModulesSensorPlugin.php
+++ b/src/Plugin/monitoring/SensorPlugin/EnabledModulesSensorPlugin.php
@@ -102,7 +102,7 @@ class EnabledModulesSensorPlugin extends SensorPluginBase {
 
     foreach ($modules as $module => $module_data) {
       // Skip profiles.
-      if (strpos(drupal_get_path('module', $module), 'profiles') === 0) {
+      if (strpos(\Drupal::service('extension.list.module')->getPath($module), 'profiles') === 0) {
         continue;
       }
       // As we also include hidden modules, some might have no name at all,
@@ -184,7 +184,7 @@ class EnabledModulesSensorPlugin extends SensorPluginBase {
     $monitoring_installed_modules = array();
     // Filter out install profile.
     foreach (array_keys(Drupal::moduleHandler()->getModuleList()) as $module) {
-      $path_parts = explode('/', drupal_get_path('module', $module));
+      $path_parts = explode('/', \Drupal::service('extension.list.module')->getPath($module));
       if ($path_parts[0] != 'profiles') {
         $monitoring_installed_modules[$module] = $module;
       }
diff --git a/src/Plugin/monitoring/SensorPlugin/TemporaryFilesUsagesSensorPlugin.php b/src/Plugin/monitoring/SensorPlugin/TemporaryFilesUsagesSensorPlugin.php
index 8c5b8fd..36d5037 100644
--- a/src/Plugin/monitoring/SensorPlugin/TemporaryFilesUsagesSensorPlugin.php
+++ b/src/Plugin/monitoring/SensorPlugin/TemporaryFilesUsagesSensorPlugin.php
@@ -118,7 +118,7 @@ class TemporaryFilesUsagesSensorPlugin extends DatabaseAggregatorSensorPlugin {
       if (!empty($types)) {
         // Delete the last unnecessary comma.
         array_pop($types);
-        $filename = Link::fromTextAndUrl($file->getFilename(), Url::fromUri(file_create_url($file->getFileUri())));
+        $filename = Link::fromTextAndUrl($file->getFilename(), \Drupal::service('file_url_generator')->generate($file->getFileUri()));
         $status = Link::createFromRoute('Make permanent', 'monitoring.make_file_permanent', [
           'monitoring_sensor_config' => $this->sensorConfig->id(),
           'file' => $fid
@@ -127,7 +127,7 @@ class TemporaryFilesUsagesSensorPlugin extends DatabaseAggregatorSensorPlugin {
         $rows[] = [
           'fid' => $fid,
           'filename' => $filename,
-          'usages' => render($types),
+          'usages' => \Drupal::service('renderer')->render($types),
           'status' => $status,
         ];
       }
diff --git a/tests/src/Functional/MonitoringCaptchaTest.php b/tests/src/Functional/MonitoringCaptchaTest.php
index d2b4871..5dd80c4 100644
--- a/tests/src/Functional/MonitoringCaptchaTest.php
+++ b/tests/src/Functional/MonitoringCaptchaTest.php
@@ -15,12 +15,12 @@ class MonitoringCaptchaTest extends MonitoringTestBase {
    *
    * @var array
    */
-  public static $modules = array('captcha');
+  protected static $modules = array('captcha', 'node');
 
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
     // Add captcha.inc file.
     module_load_include('inc', 'captcha');
@@ -41,23 +41,24 @@ class MonitoringCaptchaTest extends MonitoringTestBase {
     captcha_set_form_id_setting('user_login_form', 'captcha/Math');
 
     // Assert the number of entries in the captcha_session table is 1.
-    $this->assertEqual(\Drupal::database()->query('SELECT COUNT (*) FROM {captcha_sessions}')->fetchField(), 0);
+    $this->assertEquals(\Drupal::database()->query('SELECT COUNT (*) FROM {captcha_sessions}')->fetchField(), 0);
     // Try to log in, with invalid captcha answer which should fail.
     $edit = array(
       'name' => $user->getAccountName(),
       'pass' => $user->pass_raw,
       'captcha_response' => '?',
     );
-    $this->drupalPostForm('user', $edit, t('Log in'));
+    $this->drupalGet('user');
+    $this->submitForm($edit, t('Log in'));
 
     // Assert the total number of entries in captcha_sessions table is now 2.
-    $this->assertEqual(\Drupal::database()->query('SELECT COUNT (*) FROM {captcha_sessions}')->fetchField(), 1);
+    $this->assertEquals(\Drupal::database()->query('SELECT COUNT (*) FROM {captcha_sessions}')->fetchField(), 1);
 
     // Run sensor and get the message.
     $message = $this->runSensor('captcha_failed_count')->getMessage();
 
     // Assert the number of failed attempts.
-    $this->assertEqual($message, '1 attempt(s)');
+    $this->assertEquals($message, '1 attempt(s)');
   }
 
 }
diff --git a/tests/src/Functional/MonitoringCommerceTest.php b/tests/src/Functional/MonitoringCommerceTest.php
index 29acd3c..08840b9 100644
--- a/tests/src/Functional/MonitoringCommerceTest.php
+++ b/tests/src/Functional/MonitoringCommerceTest.php
@@ -19,7 +19,7 @@ class MonitoringCommerceTest extends MonitoringTestBase {
    *
    * @var array
    */
-  public static $modules = ['commerce', 'commerce_order', 'node'];
+  protected static $modules = ['commerce', 'commerce_order', 'node'];
 
   /**
    * The account for testing.
@@ -31,7 +31,7 @@ class MonitoringCommerceTest extends MonitoringTestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     $this->account = $this->drupalCreateUser([
@@ -48,7 +48,8 @@ class MonitoringCommerceTest extends MonitoringTestBase {
     $edit = [
       'currency_codes[]' => ['CHF', 'EUR'],
     ];
-    $this->drupalPostForm('admin/commerce/config/currencies/add', $edit, t('Add'));
+    $this->drupalGet('admin/commerce/config/currencies/add');
+    $this->submitForm($edit, t('Add'));
 
     // Create a default store.
     $edit = [
@@ -60,7 +61,8 @@ class MonitoringCommerceTest extends MonitoringTestBase {
       'address[0][address][postal_code]' => '1234',
       'default_currency' => 'CHF',
     ];
-    $this->drupalPostForm('store/add/online', $edit, t('Save'));
+    $this->drupalGet('store/add/online');
+    $this->submitForm($edit, t('Save'));
 
     // Create an order item type
     $edit = [
@@ -68,7 +70,8 @@ class MonitoringCommerceTest extends MonitoringTestBase {
       'label' => 'Test',
       'orderType' => 'default'
     ];
-    $this->drupalPostForm('admin/commerce/config/order-item-types/add', $edit, t('Save'));
+    $this->drupalGet('admin/commerce/config/order-item-types/add');
+    $this->submitForm($edit, t('Save'));
   }
 
   /**
@@ -92,7 +95,7 @@ class MonitoringCommerceTest extends MonitoringTestBase {
     $sensor->save();
     // Assert there is no value if there are no orders.
     $result = $this->runSensor('commerce_total_turnover');
-    $this->assertEqual($result->getMessage(), 'No value');
+    $this->assertEquals($result->getMessage(), 'No value');
     $this->assertNull($result->getValue());
 
     // Create some orders with different states and currencies.
@@ -103,14 +106,15 @@ class MonitoringCommerceTest extends MonitoringTestBase {
     $this->createEmptyOrderWithPrice('completed', 1500, 'CHF');
 
     $result = $this->runSensor('commerce_total_turnover');
-    $this->assertEqual($result->getMessage(), 'CHF 1’900.00 in 1 day');
-    $this->assertEqual($result->getValue(), '1900.000000');
+    $this->assertEquals($result->getMessage(), 'CHF 1’900.00 in 1 day');
+    $this->assertEquals($result->getValue(), '1900.000000');
 
     // Now only consider completed orders.
     $edit = [
       'settings[commerce_order_paid_states][completed]' => TRUE,
     ];
-    $this->drupalPostForm('admin/config/system/monitoring/sensors/commerce_total_turnover', $edit, t('Save'));
+    $this->drupalGet('admin/config/system/monitoring/sensors/commerce_total_turnover');
+    $this->submitForm($edit, t('Save'));
 
     $sensor = SensorConfig::load('commerce_total_turnover');
     $paid_states = $sensor->getSetting('commerce_order_paid_states');
@@ -118,23 +122,24 @@ class MonitoringCommerceTest extends MonitoringTestBase {
     $this->assertContains('completed', $paid_states);
 
     $result = $this->runSensor('commerce_total_turnover');
-    $this->assertEqual($result->getMessage(), 'CHF 1’500.00 in 1 day');
-    $this->assertEqual($result->getValue(), '1500.000000');
+    $this->assertEquals($result->getMessage(), 'CHF 1’500.00 in 1 day');
+    $this->assertEquals($result->getValue(), '1500.000000');
 
     // Change currency.
     $this->createEmptyOrderWithPrice('completed', 250, 'EUR');
     $edit = [
       'settings[commerce_order_currency]' => 'EUR',
     ];
-    $this->drupalPostForm('admin/config/system/monitoring/sensors/commerce_total_turnover', $edit, t('Save'));
+    $this->drupalGet('admin/config/system/monitoring/sensors/commerce_total_turnover');
+    $this->submitForm($edit, t('Save'));
 
     $result = $this->runSensor('commerce_total_turnover');
-    $this->assertEqual($result->getMessage(), '€ 250.00 in 1 day');
-    $this->assertEqual($result->getValue(), '250.000000');
+    $this->assertEquals($result->getMessage(), '€ 250.00 in 1 day');
+    $this->assertEquals($result->getValue(), '250.000000');
     $this->drupalLogout();
     $result = $this->runSensor('commerce_total_turnover');
-    $this->assertEqual($result->getMessage(), '€ 250.00 in 1 day');
-    $this->assertEqual($result->getValue(), '250.000000');
+    $this->assertEquals($result->getMessage(), '€ 250.00 in 1 day');
+    $this->assertEquals($result->getValue(), '250.000000');
   }
 
   /**
diff --git a/tests/src/Functional/MonitoringCoreWebTest.php b/tests/src/Functional/MonitoringCoreWebTest.php
index dca37cd..e092b88 100644
--- a/tests/src/Functional/MonitoringCoreWebTest.php
+++ b/tests/src/Functional/MonitoringCoreWebTest.php
@@ -44,22 +44,23 @@ class MonitoringCoreWebTest extends MonitoringTestBase {
     $this->drupalLogin($account);
 
     $this->drupalGet('admin/config/system/monitoring/sensors/add');
-    $this->assertFieldByName('status', TRUE);
+    $this->assertSession()->fieldValueEquals('status', TRUE);
+    $this->drupalGet('admin/config/system/monitoring/sensors/add');
     // Test creation of Node entity aggregator sensor.
-    $this->drupalPostForm('admin/config/system/monitoring/sensors/add', [
+    $this->submitForm([
       'label' => 'QueueTest',
       'id' => 'queue_size_test',
       'plugin_id' => 'queue_size',
     ], 'Select sensor');
 
-    $this->assertOption('edit-settings-queue', 'monitoring_test');
-    $this->assertOptionByText('edit-settings-queue', 'Test Worker');
+    $this->assertSession()->optionExists('edit-settings-queue', 'monitoring_test');
+    $this->assertSession()->optionExists('edit-settings-queue', 'Test Worker');
 
     $edit = [
       'settings[queue]' => 'monitoring_test',
     ];
-    $this->drupalPostForm(NULL, $edit, 'Save');
-    $this->assertText('Sensor QueueTest saved.');
+    $this->submitForm($edit, 'Save');
+    $this->assertSession()->pageTextContains('Sensor QueueTest saved.');
   }
 
   /**
@@ -76,17 +77,17 @@ class MonitoringCoreWebTest extends MonitoringTestBase {
 
     // Assert updates when installing and uninstalling the past module.
     $this->drupalGet('admin/reports/monitoring');
-    $this->assertNoRaw('<span title="Requirements of the past module">Module past</span>');
+    $this->assertSession()->responseNotContains('<span title="Requirements of the past module">Module past</span>');
     $this->installModules(['past']);
     $this->drupalGet('admin/reports/monitoring');
-    $this->assertRaw('<span title="Requirements of the past module">Module past</span>');
+    $this->assertSession()->responseContains('<span title="Requirements of the past module">Module past</span>');
     $this->uninstallModules(['past']);
     $this->drupalGet('admin/reports/monitoring');
-    $this->assertNoRaw('<span title="Requirements of the past module">Module past</span>');
+    $this->assertSession()->responseNotContains('<span title="Requirements of the past module">Module past</span>');
 
     // Assert the rebuild update changes.
     $this->drupalGet('/admin/config/system/monitoring/sensors/rebuild');
-    $this->assertText('No changes were made.');
+    $this->assertSession()->pageTextContains('No changes were made.');
 
   }
 
@@ -113,10 +114,11 @@ class MonitoringCoreWebTest extends MonitoringTestBase {
     $this->assertEquals(5, count($rows), 'There are 5 results in the table.');
     $this->assertTrue(!empty($rows[0]->find('css', 'a')->getText()), 'Found WID in verbose output');
     $this->assertEquals("Session opened for {$test_user->getDisplayName()}.", $message, 'Found replaced message in output.');
-    $this->assertText('Session opened for ' . $test_user->label());
+    $this->assertSession()->pageTextContains('Session opened for ' . $test_user->label());
+    $this->drupalGet('admin/config/system/monitoring/sensors/user_successful_logins');
 
     // Remove variables from the fields and assert message has no replacements.
-    $this->drupalPostForm('admin/config/system/monitoring/sensors/user_successful_logins', ['verbose_fields[variables][field_key]' => ''], t('Save'));
+    $this->submitForm(['verbose_fields[variables][field_key]' => ''], t('Save'));
     $this->drupalGet('admin/reports/monitoring/sensors/user_successful_logins');
     $rows = $this->getSession()->getPage()->findAll('css', '#unaggregated_result tbody tr');
     $message = $rows[0]->find('css', 'td:nth-child(2)')->getText();
@@ -139,16 +141,16 @@ class MonitoringCoreWebTest extends MonitoringTestBase {
     $this->drupalLogin($test_user);
 
     $result = $this->runSensor('user_sessions_authenticated');
-    $this->assertEqual($result->getValue(), 1);
+    $this->assertEquals($result->getValue(), 1);
     $result = $this->runSensor('user_sessions_all');
-    $this->assertEqual($result->getValue(), 1);
+    $this->assertEquals($result->getValue(), 1);
     // Logout the user to see if sensors responded to the change.
     $this->drupalLogout();
 
     $result = $this->runSensor('user_sessions_authenticated');
-    $this->assertEqual($result->getValue(), 0);
+    $this->assertEquals($result->getValue(), 0);
     $result = $this->runSensor('user_sessions_all');
-    $this->assertEqual($result->getValue(), 0);
+    $this->assertEquals($result->getValue(), 0);
 
     // Check verbose output.
     $this->drupalLogin($test_user);
@@ -176,10 +178,10 @@ class MonitoringCoreWebTest extends MonitoringTestBase {
 
     // The username should be replaced in the message.
     $this->drupalGet('/admin/reports/monitoring/sensors/dblog_event_severity_notice');
-    $this->assertText('Session opened for ' . $test_user->label());
+    $this->assertSession()->pageTextContains('Session opened for ' . $test_user->label());
     // 'No results' text is displayed when the query has 0 results.
     $this->drupalGet('/admin/reports/monitoring/sensors/dblog_event_severity_warning');
-    $this->assertText('There are no results for this sensor to display.');
+    $this->assertSession()->pageTextContains('There are no results for this sensor to display.');
   }
 
   /**
@@ -193,7 +195,7 @@ class MonitoringCoreWebTest extends MonitoringTestBase {
     // configuration.
     $result = $this->runSensor('twig_debug_mode');
     $this->assertTrue($result->isOk());
-    $this->assertEqual($result->getMessage(), 'Optimal configuration');
+    $this->assertEquals($result->getMessage(), 'Optimal configuration');
 
     $twig_config = $this->container->getParameter('twig.config');
     // Set parameters to the optimal configuration to make sure implicit changes
@@ -206,7 +208,7 @@ class MonitoringCoreWebTest extends MonitoringTestBase {
 
     $result = $this->runSensor('twig_debug_mode');
     $this->assertTrue($result->isOk());
-    $this->assertEqual($result->getMessage(), 'Optimal configuration');
+    $this->assertEquals($result->getMessage(), 'Optimal configuration');
 
     $twig_config = $this->container->getParameter('twig.config');
     // Change parameters and check sensor message.
@@ -218,7 +220,7 @@ class MonitoringCoreWebTest extends MonitoringTestBase {
 
     $result = $this->runSensor('twig_debug_mode');
     $this->assertTrue($result->isWarning());
-    $this->assertEqual($result->getMessage(), 'Twig debug mode is enabled, Twig cache disabled, Automatic recompilation of Twig templates enabled');
+    $this->assertEquals($result->getMessage(), 'Twig debug mode is enabled, Twig cache disabled, Automatic recompilation of Twig templates enabled');
   }
 
   /**
@@ -241,31 +243,31 @@ class MonitoringCoreWebTest extends MonitoringTestBase {
 
     // Check sensor message after first privilege user creation.
     $result = $this->runSensor('user_integrity');
-    $this->assertEqual($result->getMessage(), '1 privileged user(s), 1 new user(s)');
+    $this->assertEquals($result->getMessage(), '1 privileged user(s), 1 new user(s)');
 
     // Create second privileged user.
     $test_user_second = $this->drupalCreateUser(array(), 'test_user_2', TRUE);
     $this->drupalLogin($test_user_second);
     // Check sensor message after new privilege user creation.
     $result = $this->runSensor('user_integrity');
-    $this->assertEqual($result->getMessage(), '2 privileged user(s), 2 new user(s)');
+    $this->assertEquals($result->getMessage(), '2 privileged user(s), 2 new user(s)');
 
     // Reset the user data, button is tested in UI tests.
     \Drupal::keyValue('monitoring.users')->deleteAll();
     $result = $this->runSensor('user_integrity');
-    $this->assertEqual($result->getMessage(), '2 privileged user(s)');
+    $this->assertEquals($result->getMessage(), '2 privileged user(s)');
 
     // Make changes to a user.
     $test_user_second->setUsername('changed');
     $test_user_second->save();
     // Check sensor message for user changes.
     $result = $this->runSensor('user_integrity');
-    $this->assertEqual($result->getMessage(), '2 privileged user(s), 1 changed user(s)');
+    $this->assertEquals($result->getMessage(), '2 privileged user(s), 1 changed user(s)');
 
     // Reset the user data again, check sensor message.
     \Drupal::keyValue('monitoring.users')->deleteAll();
     $result = $this->runSensor('user_integrity');
-    $this->assertEqual($result->getMessage(), '2 privileged user(s)');
+    $this->assertEquals($result->getMessage(), '2 privileged user(s)');
 
     // Add permissions to authenticated user with no privilege of registration.
     \Drupal::configFactory()->getEditable('user.settings')->set('register', 'admin_only')->save();
@@ -275,38 +277,38 @@ class MonitoringCoreWebTest extends MonitoringTestBase {
     $this->assertTrue($result->isWarning());
 
     // Count users included admin.
-    $this->assertEqual($result->getMessage(), '3 privileged user(s), Privileged access for roles Authenticated user');
+    $this->assertEquals($result->getMessage(), '3 privileged user(s), Privileged access for roles Authenticated user');
 
     // Add permissions to anonymous user and check the sensor.
     user_role_grant_permissions(RoleInterface::ANONYMOUS_ID, array('administer account settings'));
     $result = $this->runSensor('user_integrity');
-    $this->assertEqual($result->getMessage(), '3 privileged user(s), Privileged access for roles Anonymous user, Authenticated user');
+    $this->assertEquals($result->getMessage(), '3 privileged user(s), Privileged access for roles Anonymous user, Authenticated user');
 
     // Authenticated user with privilege of register.
     \Drupal::configFactory()->getEditable('user.settings')->set('register', 'visitors')->save();
     $result = $this->runSensor('user_integrity');
     $this->assertTrue($result->isCritical());
-    $this->assertEqual($result->getMessage(), '3 privileged user(s), Privileged access for roles Anonymous user, Authenticated user, Self registration possible.');
+    $this->assertEquals($result->getMessage(), '3 privileged user(s), Privileged access for roles Anonymous user, Authenticated user, Self registration possible.');
 
     // Create an authenticated user and test that the sensor counter increments.
     $test_user_third = $this->drupalCreateUser(array(), 'test_user_3');
     \Drupal::keyValue('monitoring.users')->deleteAll();
     $result = $this->runSensor('user_integrity');
-    $this->assertEqual($result->getMessage(), '4 privileged user(s), Privileged access for roles Anonymous user, Authenticated user, Self registration possible.');
+    $this->assertEquals($result->getMessage(), '4 privileged user(s), Privileged access for roles Anonymous user, Authenticated user, Self registration possible.');
 
     $test_user_third->setUsername('changed2');
     $test_user_third->save();
 
     // Check sensor message for user changes.
     $result = $this->runSensor('user_integrity');
-    $this->assertEqual($result->getMessage(), '4 privileged user(s), 1 changed user(s), Privileged access for roles Anonymous user, Authenticated user, Self registration possible.');
+    $this->assertEquals($result->getMessage(), '4 privileged user(s), 1 changed user(s), Privileged access for roles Anonymous user, Authenticated user, Self registration possible.');
 
     // Check sensor message with permissions revoked.
     user_role_revoke_permissions(RoleInterface::ANONYMOUS_ID, array('administer account settings'));
     user_role_revoke_permissions(RoleInterface::AUTHENTICATED_ID, array('administer account settings'));
     \Drupal::keyValue('monitoring.users')->deleteAll();
     $result = $this->runSensor('user_integrity');
-    $this->assertEqual($result->getMessage(), '2 privileged user(s)');
+    $this->assertEquals($result->getMessage(), '2 privileged user(s)');
 
   }
 
@@ -372,9 +374,10 @@ class MonitoringCoreWebTest extends MonitoringTestBase {
     $convert_to_array = function (NodeElement $header) {
       return $header->getText();
     };
+    $this->drupalGet('/admin/reports/monitoring/sensors/dblog_php_notices');
 
     // Check out sensor result page.
-    $this->drupalPostForm('/admin/reports/monitoring/sensors/dblog_php_notices', [], t('Run now'));
+    $this->submitForm([], t('Run now'));
     $headers = $this->getSession()->getPage()->findAll('css', '#unaggregated_result thead tr th');
     $headers = array_map($convert_to_array, $headers);
     $this->assertEquals($expected_header, $headers, 'The header is correct.');
@@ -384,11 +387,11 @@ class MonitoringCoreWebTest extends MonitoringTestBase {
 
     $first_message = array_map($convert_to_array, $rows[0]->findAll('css', 'td'));
     $second_message = array_map($convert_to_array, $rows[1]->findAll('css', 'td'));
-    $this->assertEqual($first_message, $expected_body_one, 'The first notice is as expected.');
-    $this->assertEqual($second_message, $expected_body_two, 'The second notice is as expected');
+    $this->assertEquals($first_message, $expected_body_one, 'The first notice is as expected.');
+    $this->assertEquals($second_message, $expected_body_two, 'The second notice is as expected');
 
     // Test Filename shortening.
-    $this->assertEqual(str_replace(DRUPAL_ROOT . '/', '', $error['%file'] . ':' . $error['%line']), $first_message[4], 'Filename was successfully shortened.');
+    $this->assertEquals(str_replace(DRUPAL_ROOT . '/', '', $error['%file'] . ':' . $error['%line']), $first_message[4], 'Filename was successfully shortened.');
   }
 
   /**
@@ -398,8 +401,9 @@ class MonitoringCoreWebTest extends MonitoringTestBase {
    */
   public function testUserFailedLoginSensorPlugin() {
 
+    $this->drupalGet('user/login');
     // Add a failed attempt for the admin account.
-    $this->drupalPostForm('user/login', [
+    $this->submitForm([
       'name' => 'admin',
       'pass' => '123'
     ], t('Log in'));
@@ -462,14 +466,13 @@ class MonitoringCoreWebTest extends MonitoringTestBase {
     $this->assertTrue($result->isOk());
 
     $log = $this->loadWatchdog();
-    $this->assertEqual(count($log), 1, 'There should be one log entry: all sensors enabled by default added.');
+    $this->assertEquals(count($log), 1, 'There should be one log entry: all sensors enabled by default added.');
 
     $sensor_config_all = monitoring_sensor_manager()->getAllSensorConfig();
-    $this->assertEqual(new FormattableMarkup($log[0]->message, unserialize($log[0]->variables)),
-      new FormattableMarkup('@count new sensor/s added: @names', array(
-        '@count' => count($sensor_config_all),
-        '@names' => implode(', ', array_keys($sensor_config_all))
-      )));
+    $this->assertEquals(new FormattableMarkup($log[0]->message, unserialize($log[0]->variables)), new FormattableMarkup('@count new sensor/s added: @names', array(
+      '@count' => count($sensor_config_all),
+      '@names' => implode(', ', array_keys($sensor_config_all))
+    )));
 
     // Uninstall the media module so that the media requirements sensor goes
     // away.
@@ -479,9 +482,9 @@ class MonitoringCoreWebTest extends MonitoringTestBase {
     // critical status.
     $result = $this->runSensor('monitoring_disappeared_sensors');
     $this->assertTrue($result->isCritical());
-    $this->assertEqual($result->getMessage(), 'Missing sensor core_requirements_media');
+    $this->assertEquals($result->getMessage(), 'Missing sensor core_requirements_media');
     // There should be no new logs.
-    $this->assertEqual(count($this->loadWatchdog()), 1);
+    $this->assertEquals(count($this->loadWatchdog()), 1);
 
     // Install the comment module to test the correct procedure of removing
     // sensors.
@@ -491,7 +494,7 @@ class MonitoringCoreWebTest extends MonitoringTestBase {
     // Now we should be back to normal.
     $result = $this->runSensor('monitoring_disappeared_sensors');
     $this->assertTrue($result->isOk());
-    $this->assertEqual(count($this->loadWatchdog()), 1);
+    $this->assertEquals(count($this->loadWatchdog()), 1);
 
     // Do the correct procedure to remove a sensor - first disable thes sensors
     // and then uninstall the comment module.
@@ -502,8 +505,8 @@ class MonitoringCoreWebTest extends MonitoringTestBase {
     $result = $this->runSensor('monitoring_disappeared_sensors');
     $this->assertTrue($result->isOk());
     $log = $this->loadWatchdog();
-    $this->assertEqual(count($log), 2, 'Removal of core_requirements_media sensor should be logged.');
-    $this->assertEqual(new FormattableMarkup($log[1]->message, unserialize($log[1]->variables)), '1 new sensor/s removed: core_requirements_media');
+    $this->assertEquals(count($log), 2, 'Removal of core_requirements_media sensor should be logged.');
+    $this->assertEquals(new FormattableMarkup($log[1]->message, unserialize($log[1]->variables)), '1 new sensor/s removed: core_requirements_media');
   }
 
   /**
@@ -524,8 +527,8 @@ class MonitoringCoreWebTest extends MonitoringTestBase {
     $this->installModules(array('contact'));
     $result = $this->runSensor('monitoring_installed_modules');
     $this->assertTrue($result->isCritical());
-    $this->assertEqual($result->getMessage(), '1 modules delta, expected 0, Following modules are NOT expected to be installed: Contact (contact)');
-    $this->assertEqual($result->getValue(), 1);
+    $this->assertEquals($result->getMessage(), '1 modules delta, expected 0, Following modules are NOT expected to be installed: Contact (contact)');
+    $this->assertEquals($result->getValue(), 1);
 
     // Allow additional modules and run the sensor - it should not escalate now.
     $sensor_config = SensorConfig::load('monitoring_installed_modules');
@@ -541,8 +544,8 @@ class MonitoringCoreWebTest extends MonitoringTestBase {
     $this->uninstallModules(array('contact'));
     $result = $this->runSensor('monitoring_installed_modules');
     $this->assertTrue($result->isCritical());
-    $this->assertEqual($result->getMessage(), '1 modules delta, expected 0, Following modules are expected to be installed: Contact (contact)');
-    $this->assertEqual($result->getValue(), 1);
+    $this->assertEquals($result->getMessage(), '1 modules delta, expected 0, Following modules are expected to be installed: Contact (contact)');
+    $this->assertEquals($result->getValue(), 1);
   }
 
 
@@ -573,7 +576,7 @@ class MonitoringCoreWebTest extends MonitoringTestBase {
     );
     $sensor_config->save();
     $result = $this->runSensor('entity_aggregate_test');
-    $this->assertEqual($result->getValue(), '1');
+    $this->assertEquals($result->getValue(), '1');
 
     // Test for node type2.
     $sensor_config->settings['conditions'] = array(
@@ -582,7 +585,7 @@ class MonitoringCoreWebTest extends MonitoringTestBase {
     $sensor_config->save();
     $result = $this->runSensor('entity_aggregate_test');
     // There should be two nodes with node type2 and created in last 24 hours.
-    $this->assertEqual($result->getValue(), 2);
+    $this->assertEquals($result->getValue(), 2);
 
     // Test support for configurable fields, create a taxonomy reference field.
     $vocabulary = $this->createVocabulary();
@@ -665,16 +668,17 @@ class MonitoringCoreWebTest extends MonitoringTestBase {
     $sensor_config->save();
     $result = $this->runSensor('entity_aggregate_test');
     // There should be three nodes with that reference.
-    $this->assertEqual($result->getValue(), 3);
+    $this->assertEquals($result->getValue(), 3);
 
     // Check the content entity aggregator verbose output and other UI elements.
     $this->drupalLogin($this->createUser(['monitoring reports', 'administer monitoring']));
-    $this->drupalPostForm('admin/reports/monitoring/sensors/entity_aggregate_test', [], t('Run now'));
-    $this->assertText('id');
-    $this->assertText('label');
-    $this->assertLink($node1->label());
-    $this->assertLink($node2->label());
-    $this->assertLink($node3->label());
+    $this->drupalGet('admin/reports/monitoring/sensors/entity_aggregate_test');
+    $this->submitForm([], t('Run now'));
+    $this->assertSession()->pageTextContains('id');
+    $this->assertSession()->pageTextContains('label');
+    $this->assertSession()->linkExists($node1->label());
+    $this->assertSession()->linkExists($node2->label());
+    $this->assertSession()->linkExists($node3->label());
 
     // Assert Query result appears.
     $assert_session = $this->assertSession();
@@ -686,31 +690,31 @@ class MonitoringCoreWebTest extends MonitoringTestBase {
 
     $this->clickLink(t('Edit'));
     // Assert some of the 'available fields'.
-    $this->assertText('Available Fields for entity type Content: changed, created, default_langcode, id, label, langcode, nid, promote, revision_default, revision_log, revision_timestamp, revision_translation_affected, revision_uid, status, sticky, title, type, uid, uuid, vid.');
-    $this->assertFieldByName('conditions[0][field]', 'term_reference.target_id');
-    $this->assertFieldByName('conditions[0][value]', $term1->id());
+    $this->assertSession()->pageTextContains('Available Fields for entity type Content: changed, created, default_langcode, id, label, langcode, nid, promote, revision_default, revision_log, revision_timestamp, revision_translation_affected, revision_uid, status, sticky, title, type, uid, uuid, vid.');
+    $this->assertSession()->fieldValueEquals('conditions[0][field]', 'term_reference.target_id');
+    $this->assertSession()->fieldValueEquals('conditions[0][value]', $term1->id());
 
     // Test adding another field.
-    $this->drupalPostForm(NULL, [
+    $this->submitForm([
       'settings[verbose_fields][2]' => 'revision_timestamp',
-    ] , t('Add another field'));
+    ], t('Add another field'));
     // Repeat for a condition, add an invalid field while we are at it.
-    $this->drupalPostForm(NULL, [
+    $this->submitForm([
     'conditions[1][field]' => 'nid',
       'conditions[1][operator]' => '>',
       'conditions[1][value]' => 4,
       // The invalid field.
       'settings[verbose_fields][3]' => 'test_wrong_field',
-    ] , t('Add another condition'));
+    ], t('Add another condition'));
 
-    $this->drupalPostForm(NULL, [], t('Save'));
+    $this->submitForm([], t('Save'));
     $this->clickLink('Entity Aggregate test');
 
     // Assert the new field and it's formatted output.
-    $this->assertText('revision_timestamp');
-    $this->assertText(\Drupal::service('date.formatter')->format($node1->getRevisionCreationTime(), 'short'));
-    $this->assertText(\Drupal::service('date.formatter')->format($node2->getRevisionCreationTime(), 'short'));
-    $this->assertText(\Drupal::service('date.formatter')->format($node3->getRevisionCreationTime(), 'short'));
+    $this->assertSession()->pageTextContains('revision_timestamp');
+    $this->assertSession()->pageTextContains(\Drupal::service('date.formatter')->format($node1->getRevisionCreationTime(), 'short'));
+    $this->assertSession()->pageTextContains(\Drupal::service('date.formatter')->format($node2->getRevisionCreationTime(), 'short'));
+    $this->assertSession()->pageTextContains(\Drupal::service('date.formatter')->format($node3->getRevisionCreationTime(), 'short'));
 
     // Update the sensor to look for nodes with a reference to term1 in the
     // first field and term2 in the second.
@@ -724,7 +728,7 @@ class MonitoringCoreWebTest extends MonitoringTestBase {
     $sensor_config->save();
     $result = $this->runSensor('entity_aggregate_test');
     // There should be one nodes with those references.
-    $this->assertEqual($result->getValue(), 1);
+    $this->assertEquals($result->getValue(), 1);
   }
 
   /**
@@ -795,9 +799,10 @@ class MonitoringCoreWebTest extends MonitoringTestBase {
 
     // Make sure there is no used temporary files.
     $result = $this->runSensor('temporary_files_usages');
-    $this->assertEqual($result->getValue(), 0);
-    $this->drupalPostForm('admin/reports/monitoring/sensors/temporary_files_usages', [], t('Run now'));
-    $this->assertText('0 used temporary files');
+    $this->assertEquals($result->getValue(), 0);
+    $this->drupalGet('admin/reports/monitoring/sensors/temporary_files_usages');
+    $this->submitForm([], t('Run now'));
+    $this->assertSession()->pageTextContains('0 used temporary files');
 
     $this->drupalCreateContentType(['type' => 'article', 'name' => 'Article']);
     // Create two nodes.
@@ -864,31 +869,32 @@ class MonitoringCoreWebTest extends MonitoringTestBase {
     ]);
     $file_usage->add($file3, 'monitoring', 'node', $node1->id());
     $file3->save();
+    $this->drupalGet('admin/reports/monitoring/sensors/temporary_files_usages');
 
     // Run sensor and make sure there are two temporary files which are used.
-    $this->drupalPostForm('admin/reports/monitoring/sensors/temporary_files_usages', [], t('Run now'));
+    $this->submitForm([], t('Run now'));
     $result = $this->runSensor('temporary_files_usages');
-    $this->assertEqual($result->getValue(), 2);
-    $this->assertText('2 used temporary files');
-    $this->assertLink('example_file_1');
-    $this->assertLink('example_file_2');
-    $this->assertLink($node1->label());
-    $this->assertLink($node2->label());
-    $this->assertLink('Make permanent');
+    $this->assertEquals($result->getValue(), 2);
+    $this->assertSession()->pageTextContains('2 used temporary files');
+    $this->assertSession()->linkExists('example_file_1');
+    $this->assertSession()->linkExists('example_file_2');
+    $this->assertSession()->linkExists($node1->label());
+    $this->assertSession()->linkExists($node2->label());
+    $this->assertSession()->linkExists('Make permanent');
 
     // Make the first file permanent and assert message.
     $this->clickLink('Make permanent');
-    $this->assertText(t('File @file is now permanent.', ['@file' => 'example_file_1']));
+    $this->assertSession()->pageTextContains(t('File @file is now permanent.', ['@file' => 'example_file_1']));
 
     // Make sure that the temporary files are in the list.
-    $this->assertText('1 used temporary files');
-    $this->assertLink('example_file_2');
-    $this->assertLink($node2->label());
+    $this->assertSession()->pageTextContains('1 used temporary files');
+    $this->assertSession()->linkExists('example_file_2');
+    $this->assertSession()->linkExists($node2->label());
 
     // Make sure that the permanent files are not in the list.
-    $this->assertNoLink('example_file_3');
-    $this->assertNoLink('example_file_1');
-    $this->assertNoLink($node1->label());
+    $this->assertSession()->linkNotExists('example_file_3');
+    $this->assertSession()->linkNotExists('example_file_1');
+    $this->assertSession()->linkNotExists($node1->label());
   }
 
   /**
diff --git a/tests/src/Functional/MonitoringRebuildTest.php b/tests/src/Functional/MonitoringRebuildTest.php
index 053a0d7..dc508bf 100644
--- a/tests/src/Functional/MonitoringRebuildTest.php
+++ b/tests/src/Functional/MonitoringRebuildTest.php
@@ -50,8 +50,8 @@ class MonitoringRebuildTest extends MonitoringTestBase {
     // Rebuild and make sure they are created again.
     $this->drupalGet('/admin/config/system/monitoring/sensors');
     $this->clickLink('Rebuild sensor list');
-    $this->assertText('The sensor Ultimate cron errors has been created.');
-    $this->assertText('The sensor Twig debug mode has been created.');
+    $this->assertSession()->pageTextContains('The sensor Ultimate cron errors has been created.');
+    $this->assertSession()->pageTextContains('The sensor Twig debug mode has been created.');
     $this->assertNotNull(SensorConfig::load('twig_debug_mode'));
     $this->assertNotNull(SensorConfig::load('ultimate_cron_errors'));
     $this->assertNotNull(SensorConfig::load('update_core'));
diff --git a/tests/src/Functional/MonitoringServicesTest.php b/tests/src/Functional/MonitoringServicesTest.php
index 1a57f64..b416622 100644
--- a/tests/src/Functional/MonitoringServicesTest.php
+++ b/tests/src/Functional/MonitoringServicesTest.php
@@ -18,7 +18,7 @@ class MonitoringServicesTest extends MonitoringTestBase {
    *
    * @var array
    */
-  public static $modules = array('dblog', 'basic_auth', 'monitoring', 'views', 'node', 'rest');
+  protected static $modules = array('dblog', 'basic_auth', 'monitoring', 'views', 'node', 'rest');
 
   /**
    * User account created.
@@ -30,7 +30,7 @@ class MonitoringServicesTest extends MonitoringTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
 
     $this->servicesAccount = $this->drupalCreateUser(array('restful get monitoring-sensor', 'restful get monitoring-sensor-result'));
@@ -43,46 +43,46 @@ class MonitoringServicesTest extends MonitoringTestBase {
     $this->drupalLogin($this->servicesAccount);
 
     $response_data = $this->doJsonRequest('monitoring-sensor');
-    $this->assertResponse(200);
+    $this->assertSession()->statusCodeEquals(200);
 
     foreach (monitoring_sensor_manager()->getAllSensorConfig() as $sensor_name => $sensor_config) {
-      $this->assertEqual($response_data[$sensor_name]['sensor'], $sensor_config->id());
-      $this->assertEqual($response_data[$sensor_name]['label'], $sensor_config->getLabel());
-      $this->assertEqual($response_data[$sensor_name]['category'], $sensor_config->getCategory());
-      $this->assertEqual($response_data[$sensor_name]['description'], $sensor_config->getDescription());
-      $this->assertEqual($response_data[$sensor_name]['numeric'], $sensor_config->isNumeric());
-      $this->assertEqual($response_data[$sensor_name]['value_label'], $sensor_config->getValueLabel());
-      $this->assertEqual($response_data[$sensor_name]['caching_time'], $sensor_config->getCachingTime());
-      $this->assertEqual($response_data[$sensor_name]['time_interval'], $sensor_config->getTimeIntervalValue());
-      $this->assertEqual($response_data[$sensor_name]['enabled'], $sensor_config->isEnabled());
-      $this->assertEqual($response_data[$sensor_name]['uri'], Url::fromRoute('rest.monitoring-sensor.GET' , ['id' => $sensor_name, '_format' => 'json'])->setAbsolute()->toString());
+      $this->assertEquals($response_data[$sensor_name]['sensor'], $sensor_config->id());
+      $this->assertEquals($response_data[$sensor_name]['label'], $sensor_config->getLabel());
+      $this->assertEquals($response_data[$sensor_name]['category'], $sensor_config->getCategory());
+      $this->assertEquals($response_data[$sensor_name]['description'], $sensor_config->getDescription());
+      $this->assertEquals($response_data[$sensor_name]['numeric'], $sensor_config->isNumeric());
+      $this->assertEquals($response_data[$sensor_name]['value_label'], $sensor_config->getValueLabel());
+      $this->assertEquals($response_data[$sensor_name]['caching_time'], $sensor_config->getCachingTime());
+      $this->assertEquals($response_data[$sensor_name]['time_interval'], $sensor_config->getTimeIntervalValue());
+      $this->assertEquals($response_data[$sensor_name]['enabled'], $sensor_config->isEnabled());
+      $this->assertEquals($response_data[$sensor_name]['uri'], Url::fromRoute('rest.monitoring-sensor.GET' , ['id' => $sensor_name, '_format' => 'json'])->setAbsolute()->toString());
 
       if ($sensor_config->isDefiningThresholds()) {
-        $this->assertEqual($response_data[$sensor_name]['thresholds'], $sensor_config->getThresholds());
+        $this->assertEquals($response_data[$sensor_name]['thresholds'], $sensor_config->getThresholds());
       }
     }
 
     $sensor_name = 'sensor_that_does_not_exist';
     $this->doJsonRequest('monitoring-sensor/' . $sensor_name);
-    $this->assertResponse(404);
+    $this->assertSession()->statusCodeEquals(404);
 
     $sensor_name = 'dblog_event_severity_error';
     $response_data = $this->doJsonRequest('monitoring-sensor/' . $sensor_name);
-    $this->assertResponse(200);
+    $this->assertSession()->statusCodeEquals(200);
     $sensor_config = SensorConfig::load($sensor_name);
-    $this->assertEqual($response_data['sensor'], $sensor_config->id());
-    $this->assertEqual($response_data['label'], $sensor_config->getLabel());
-    $this->assertEqual($response_data['category'], $sensor_config->getCategory());
-    $this->assertEqual($response_data['description'], $sensor_config->getDescription());
-    $this->assertEqual($response_data['numeric'], $sensor_config->isNumeric());
-    $this->assertEqual($response_data['value_label'], $sensor_config->getValueLabel());
-    $this->assertEqual($response_data['caching_time'], $sensor_config->getCachingTime());
-    $this->assertEqual($response_data['time_interval'], $sensor_config->getTimeIntervalValue());
-    $this->assertEqual($response_data['enabled'], $sensor_config->isEnabled());
-    $this->assertEqual($response_data['uri'], Url::fromRoute('rest.monitoring-sensor.GET' , ['id' => $sensor_name, '_format' => 'json'])->setAbsolute()->toString());
+    $this->assertEquals($response_data['sensor'], $sensor_config->id());
+    $this->assertEquals($response_data['label'], $sensor_config->getLabel());
+    $this->assertEquals($response_data['category'], $sensor_config->getCategory());
+    $this->assertEquals($response_data['description'], $sensor_config->getDescription());
+    $this->assertEquals($response_data['numeric'], $sensor_config->isNumeric());
+    $this->assertEquals($response_data['value_label'], $sensor_config->getValueLabel());
+    $this->assertEquals($response_data['caching_time'], $sensor_config->getCachingTime());
+    $this->assertEquals($response_data['time_interval'], $sensor_config->getTimeIntervalValue());
+    $this->assertEquals($response_data['enabled'], $sensor_config->isEnabled());
+    $this->assertEquals($response_data['uri'], Url::fromRoute('rest.monitoring-sensor.GET' , ['id' => $sensor_name, '_format' => 'json'])->setAbsolute()->toString());
 
     if ($sensor_config->isDefiningThresholds()) {
-      $this->assertEqual($response_data['thresholds'], $sensor_config->getThresholds());
+      $this->assertEquals($response_data['thresholds'], $sensor_config->getThresholds());
     }
   }
 
@@ -94,14 +94,14 @@ class MonitoringServicesTest extends MonitoringTestBase {
 
     $sensor_name = 'dblog_event_severity_error';
     $response_data = $this->doJsonRequest('monitoring-sensor/' . $sensor_name);
-    $this->assertResponse(200);
+    $this->assertSession()->statusCodeEquals(200);
     $sensor_config = SensorConfig::load($sensor_name);
-    $this->assertEqual($response_data['label'], $sensor_config->getLabel());
+    $this->assertEquals($response_data['label'], $sensor_config->getLabel());
     $sensor_config->set('label', 'TestLabelForCaching');
     $sensor_config->save();
     $response_data = $this->doJsonRequest('monitoring-sensor/' . $sensor_name);
-    $this->assertResponse(200);
-    $this->assertEqual($response_data['label'], 'TestLabelForCaching');
+    $this->assertSession()->statusCodeEquals(200);
+    $this->assertEquals($response_data['label'], 'TestLabelForCaching');
   }
 
   /**
@@ -112,7 +112,7 @@ class MonitoringServicesTest extends MonitoringTestBase {
 
     // Test request for sensor results with expanded sensor config.
     $response_data = $this->doJsonRequest('monitoring-sensor-result', array('expand' => 'sensor'));
-    $this->assertResponse(200);
+    $this->assertSession()->statusCodeEquals(200);
     foreach (monitoring_sensor_manager()->getEnabledSensorConfig() as $sensor_name => $sensor_config) {
       $this->assertTrue(isset($response_data[$sensor_name]['sensor']));
       $this->assertSensorResult($response_data[$sensor_name], $sensor_config);
@@ -121,29 +121,28 @@ class MonitoringServicesTest extends MonitoringTestBase {
     // Try a request without expanding the sensor config and check that it is not
     // present.
     $response_data = $this->doJsonRequest('monitoring-sensor-result');
-    $this->assertResponse(200);
-    $this->assertEqual('UNCACHEABLE', $this->drupalGetHeader(DynamicPageCacheSubscriber::HEADER),
-      'Render array returned, rendered as HTML response, but uncacheable: Dynamic Page Cache is running, but not caching.');
+    $this->assertSession()->statusCodeEquals(200);
+    $this->assertEquals('UNCACHEABLE', $this->drupalGetHeader(DynamicPageCacheSubscriber::HEADER), 'Render array returned, rendered as HTML response, but uncacheable: Dynamic Page Cache is running, but not caching.');
     $sensor_result = reset($response_data);
     $this->assertTrue(!isset($sensor_result['sensor_info']));
 
     // Make sure the response contains expected count of results.
-    $this->assertEqual(count($response_data), count(monitoring_sensor_manager()->getEnabledSensorConfig()));
+    $this->assertEquals(count($response_data), count(monitoring_sensor_manager()->getEnabledSensorConfig()));
 
     // Test non existing sensor.
     $sensor_name = 'sensor_that_does_not_exist';
     $this->doJsonRequest('monitoring-sensor-result/' . $sensor_name);
-    $this->assertResponse(404);
+    $this->assertSession()->statusCodeEquals(404);
 
     // Test disabled sensor - note that monitoring_git_dirty_tree is disabled
     // by default.
     $sensor_name = 'monitoring_git_dirty_tree';
     $this->doJsonRequest('monitoring-sensor-result/' . $sensor_name);
-    $this->assertResponse(404);
+    $this->assertSession()->statusCodeEquals(404);
 
     $sensor_name = 'dblog_event_severity_error';
     $response_data = $this->doJsonRequest('monitoring-sensor-result/' . $sensor_name, array('expand' => 'sensor'));
-    $this->assertResponse(200);
+    $this->assertSession()->statusCodeEquals(200);
     // The response must contain the sensor.
     $this->assertTrue(isset($response_data['sensor']));
     $this->assertSensorResult($response_data, SensorConfig::load($sensor_name));
@@ -151,7 +150,7 @@ class MonitoringServicesTest extends MonitoringTestBase {
     // Try a request without expanding the sensor config and check that it is not
     // present.
     $response_data = $this->doJsonRequest('monitoring-sensor-result/' . $sensor_name);
-    $this->assertResponse(200);
+    $this->assertSession()->statusCodeEquals(200);
     $this->assertTrue(!isset($response_data['sensor']));
   }
 
@@ -164,25 +163,25 @@ class MonitoringServicesTest extends MonitoringTestBase {
    *   Sensor config for which we have the result.
    */
   protected function assertSensorResult($response_result, SensorConfig $sensor_config) {
-    $this->assertEqual($response_result['sensor_name'], $sensor_config->id());
-    $this->assertEqual($response_result['uri'], Url::fromRoute('rest.monitoring-sensor-result.GET' , ['id' => $sensor_config->id(), '_format' => 'json'])->setAbsolute()->toString());
+    $this->assertEquals($response_result['sensor_name'], $sensor_config->id());
+    $this->assertEquals($response_result['uri'], Url::fromRoute('rest.monitoring-sensor-result.GET' , ['id' => $sensor_config->id(), '_format' => 'json'])->setAbsolute()->toString());
 
     // If the result is cached test also for the result values. In case of
     // result which is not cached we might not get the same values.
     if ($sensor_config->getCachingTime()) {
       // Cannot use $this->runSensor() as the cache needs to remain.
       $result = monitoring_sensor_run($sensor_config->id());
-      $this->assertEqual($response_result['status'], $result->getStatus());
-      $this->assertEqual($response_result['value'], $result->getValue());
-      $this->assertEqual($response_result['expected_value'], $result->getExpectedValue());
-      $this->assertEqual($response_result['numeric_value'], $result->toNumber());
-      $this->assertEqual($response_result['message'], $result->getMessage());
-      $this->assertEqual($response_result['timestamp'], $result->getTimestamp());
-      $this->assertEqual($response_result['execution_time'], $result->getExecutionTime());
+      $this->assertEquals($response_result['status'], $result->getStatus());
+      $this->assertEquals($response_result['value'], $result->getValue());
+      $this->assertEquals($response_result['expected_value'], $result->getExpectedValue());
+      $this->assertEquals($response_result['numeric_value'], $result->toNumber());
+      $this->assertEquals($response_result['message'], $result->getMessage());
+      $this->assertEquals($response_result['timestamp'], $result->getTimestamp());
+      $this->assertEquals($response_result['execution_time'], $result->getExecutionTime());
     }
 
     if (isset($response_result['sensor_info'])) {
-      $this->assertEqual($response_result['sensor_info'], $sensor_config->toArray());
+      $this->assertEquals($response_result['sensor_info'], $sensor_config->toArray());
     }
   }
 
diff --git a/tests/src/Functional/MonitoringTestBase.php b/tests/src/Functional/MonitoringTestBase.php
index 1fd3207..d09ea31 100644
--- a/tests/src/Functional/MonitoringTestBase.php
+++ b/tests/src/Functional/MonitoringTestBase.php
@@ -16,7 +16,7 @@ abstract class MonitoringTestBase extends BrowserTestBase {
    *
    * @var array
    */
-  public static $modules = ['block', 'monitoring', 'monitoring_test'];
+  protected static $modules = ['block', 'monitoring', 'monitoring_test'];
 
   /**
    * {@inheritdoc}
@@ -26,7 +26,7 @@ abstract class MonitoringTestBase extends BrowserTestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     $this->drupalPlaceBlock('local_tasks_block');
diff --git a/tests/src/Functional/MonitoringUITest.php b/tests/src/Functional/MonitoringUITest.php
index b9d83dd..20514bb 100644
--- a/tests/src/Functional/MonitoringUITest.php
+++ b/tests/src/Functional/MonitoringUITest.php
@@ -15,12 +15,12 @@ use Drupal\user\Entity\User;
  */
 class MonitoringUITest extends MonitoringTestBase {
 
-  public static $modules = array('dblog', 'node', 'views', 'file', 'automated_cron');
+  protected static $modules = array('dblog', 'node', 'views', 'file', 'automated_cron');
 
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
     // Create the content type page in the setup as it is used by several tests.
     $this->drupalCreateContentType(array('type' => 'page'));
@@ -39,11 +39,11 @@ class MonitoringUITest extends MonitoringTestBase {
 
     // Check the form.
     $this->drupalGet('admin/config/system');
-    $this->assertText(t('Configure enabled monitoring products.'));
+    $this->assertSession()->pageTextContains(t('Configure enabled monitoring products.'));
     $this->clickLink(t('Monitoring settings'));
-    $this->assertField('sensor_call_logging');
-    $this->assertOptionSelected('edit-sensor-call-logging', 'on_request');
-    $this->assertText(t('Control local logging of sensor call results.'));
+    $this->assertSession()->fieldExists('sensor_call_logging');
+    $this->assertTrue($this->assertSession()->optionExists('edit-sensor-call-logging', 'on_request')->hasAttribute('selected'));
+    $this->assertSession()->pageTextContains(t('Control local logging of sensor call results.'));
   }
 
   /**
@@ -63,13 +63,13 @@ class MonitoringUITest extends MonitoringTestBase {
     // Test that trying to access the sensors settings page of a non-existing
     // sensor results in a page not found response.
     $this->drupalGet('admin/config/system/monitoring/sensors/non_existing_sensor');
-    $this->assertResponse(404);
+    $this->assertSession()->statusCodeEquals(404);
 
     // Tests the fields 'Sensor Plugin' & 'Entity Type' appear.
     $this->drupalGet('admin/config/system/monitoring/sensors/user_new');
-    $this->assertOptionSelected('edit-settings-entity-type', 'user');
-    $this->assertText('Sensor Plugin');
-    $this->assertText('Entity Aggregator');
+    $this->assertTrue($this->assertSession()->optionExists('edit-settings-entity-type', 'user')->hasAttribute('selected'));
+    $this->assertSession()->pageTextContains('Sensor Plugin');
+    $this->assertSession()->pageTextContains('Entity Aggregator');
 
     // Tests adding a condition to the log out sensor.
     $this->drupalGet('admin/config/system/monitoring/sensors/user_session_logouts');
@@ -77,10 +77,10 @@ class MonitoringUITest extends MonitoringTestBase {
       'conditions[2][field]' => 'severity',
       'conditions[2][value]' => 5,
     );
-    $this->drupalPostForm(NULL, $edit, t('Save'));
+    $this->submitForm($edit, t('Save'));
     $this->drupalGet('admin/config/system/monitoring/sensors/user_session_logouts');
-    $this->assertFieldByName('conditions[2][field]', 'severity');
-    $this->assertFieldByName('conditions[2][value]', 5);
+    $this->assertSession()->fieldValueEquals('conditions[2][field]', 'severity');
+    $this->assertSession()->fieldValueEquals('conditions[2][value]', 5);
   }
 
   /**
@@ -98,56 +98,59 @@ class MonitoringUITest extends MonitoringTestBase {
 
     // Visit the overview and make sure the sensor is displayed.
     $this->drupalGet('admin/reports/monitoring');
-    $this->assertText('2 druplicons in 1 day');
+    $this->assertSession()->pageTextContains('2 druplicons in 1 day');
 
     // Visit the sensor edit form.
     $this->drupalGet('admin/config/system/monitoring/sensors/entity_aggregate_test');
     // Test for the default value.
-    $this->assertFieldByName('settings[aggregation][time_interval_field]', 'created');
-    $this->assertFieldByName('settings[aggregation][time_interval_value]', 86400);
+    $this->assertSession()->fieldValueEquals('settings[aggregation][time_interval_field]', 'created');
+    $this->assertSession()->fieldValueEquals('settings[aggregation][time_interval_value]', 86400);
 
     // Visit the sensor detail page with verbose output.
     $this->drupalGet('admin/reports/monitoring/sensors/entity_aggregate_test');
     // Check that there is no Save button on the detail page.
-    $this->assertNoLink('Save');
-    $this->drupalPostForm(NULL, array(), 'Run now');
+    $this->assertSession()->linkNotExists('Save');
+    $this->submitForm(array(), 'Run now');
     // The node labels should appear in verbose output.
-    $this->assertText('label');
-    $this->assertLink($node1->getTitle());
-    $this->assertLink($node2->getTitle());
+    $this->assertSession()->pageTextContains('label');
+    $this->assertSession()->linkExists($node1->getTitle());
+    $this->assertSession()->linkExists($node2->getTitle());
 
     // Check the sensor overview to verify that the sensor result is
     // calculated and the sensor message is displayed.
     $this->drupalGet('admin/reports/monitoring');
-    $this->assertText('2 druplicons in 1 day');
+    $this->assertSession()->pageTextContains('2 druplicons in 1 day');
+    $this->drupalGet('admin/config/system/monitoring/sensors/entity_aggregate_test');
 
     // Update the time interval and set value to no restriction.
-    $this->drupalPostForm('admin/config/system/monitoring/sensors/entity_aggregate_test', array(
+    $this->submitForm(array(
       'settings[aggregation][time_interval_value]' => 0,
     ), t('Save'));
 
     // Visit the overview and make sure that no time interval is displayed.
     $this->drupalGet('admin/reports/monitoring');
-    $this->assertText('2 druplicons');
-    $this->assertNoText('2 druplicons in');
+    $this->assertSession()->pageTextContains('2 druplicons');
+    $this->assertSession()->pageTextNotContains('2 druplicons in');
+    $this->drupalGet('admin/config/system/monitoring/sensors/entity_aggregate_test');
 
     // Update the time interval and empty interval field.
-    $this->drupalPostForm('admin/config/system/monitoring/sensors/entity_aggregate_test', array(
+    $this->submitForm(array(
       'settings[aggregation][time_interval_field]' => '',
       'settings[aggregation][time_interval_value]' => 86400,
     ), t('Save'));
     // Visit the overview and make sure that no time interval is displayed
     // which also make sures no change in time interval applies.
     $this->drupalGet('admin/reports/monitoring');
-    $this->assertText('2 druplicons');
-    $this->assertNoText('2 druplicons in');
+    $this->assertSession()->pageTextContains('2 druplicons');
+    $this->assertSession()->pageTextNotContains('2 druplicons in');
+    $this->drupalGet('admin/config/system/monitoring/sensors/entity_aggregate_test');
 
     // Update the time interval field with an invalid value.
-    $this->drupalPostForm('admin/config/system/monitoring/sensors/entity_aggregate_test', array(
+    $this->submitForm(array(
       'settings[aggregation][time_interval_field]' => 'invalid-field',
     ), t('Save'));
     // Assert the error message.
-    $this->assertText('The specified time interval field invalid-field does not exist or is not type timestamp.');
+    $this->assertSession()->pageTextContains('The specified time interval field invalid-field does not exist or is not type timestamp.');
   }
 
   /**
@@ -156,9 +159,9 @@ class MonitoringUITest extends MonitoringTestBase {
   public function testSensorOverviewPage() {
     // Check access for the overviews.
     $this->drupalGet('admin/reports/monitoring');
-    $this->assertResponse(403);
+    $this->assertSession()->statusCodeEquals(403);
     $this->drupalGet('admin/reports/monitoring/log');
-    $this->assertResponse(403);
+    $this->assertSession()->statusCodeEquals(403);
     $account = $this->drupalCreateUser(array('monitoring reports'));
     $this->drupalLogin($account);
 
@@ -179,16 +182,16 @@ class MonitoringUITest extends MonitoringTestBase {
 
     // Test if the Test sensor is listed as the oldest cached. We do not test
     // for the cached time as such test contains a risk of random fail.
-    $this->assertRaw(new FormattableMarkup('Sensor %sensor (%category) cached before', array('%sensor' => 'Test sensor', '%category' => 'Test')));
+    $this->assertSession()->responseContains(new FormattableMarkup('Sensor %sensor (%category) cached before', array('%sensor' => 'Test sensor', '%category' => 'Test')));
 
     // Assert if .js & .css are loaded.
-    $this->assertRaw('monitoring.js');
-    $this->assertRaw('monitoring.css');
+    $this->assertSession()->responseContains('monitoring.js');
+    $this->assertSession()->responseContains('monitoring.css');
 
     // Test the action buttons are clickable.
-    $this->assertLink(t('Details'));
-    $this->assertLink(t('Edit'));
-    $this->assertLink(t('Details'));
+    $this->assertSession()->linkExists(t('Details'));
+    $this->assertSession()->linkExists(t('Edit'));
+    $this->assertSession()->linkExists(t('Details'));
 
     // Test the overview table.
     $rows = $this->getSession()->getPage()->findAll('css', '#monitoring-sensors-overview tbody tr');
@@ -207,15 +210,15 @@ class MonitoringUITest extends MonitoringTestBase {
 
     // Test the global sensor log.
     $this->clickLink(t('Log'));
-    $this->assertText('test_sensor');
-    $this->assertText(t('OK'));
-    $this->assertText(t('No value'));
-    $this->assertRaw('class="monitoring-ok"');
-    $this->assertRaw('It is highly recommended that you configure this.');
-    $this->assertRaw('See Protecting against HTTP HOST Header attacks');
+    $this->assertSession()->pageTextContains('test_sensor');
+    $this->assertSession()->pageTextContains(t('OK'));
+    $this->assertSession()->pageTextContains(t('No value'));
+    $this->assertSession()->responseContains('class="monitoring-ok"');
+    $this->assertSession()->responseContains('It is highly recommended that you configure this.');
+    $this->assertSession()->responseContains('See Protecting against HTTP HOST Header attacks');
     $this->clickLink('test_sensor');
-    $this->assertResponse(200);
-    $this->assertUrl(SensorConfig::load('test_sensor')->toUrl('details-form'));
+    $this->assertSession()->statusCodeEquals(200);
+    $this->assertSession()->addressEquals(SensorConfig::load('test_sensor')->toUrl('details-form'));
   }
 
   /**
@@ -232,32 +235,32 @@ class MonitoringUITest extends MonitoringTestBase {
 
     $sensor_config = SensorConfig::load('entity_aggregate_test');
     $this->drupalGet('admin/reports/monitoring/sensors/entity_aggregate_test');
-    $this->assertTitle(t('@label (@category) | Drupal', array('@label' => $sensor_config->getLabel(), '@category' => $sensor_config->getCategory())));
+    $this->assertSession()->titleEquals($sensor_config->getLabel() . ' (' . $sensor_config->getCategory() . ') | Drupal');
 
     // Make sure that all relevant information is displayed.
     // @todo: Assert position/order.
     // Cannot use $this->runSensor() as the cache needs to remain.
     $result = monitoring_sensor_run('entity_aggregate_test');
-    $this->assertText(t('Description'));
-    $this->assertText($sensor_config->getDescription());
-    $this->assertText(t('Status'));
-    $this->assertText('Warning');
-    $this->assertText(t('Message'));
-    $this->assertText('1 druplicons in 1 day, falls below 2');
-    $this->assertText(t('Execution time'));
+    $this->assertSession()->pageTextContains(t('Description'));
+    $this->assertSession()->pageTextContains($sensor_config->getDescription());
+    $this->assertSession()->pageTextContains(t('Status'));
+    $this->assertSession()->pageTextContains('Warning');
+    $this->assertSession()->pageTextContains(t('Message'));
+    $this->assertSession()->pageTextContains('1 druplicons in 1 day, falls below 2');
+    $this->assertSession()->pageTextContains(t('Execution time'));
     // The sensor is cached, so we have the same cached execution time.
-    $this->assertText($result->getExecutionTime() . 'ms');
-    $this->assertText(t('Cache information'));
-    $this->assertText('Executed now, valid for 1 hour');
-    $this->assertRaw(t('Run again'));
+    $this->assertSession()->pageTextContains($result->getExecutionTime() . 'ms');
+    $this->assertSession()->pageTextContains(t('Cache information'));
+    $this->assertSession()->pageTextContains('Executed now, valid for 1 hour');
+    $this->assertSession()->responseContains(t('Run again'));
 
-    $this->assertText(t('Verbose'));
+    $this->assertSession()->pageTextContains(t('Verbose'));
 
-    $this->assertText(t('Settings'));
+    $this->assertSession()->pageTextContains(t('Settings'));
     // @todo Add asserts about displayed settings once we display them in a
     //   better way.
 
-    $this->assertText(t('Log'));
+    $this->assertSession()->pageTextContains(t('Log'));
 
     $rows = $this->getSession()->getPage()->findAll('css', '#edit-sensor-log tbody tr');
     $this->assertEquals(1, count($rows));
@@ -266,9 +269,9 @@ class MonitoringUITest extends MonitoringTestBase {
 
     // Create another node and run again.
     $node = $this->drupalCreateNode(array('promote' => '1'));
-    $this->drupalPostForm(NULL, array(), t('Run again'));
-    $this->assertText('OK');
-    $this->assertText('2 druplicons in 1 day');
+    $this->submitForm(array(), t('Run again'));
+    $this->assertSession()->pageTextContains('OK');
+    $this->assertSession()->pageTextContains('2 druplicons in 1 day');
 
     $rows = $this->getSession()->getPage()->findAll('css', '#edit-sensor-log tbody tr');
     $this->assertEquals(2, count($rows));
@@ -279,43 +282,43 @@ class MonitoringUITest extends MonitoringTestBase {
 
     // Refresh the page, this not run the sensor again.
     $this->drupalGet('admin/reports/monitoring/sensors/entity_aggregate_test');
-    $this->assertText('OK');
-    $this->assertText('2 druplicons in 1 day');
-    $this->assertText(t('Verbose output is not available for cached sensor results. Click force run to see verbose output.'));
+    $this->assertSession()->pageTextContains('OK');
+    $this->assertSession()->pageTextContains('2 druplicons in 1 day');
+    $this->assertSession()->pageTextContains(t('Verbose output is not available for cached sensor results. Click force run to see verbose output.'));
     $rows = $this->getSession()->getPage()->findAll('css', '#edit-sensor-log tbody tr');
     $this->assertEquals(2, count($rows));
 
 
     // Test the verbose output.
-    $this->drupalPostForm(NULL, array(), t('Run now'));
+    $this->submitForm(array(), t('Run now'));
     // Check that the verbose output is displayed.
-    $this->assertText('Verbose');
-    $this->assertText('id');
-    $this->assertText('label');
-    $this->assertText($node->getTitle());
+    $this->assertSession()->pageTextContains('Verbose');
+    $this->assertSession()->pageTextContains('id');
+    $this->assertSession()->pageTextContains('label');
+    $this->assertSession()->pageTextContains($node->getTitle());
 
     // Check the if the sensor message includes value type.
     $this->drupalGet('admin/reports/monitoring/sensors/core_cron_safe_threshold');
-    $this->assertText('FALSE');
+    $this->assertSession()->pageTextContains('FALSE');
 
     // Test that accessing a disabled or nisot-existing sensor results in an
     // access denied and a page not found response.
     monitoring_sensor_manager()->disableSensor('test_sensor');
     $this->drupalGet('admin/reports/monitoring/sensors/test_sensor');
-    $this->assertResponse(403);
+    $this->assertSession()->statusCodeEquals(403);
 
     $this->drupalGet('admin/reports/monitoring/sensors/non_existing_sensor');
-    $this->assertResponse(404);
+    $this->assertSession()->statusCodeEquals(404);
 
     // Test user integrity sensor detail page.
     /** @var User $account */
     $account = User::load($account->id());
     $this->drupalGet('admin/reports/monitoring/sensors/user_integrity');
-    $this->assertText('1 privileged user(s)');
+    $this->assertSession()->pageTextContains('1 privileged user(s)');
 
     // Check that is not showing the query or the query arguments.
-    $this->assertNoText(t('Query'));
-    $this->assertNoText(t('Arguments'));
+    $this->assertSession()->pageTextNotContains(t('Query'));
+    $this->assertSession()->pageTextNotContains(t('Arguments'));
 
     // Test the timestamp is formatted correctly.
     $expected_time = \Drupal::service('date.formatter')->format($account->getCreatedTime(), 'short');
@@ -324,25 +327,25 @@ class MonitoringUITest extends MonitoringTestBase {
     $assert_session->elementContains('css', '#all_users_with_privileged_access tbody td:nth-child(4)', $expected_time);
 
     // Assert None output when we don't have restricted roles with permissions.
-    $this->assertText('List of roles with restricted permissions');
-    $this->assertText('None');
+    $this->assertSession()->pageTextContains('List of roles with restricted permissions');
+    $this->assertSession()->pageTextContains('None');
 
     $test_user = $this->drupalCreateUser(array('administer monitoring'), 'test_user');
     $test_user->save();
     $this->drupalLogin($test_user);
     $this->runSensor('user_integrity');
     $this->drupalGet('admin/reports/monitoring/sensors/user_integrity');
-    $this->assertText('2 privileged user(s), 1 new user(s)');
+    $this->assertSession()->pageTextContains('2 privileged user(s), 1 new user(s)');
 
     // Grant restricted permission to authenticated users.
     user_role_grant_permissions('authenticated', array('administer account settings'));
 
     // Run the sensor to check verbose output.
-    $this->drupalPostForm(NULL, array(), t('Run now'));
+    $this->submitForm(array(), t('Run now'));
 
     // Check restricted permissions of Authenticated users.
-    $this->assertText('List of roles with restricted permissions');
-    $this->assertText('Authenticated user: administer account settings');
+    $this->assertSession()->pageTextContains('List of roles with restricted permissions');
+    $this->assertSession()->pageTextContains('Authenticated user: administer account settings');
 
     // Check table of users with privileged access.
     $expected_header = [
@@ -352,7 +355,7 @@ class MonitoringUITest extends MonitoringTestBase {
       'Last accessed',
     ];
 
-    $this->assertText('All users with privileged access');
+    $this->assertSession()->pageTextContains('All users with privileged access');
     $rows = $page->findAll('css', '#all_users_with_privileged_access tbody tr');
     $this->assertEquals(3, count($rows));
     $assert_session->elementContains('css', '#all_users_with_privileged_access thead th:nth-child(1)', $expected_header[0]);
@@ -365,46 +368,51 @@ class MonitoringUITest extends MonitoringTestBase {
     $assert_session->elementContains('css', '#all_users_with_privileged_access tbody tr:nth-child(2) td:nth-child(2)', implode(', ', $account->getRoles()));
 
     // Check the new user name in verbose output.
-    $this->assertText('test_user');
+    $this->assertSession()->pageTextContains('test_user');
+    $this->drupalGet('admin/config/system/monitoring/sensors/user_integrity');
     // Reset the user data and run the sensor again.
-    $this->drupalPostForm('admin/config/system/monitoring/sensors/user_integrity', array(), t('Reset user data'));
+    $this->submitForm(array(), t('Reset user data'));
     $this->runSensor('user_integrity');
     $this->drupalGet('admin/reports/monitoring/sensors/user_integrity');
-    $this->assertText('2 privileged user(s)');
+    $this->assertSession()->pageTextContains('2 privileged user(s)');
 
     // Change user data and run sensor.
     $test_user->setUsername('changed_name');
     $test_user->save();
     $this->runSensor('user_integrity');
     $this->drupalGet('admin/reports/monitoring/sensors/user_integrity');
-    $this->assertText('3 privileged user(s), 1 changed user(s)');
+    $this->assertSession()->pageTextContains('3 privileged user(s), 1 changed user(s)');
+    $this->drupalGet('admin/config/system/monitoring/sensors/user_integrity');
 
     // Reset user data again and check sensor message.
-    $this->drupalPostForm('admin/config/system/monitoring/sensors/user_integrity', array(), t('Reset user data'));
+    $this->submitForm(array(), t('Reset user data'));
     $this->runSensor('user_integrity');
     $this->drupalGet('admin/reports/monitoring/sensors/user_integrity');
-    $this->assertText('2 privileged user(s)');
+    $this->assertSession()->pageTextContains('2 privileged user(s)');
 
     // Check the list of deleted users.
     $account->delete();
-    $this->drupalPostForm('admin/reports/monitoring/sensors/user_integrity', array(), t('Run now'));
-    $this->assertText('Deleted users with privileged access');
+    $this->drupalGet('admin/reports/monitoring/sensors/user_integrity');
+    $this->submitForm(array(), t('Run now'));
+    $this->assertSession()->pageTextContains('Deleted users with privileged access');
 
     // Assert the deleted user is listed.
     $assert_session->elementContains('css', '#deleted_users_with_privileged_access tbody tr:nth-child(1) td:nth-child(1)', 'integrity_test_user');
+    $this->drupalGet('admin/config/system/monitoring/sensors/user_integrity');
 
     // Test enabled sensor link works after save.
-    $this->drupalPostForm('admin/config/system/monitoring/sensors/user_integrity', array(), 'Save');
+    $this->submitForm(array(), 'Save');
     $this->clickLink('Privileged user integrity');
-    $this->assertResponse(200);
-    $this->assertUrl('admin/reports/monitoring/sensors/user_integrity');
+    $this->assertSession()->statusCodeEquals(200);
+    $this->assertSession()->addressEquals('admin/reports/monitoring/sensors/user_integrity');
 
     // Test disabled sensor link works and redirect to edit page.
     monitoring_sensor_manager()->disableSensor('user_integrity');
-    $this->drupalPostForm('admin/config/system/monitoring/sensors/user_integrity', array(), 'Save');
+    $this->drupalGet('admin/config/system/monitoring/sensors/user_integrity');
+    $this->submitForm(array(), 'Save');
     $this->clickLink('Privileged user integrity');
-    $this->assertResponse(200);
-    $this->assertUrl('admin/config/system/monitoring/sensors/user_integrity');
+    $this->assertSession()->statusCodeEquals(200);
+    $this->assertSession()->addressEquals('admin/config/system/monitoring/sensors/user_integrity');
   }
 
   /**
@@ -417,41 +425,41 @@ class MonitoringUITest extends MonitoringTestBase {
     // Visit the edit page of "core theme default" (config value sensor)
     // and make sure the expected and current values are displayed.
     $this->drupalGet('admin/config/system/monitoring/sensors/core_theme_default');
-    $this->assertText('The expected value of config system.theme:default, current value: ' . $this->config('system.theme')->get('default'));
+    $this->assertSession()->pageTextContains('The expected value of config system.theme:default, current value: ' . $this->config('system.theme')->get('default'));
 
 
     // Visit the edit page of "core maintainance mode" (state value sensor)
     // and make sure the expected and current values are displayed.
     $this->drupalGet('admin/config/system/monitoring/sensors/core_maintenance_mode');
-    $this->assertText('The expected value of state system.maintenance_mode, current value: FALSE');
+    $this->assertSession()->pageTextContains('The expected value of state system.maintenance_mode, current value: FALSE');
     // Make sure delete link is not available for this sensor.
-    $this->assertNoLink(t('Delete'));
+    $this->assertSession()->linkNotExists(t('Delete'));
     // Make sure details page is available for an enabled sensor.
-    $this->assertLink('Details');
+    $this->assertSession()->linkExists('Details');
 
     // Test the checkbox in edit sensor settings for the bool sensor
     // Cron safe threshold enabled/disabled.
     $this->drupalGet('admin/config/system/monitoring/sensors/core_cron_safe_threshold');
     // Make sure delete action available for this sensor.
-    $this->assertLink(t('Delete'));
-    $this->assertNoFieldChecked('edit-settings-value');
-    $this->drupalPostForm(NULL, array('settings[value]' => 'Checked'), t('Save'));
+    $this->assertSession()->linkExists(t('Delete'));
+    $this->assertSession()->checkboxNotChecked('edit-settings-value');
+    $this->submitForm(array('settings[value]' => 'Checked'), t('Save'));
 
     $this->drupalGet('admin/config/system/monitoring/sensors/core_cron_safe_threshold');
-    $this->assertFieldChecked('edit-settings-value');
+    $this->assertSession()->checkboxChecked('edit-settings-value');
 
     // Test whether the details page is available.
-    $this->assertLink(t('Details'));
+    $this->assertSession()->linkExists(t('Details'));
     $this->clickLink(t('Details'));
-    $this->assertText('Result');
+    $this->assertSession()->pageTextContains('Result');
 
-    $this->assertLink(t('Edit'));
+    $this->assertSession()->linkExists(t('Edit'));
     $this->clickLink(t('Edit'));
-    $this->assertText('Sensor plugin settings');
+    $this->assertSession()->pageTextContains('Sensor plugin settings');
 
     // Test detail page is not available for a disabled sensor.
     $this->drupalGet('admin/config/system/monitoring/sensors/node_new_all');
-    $this->assertNoLink('Details');
+    $this->assertSession()->linkNotExists('Details');
 
   }
 
@@ -469,7 +477,7 @@ class MonitoringUITest extends MonitoringTestBase {
     \Drupal::state()->set('monitoring_test.sensor_result_data', $test_sensor_result_data);
 
     $this->drupalGet('admin/reports/monitoring');
-    $this->assertText('First message');
+    $this->assertSession()->pageTextContains('First message');
 
     // Update the sensor message.
     $test_sensor_result_data['sensor_message'] = 'Second message';
@@ -478,12 +486,12 @@ class MonitoringUITest extends MonitoringTestBase {
     // Access the page again, we should still see the first message because the
     // cached result is returned.
     $this->drupalGet('admin/reports/monitoring');
-    $this->assertText('First message');
+    $this->assertSession()->pageTextContains('First message');
 
     // Force sensor execution, the changed message should be displayed now.
     $this->clickLink(t('Force execute all'));
-    $this->assertNoText('First message');
-    $this->assertText('Second message');
+    $this->assertSession()->pageTextNotContains('First message');
+    $this->assertSession()->pageTextContains('Second message');
 
     // Update the sensor message again.
     $test_sensor_result_data['sensor_message'] = 'Third message';
@@ -491,10 +499,10 @@ class MonitoringUITest extends MonitoringTestBase {
 
     // Simulate a click on Force execution, there are many of those so we just
     // verify that such links exist and visit the path manually.
-    $this->assertLink(t('Force execution'));
+    $this->assertSession()->linkExists(t('Force execution'));
     $this->drupalGet('monitoring/sensors/force/test_sensor');
-    $this->assertNoText('Second message');
-    $this->assertText('Third message');
+    $this->assertSession()->pageTextNotContains('Second message');
+    $this->assertSession()->pageTextContains('Third message');
 
   }
 
@@ -506,25 +514,25 @@ class MonitoringUITest extends MonitoringTestBase {
     $this->drupalLogin($account);
 
     $this->drupalGet('admin/reports/monitoring/sensors/core_requirements_system');
-    $this->assertNoText('Array');
-    $this->assertText('Run cron');
-    $this->assertText('more information');
+    $this->assertSession()->elementNotContains('css', '#edit-verbose table', 'Array');
+    $this->assertSession()->pageTextContains('Run cron');
+    $this->assertSession()->pageTextContains('more information');
 
     $this->drupalGet('admin/config/system/monitoring/sensors/core_requirements_system');
 
     // Verify the current keys to exclude.
-    $this->assertText('cron');
+    $this->assertSession()->pageTextContains('cron');
 
     // Change the excluded keys.
-    $this->drupalPostForm(NULL, array(
+    $this->submitForm(array(
       'settings[exclude_keys]' => 'requirement_excluded',
     ), t('Save'));
 
-    $this->assertText(new FormattableMarkup('Sensor @label saved.', array('@label' => 'Module system')));
+    $this->assertSession()->pageTextContains(new FormattableMarkup('Sensor @label saved.', array('@label' => 'Module system')));
     $this->drupalGet('admin/config/system/monitoring/sensors/core_requirements_system');
     // Verify the change in excluded keys.
-    $this->assertText('requirement_excluded');
-    $this->assertNoText('cron');
+    $this->assertSession()->pageTextContains('requirement_excluded');
+    $this->assertSession()->pageTextNotContains('cron');
 
     // Test the 'Ignore' link to exclude a required sensor key.
     $this->drupalGet('admin/reports/monitoring/sensors/core_requirements_system');
@@ -532,7 +540,7 @@ class MonitoringUITest extends MonitoringTestBase {
     $this->clickLink(t('Ignore'), 0);
 
     // Assert drupal_set_message for successful excluded sensor key.
-    $this->assertText(t('Added the sensor @label (@key) into the excluded list.',
+    $this->assertSession()->pageTextContains(t('Added the sensor @label (@key) into the excluded list.',
       array('@label' => 'Module system', '@key' => 'drupal')
     ));
     $this->assertFieldByXPath('//details/table/tbody/tr[1]/td[2]', 'Yes');
@@ -544,12 +552,12 @@ class MonitoringUITest extends MonitoringTestBase {
 
     // Test the 'Unignore' link to re-include a required sensor key.
     $this->drupalGet('admin/reports/monitoring/sensors/core_requirements_system');
-    $this->drupalPostForm(NULL, array(), 'Run now');
+    $this->submitForm(array(), 'Run now');
     $this->assertFieldByXPath('//details/table/tbody/tr[1]/td[2]', 'Yes');
     $this->clickLink(t('Unignore'), 0);
 
     // Assert drupal_set_message for successful re-included sensor key.
-    $this->assertText(t('Removed the sensor @label (@key) from the excluded list.',
+    $this->assertSession()->pageTextContains(t('Removed the sensor @label (@key) from the excluded list.',
       array('@label' => 'Module system', '@key' => 'drupal')
     ));
     $this->assertFieldByXPath('//details/table/tbody/tr[1]/td[2]', '');
@@ -602,13 +610,13 @@ class MonitoringUITest extends MonitoringTestBase {
 
     // We should have the message that no sensors are missing.
     $this->drupalGet('admin/config/system/monitoring/sensors/monitoring_disappeared_sensors');
-    $this->assertNoText(t('This action will clear the missing sensors and the critical sensor status will go away.'));
+    $this->assertSession()->pageTextNotContains(t('This action will clear the missing sensors and the critical sensor status will go away.'));
 
     // Disable sensor and the ininstall comment module. This is the correct
     // procedure and therefore there should be no missing sensors.
     monitoring_sensor_manager()->disableSensor('comment_new');
     $this->drupalGet('admin/config/system/monitoring/sensors/monitoring_disappeared_sensors');
-    $this->assertNoText(t('This action will clear the missing sensors and the critical sensor status will go away.'));
+    $this->assertSession()->pageTextNotContains(t('This action will clear the missing sensors and the critical sensor status will go away.'));
 
     // Install comment module and the comment_new sensor.
     $this->installModules(array('comment'));
@@ -618,14 +626,14 @@ class MonitoringUITest extends MonitoringTestBase {
     // Run the monitoring_disappeared_sensors sensor to get the status message
     // that should be found in the settings form.
     $this->drupalGet('admin/config/system/monitoring/sensors/monitoring_disappeared_sensors');
-    $this->assertText('Missing sensor comment_new');
+    $this->assertSession()->pageTextContains('Missing sensor comment_new');
 
     // Now reset the sensor list - we should get the "no missing sensors"
     // message.
-    $this->drupalPostForm(NULL, array(), t('Clear missing sensors'));
-    $this->assertText(t('All missing sensors have been cleared.'));
+    $this->submitForm(array(), t('Clear missing sensors'));
+    $this->assertSession()->pageTextContains(t('All missing sensors have been cleared.'));
     $this->drupalGet('admin/config/system/monitoring/sensors/monitoring_disappeared_sensors');
-    $this->assertNoText('Missing sensor comment_new');
+    $this->assertSession()->pageTextNotContains('Missing sensor comment_new');
   }
 
   /**
@@ -637,7 +645,7 @@ class MonitoringUITest extends MonitoringTestBase {
 
     // Check if we can access the sensor overview page.
     $this->drupalGet('admin/config/system/monitoring/sensors');
-    $this->assertLink('Add Sensor');
+    $this->assertSession()->linkExists('Add Sensor');
 
     $sensors = count(SensorConfig::loadMultiple());
     $limit = 51;
@@ -656,7 +664,7 @@ class MonitoringUITest extends MonitoringTestBase {
     $this->drupalGet('admin/config/system/monitoring/sensors');
 
     // Check that all the rows are listed.
-    $this->assertEqual(count($this->xpath('//tbody/tr')), $limit);
+    $this->assertEquals(count($this->xpath('//tbody/tr')), $limit);
   }
 
   /**
@@ -676,7 +684,8 @@ class MonitoringUITest extends MonitoringTestBase {
       $form_field_name = 'thresholds[' . $key . ']';
       $data[$form_field_name] = $value;
     }
-    $this->drupalPostForm('admin/config/system/monitoring/sensors/' . $sensor_config->id(), $data, t('Save'));
+    $this->drupalGet('admin/config/system/monitoring/sensors/' . $sensor_config->id());
+    $this->submitForm($data, t('Save'));
   }
 
   /**
@@ -692,10 +701,11 @@ class MonitoringUITest extends MonitoringTestBase {
   protected function assertThresholdSettingsUIDefaults($sensor_name, $thresholds) {
     $sensor_config = SensorConfig::load($sensor_name);
     $this->drupalGet('admin/config/system/monitoring/sensors/' . $sensor_name);
-    $this->assertTitle(t('@label settings (@category) | Drupal', array('@label' => $sensor_config->getLabel(), '@category' => $sensor_config->getCategory())));
+    $this->assertSession()->titleEquals($sensor_config->getLabel() . ' settings (' . $sensor_config->getCategory() . ') | Drupal');
+
     foreach ($thresholds as $key => $value) {
       $form_field_name = 'thresholds[' . $key . ']';
-      $this->assertFieldByName($form_field_name, $value);
+      $this->assertSession()->fieldValueEquals($form_field_name, $value);
     }
   }
 
@@ -709,7 +719,7 @@ class MonitoringUITest extends MonitoringTestBase {
       'warning' => 6,
     );
     $this->submitThresholdSettings('test_sensor_exceeds', $thresholds);
-    $this->assertText(new FormattableMarkup('Sensor @label saved.', array('@label' => 'Test sensor exceeds')));
+    $this->assertSession()->pageTextContains(new FormattableMarkup('Sensor @label saved.', array('@label' => 'Test sensor exceeds')));
     $this->assertThresholdSettingsUIDefaults('test_sensor_exceeds', $thresholds);
 
     // Make sure that it is possible to save empty thresholds.
@@ -718,7 +728,7 @@ class MonitoringUITest extends MonitoringTestBase {
       'warning' => '',
     );
     $this->submitThresholdSettings('test_sensor_exceeds', $thresholds);
-    $this->assertText(new FormattableMarkup('Sensor @label saved.', array('@label' => 'Test sensor exceeds')));
+    $this->assertSession()->pageTextContains(new FormattableMarkup('Sensor @label saved.', array('@label' => 'Test sensor exceeds')));
     $this->assertThresholdSettingsUIDefaults('test_sensor_exceeds', $thresholds);
 
     monitoring_sensor_manager()->resetCache();
@@ -732,22 +742,22 @@ class MonitoringUITest extends MonitoringTestBase {
       'warning' => 10,
     );
     $this->submitThresholdSettings('test_sensor_exceeds', $thresholds);
-    $this->assertText('Warning must be lower than critical or empty.');
+    $this->assertSession()->pageTextContains('Warning must be lower than critical or empty.');
 
     $thresholds = array(
       'critical' => 5,
       'warning' => 5,
     );
     $this->submitThresholdSettings('test_sensor_exceeds', $thresholds);
-    $this->assertText('Warning must be lower than critical or empty.');
+    $this->assertSession()->pageTextContains('Warning must be lower than critical or empty.');
 
     $thresholds = array(
       'critical' => 'alphanumeric',
       'warning' => 'alphanumeric',
     );
     $this->submitThresholdSettings('test_sensor_exceeds', $thresholds);
-    $this->assertText('Warning must be a number.');
-    $this->assertText('Critical must be a number.');
+    $this->assertSession()->pageTextContains('Warning must be a number.');
+    $this->assertSession()->pageTextContains('Critical must be a number.');
 
     // Test threshold exceeds with zero values for critical.
     $thresholds = [
@@ -794,7 +804,7 @@ class MonitoringUITest extends MonitoringTestBase {
       'warning' => 11,
     );
     $this->submitThresholdSettings('test_sensor_falls', $thresholds);
-    $this->assertText(new FormattableMarkup('Sensor @label saved.', array('@label' => 'Test sensor falls')));
+    $this->assertSession()->pageTextContains(new FormattableMarkup('Sensor @label saved.', array('@label' => 'Test sensor falls')));
     $this->assertThresholdSettingsUIDefaults('test_sensor_falls', $thresholds);
 
     // Make sure that it is possible to save empty thresholds.
@@ -803,7 +813,7 @@ class MonitoringUITest extends MonitoringTestBase {
       'warning' => '',
     );
     $this->submitThresholdSettings('test_sensor_falls', $thresholds);
-    $this->assertText(new FormattableMarkup('Sensor @label saved.', array('@label' => 'Test sensor falls')));
+    $this->assertSession()->pageTextContains(new FormattableMarkup('Sensor @label saved.', array('@label' => 'Test sensor falls')));
     $this->assertThresholdSettingsUIDefaults('test_sensor_falls', $thresholds);
 
     // Test validation.
@@ -812,22 +822,22 @@ class MonitoringUITest extends MonitoringTestBase {
       'warning' => 45,
     );
     $this->submitThresholdSettings('test_sensor_falls', $thresholds);
-    $this->assertText('Warning must be higher than critical or empty.');
+    $this->assertSession()->pageTextContains('Warning must be higher than critical or empty.');
 
     $thresholds = array(
       'critical' => 5,
       'warning' => 5,
     );
     $this->submitThresholdSettings('test_sensor_falls', $thresholds);
-    $this->assertText('Warning must be higher than critical or empty.');
+    $this->assertSession()->pageTextContains('Warning must be higher than critical or empty.');
 
     $thresholds = array(
       'critical' => 'alphanumeric',
       'warning' => 'alphanumeric',
     );
     $this->submitThresholdSettings('test_sensor_falls', $thresholds);
-    $this->assertText('Warning must be a number.');
-    $this->assertText('Critical must be a number.');
+    $this->assertSession()->pageTextContains('Warning must be a number.');
+    $this->assertSession()->pageTextContains('Critical must be a number.');
 
     // Test threshold fall with zero values for critical.
     $thresholds = [
@@ -877,7 +887,7 @@ class MonitoringUITest extends MonitoringTestBase {
       'warning_high' => 15,
     );
     $this->submitThresholdSettings('test_sensor_inner', $thresholds);
-    $this->assertText(new FormattableMarkup('Sensor @label saved.', array('@label' => 'Test sensor inner')));
+    $this->assertSession()->pageTextContains(new FormattableMarkup('Sensor @label saved.', array('@label' => 'Test sensor inner')));
     $this->assertThresholdSettingsUIDefaults('test_sensor_inner', $thresholds);
 
     // Make sure that it is possible to save empty inner thresholds.
@@ -888,7 +898,7 @@ class MonitoringUITest extends MonitoringTestBase {
       'warning_high' => '',
     );
     $this->submitThresholdSettings('test_sensor_inner', $thresholds);
-    $this->assertText(new FormattableMarkup('Sensor @label saved.', array('@label' => 'Test sensor inner')));
+    $this->assertSession()->pageTextContains(new FormattableMarkup('Sensor @label saved.', array('@label' => 'Test sensor inner')));
     $this->assertThresholdSettingsUIDefaults('test_sensor_inner', $thresholds);
 
     // Test validation.
@@ -899,7 +909,7 @@ class MonitoringUITest extends MonitoringTestBase {
       'warning_high' => 20,
     );
     $this->submitThresholdSettings('test_sensor_inner', $thresholds);
-    $this->assertText('Warning low must be lower than critical low or empty.');
+    $this->assertSession()->pageTextContains('Warning low must be lower than critical low or empty.');
 
     $thresholds = array(
       'critical_low' => 5,
@@ -908,7 +918,7 @@ class MonitoringUITest extends MonitoringTestBase {
       'warning_high' => 5,
     );
     $this->submitThresholdSettings('test_sensor_inner', $thresholds);
-    $this->assertText('Warning low must be lower than warning high or empty.');
+    $this->assertSession()->pageTextContains('Warning low must be lower than warning high or empty.');
 
     $thresholds = array(
       'critical_low' => 50,
@@ -917,7 +927,7 @@ class MonitoringUITest extends MonitoringTestBase {
       'warning_high' => 100,
     );
     $this->submitThresholdSettings('test_sensor_inner', $thresholds);
-    $this->assertText('Warning low must be lower than critical low or empty.');
+    $this->assertSession()->pageTextContains('Warning low must be lower than critical low or empty.');
 
     $thresholds = array(
       'critical_low' => 'alphanumeric',
@@ -926,10 +936,10 @@ class MonitoringUITest extends MonitoringTestBase {
       'warning_high' => 'alphanumeric',
     );
     $this->submitThresholdSettings('test_sensor_inner', $thresholds);
-    $this->assertText('Warning low must be a number.');
-    $this->assertText('Warning high must be a number.');
-    $this->assertText('Critical low must be a number.');
-    $this->assertText('Critical high must be a number.');
+    $this->assertSession()->pageTextContains('Warning low must be a number.');
+    $this->assertSession()->pageTextContains('Warning high must be a number.');
+    $this->assertSession()->pageTextContains('Critical low must be a number.');
+    $this->assertSession()->pageTextContains('Critical high must be a number.');
 
     $thresholds = array(
       'critical_low' => 45,
@@ -938,7 +948,7 @@ class MonitoringUITest extends MonitoringTestBase {
       'warning_high' => 40,
     );
     $this->submitThresholdSettings('test_sensor_inner', $thresholds);
-    $this->assertText('Warning high must be higher than critical high or empty.');
+    $this->assertSession()->pageTextContains('Warning high must be higher than critical high or empty.');
     return $thresholds;
   }
 
@@ -954,7 +964,7 @@ class MonitoringUITest extends MonitoringTestBase {
       'warning_high' => 14,
     );
     $this->submitThresholdSettings('test_sensor_outer', $thresholds);
-    $this->assertText(new FormattableMarkup('Sensor @label saved.', array('@label' => 'Test sensor outer')));
+    $this->assertSession()->pageTextContains(new FormattableMarkup('Sensor @label saved.', array('@label' => 'Test sensor outer')));
     $this->assertThresholdSettingsUIDefaults('test_sensor_outer', $thresholds);
 
     // Make sure that it is possible to save empty outer thresholds.
@@ -965,7 +975,7 @@ class MonitoringUITest extends MonitoringTestBase {
       'warning_high' => '',
     );
     $this->submitThresholdSettings('test_sensor_outer', $thresholds);
-    $this->assertText(new FormattableMarkup('Sensor @label saved.', array('@label' => 'Test sensor outer')));
+    $this->assertSession()->pageTextContains(new FormattableMarkup('Sensor @label saved.', array('@label' => 'Test sensor outer')));
     $this->assertThresholdSettingsUIDefaults('test_sensor_outer', $thresholds);
 
     // Test validation.
@@ -976,7 +986,7 @@ class MonitoringUITest extends MonitoringTestBase {
       'warning_high' => 20,
     );
     $this->submitThresholdSettings('test_sensor_outer', $thresholds);
-    $this->assertText('Warning high must be lower than critical high or empty.');
+    $this->assertSession()->pageTextContains('Warning high must be lower than critical high or empty.');
 
     $thresholds = array(
       'critical_low' => 5,
@@ -985,7 +995,7 @@ class MonitoringUITest extends MonitoringTestBase {
       'warning_high' => 5,
     );
     $this->submitThresholdSettings('test_sensor_outer', $thresholds);
-    $this->assertText('Warning low must be lower than warning high or empty.');
+    $this->assertSession()->pageTextContains('Warning low must be lower than warning high or empty.');
 
     $thresholds = array(
       'critical_low' => 'alphanumeric',
@@ -994,10 +1004,10 @@ class MonitoringUITest extends MonitoringTestBase {
       'warning_high' => 'alphanumeric',
     );
     $this->submitThresholdSettings('test_sensor_outer', $thresholds);
-    $this->assertText('Warning low must be a number.');
-    $this->assertText('Warning high must be a number.');
-    $this->assertText('Critical low must be a number.');
-    $this->assertText('Critical high must be a number.');
+    $this->assertSession()->pageTextContains('Warning low must be a number.');
+    $this->assertSession()->pageTextContains('Warning high must be a number.');
+    $this->assertSession()->pageTextContains('Critical low must be a number.');
+    $this->assertSession()->pageTextContains('Critical high must be a number.');
 
     $thresholds = array(
       'critical_low' => 45,
@@ -1006,7 +1016,7 @@ class MonitoringUITest extends MonitoringTestBase {
       'warning_high' => 35,
     );
     $this->submitThresholdSettings('test_sensor_outer', $thresholds);
-    $this->assertText('Warning low must be lower than warning high or empty.');
+    $this->assertSession()->pageTextContains('Warning low must be lower than warning high or empty.');
 
     $thresholds = array(
       'critical_low' => 50,
@@ -1015,7 +1025,7 @@ class MonitoringUITest extends MonitoringTestBase {
       'warning_high' => 100,
     );
     $this->submitThresholdSettings('test_sensor_outer', $thresholds);
-    $this->assertText('Warning high must be lower than critical high or empty.');
+    $this->assertSession()->pageTextContains('Warning high must be lower than critical high or empty.');
   }
 
 }
diff --git a/tests/src/Functional/MonitoringViewDisplayTest.php b/tests/src/Functional/MonitoringViewDisplayTest.php
index df7aa48..598156b 100644
--- a/tests/src/Functional/MonitoringViewDisplayTest.php
+++ b/tests/src/Functional/MonitoringViewDisplayTest.php
@@ -11,7 +11,7 @@ use Drupal\monitoring\Entity\SensorConfig;
  */
 class MonitoringViewDisplayTest extends MonitoringTestBase {
 
-  public static $modules = array('views', 'node');
+  protected static $modules = array('views', 'node');
 
   /**
    * Tests the view display sensor.
@@ -24,36 +24,36 @@ class MonitoringViewDisplayTest extends MonitoringTestBase {
 
     // Add sensor type views display aggregator.
     $this->drupalGet('admin/config/system/monitoring/sensors/add');
-    $this->drupalPostForm(NULL, array(
+    $this->submitForm(array(
       'label' => 'All users',
       'id' => 'view_user_count',
       'plugin_id' => 'view_display_aggregator',
     ), t('Select sensor'));
     // Select view and display and save.
-    $this->assertText('Sensor plugin settings');
-    $this->drupalPostForm(NULL, array(
+    $this->assertSession()->pageTextContains('Sensor plugin settings');
+    $this->submitForm(array(
       'description' => 'Count all users through the users view.',
       'value_label' => 'Users',
       'caching_time' => 0,
       'settings[view]' => 'user_admin_people',
     ), t('Select view'));
-    $this->drupalPostForm(NULL, array(
+    $this->submitForm(array(
       'settings[display]' => 'default',
     ), t('Save'));
-    $this->assertText(new FormattableMarkup('Sensor @label saved.', array('@label' => 'All users')));
+    $this->assertSession()->pageTextContains(new FormattableMarkup('Sensor @label saved.', array('@label' => 'All users')));
 
     // Check the value type has the default value.
     $sensor_config = SensorConfig::load('view_user_count');
-    $this->assertEqual($sensor_config->getValueType(), 'number');
+    $this->assertEquals($sensor_config->getValueType(), 'number');
     // Edit and check selection.
     $this->drupalGet('admin/config/system/monitoring/sensors/view_user_count');
-    $this->assertOptionSelected('edit-settings-view', 'user_admin_people');
-    $this->assertOptionSelected('edit-settings-display', 'default');
+    $this->assertTrue($this->assertSession()->optionExists('edit-settings-view', 'user_admin_people')->hasAttribute('selected'));
+    $this->assertTrue($this->assertSession()->optionExists('edit-settings-display', 'default')->hasAttribute('selected'));
 
     // Call sensor and verify status and message.
     $result = $this->runSensor('view_user_count');
     $this->assertTrue($result->isOk());
-    $this->assertEqual($result->getMessage(), '2 users');
+    $this->assertEquals($result->getMessage(), '2 users');
 
     // Create an additional user.
     $this->drupalCreateUser();
@@ -61,7 +61,7 @@ class MonitoringViewDisplayTest extends MonitoringTestBase {
     // Call sensor and verify status and message.
     $result = $this->runSensor('view_user_count');
     $this->assertTrue($result->isOk());
-    $this->assertEqual($result->getMessage(), '3 users');
+    $this->assertEquals($result->getMessage(), '3 users');
   }
 
 }
diff --git a/tests/src/FunctionalJavascript/MonitoringUiJavascriptTest.php b/tests/src/FunctionalJavascript/MonitoringUiJavascriptTest.php
index 028678e..7406217 100644
--- a/tests/src/FunctionalJavascript/MonitoringUiJavascriptTest.php
+++ b/tests/src/FunctionalJavascript/MonitoringUiJavascriptTest.php
@@ -38,7 +38,7 @@ class MonitoringUiJavascriptTest extends WebDriverTestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
     // Create the content type page in the setup as it is used by several tests.
     $this->drupalCreateContentType(array('type' => 'page'));
@@ -104,7 +104,7 @@ class MonitoringUiJavascriptTest extends WebDriverTestBase {
       $page->pressButton('Add another field');
       $assert_session->assertWaitOnAjaxRequest();
     }
-    $this->drupalPostForm(NULL, $edit, 'Save');
+    $this->submitForm($edit, 'Save');
 
     $assert_session->pageTextContains(new FormattableMarkup('Sensor @label saved.', ['@label' => 'Node Entity Aggregator sensor']));
 
@@ -121,9 +121,9 @@ class MonitoringUiJavascriptTest extends WebDriverTestBase {
     $assert_session->linkExists($node->getTitle());
     $assert_session->linkExists($node->getOwner()->getDisplayName());
     $this->assertFalse($node->isSticky());
-    $assert_session->pageTextContains($node->uuid());
-    $assert_session->pageTextContains(\Drupal::service('date.formatter')->format($node->getCreatedTime(), 'short'));
-    $assert_session->pageTextContains(\Drupal::service('date.formatter')->format($node->getChangedTime(), 'short'));
+    $assert_session->responseContains($node->uuid());
+    $assert_session->responseContains(\Drupal::service('date.formatter')->format($node->getCreatedTime(), 'short'));
+    $assert_session->responseContains(\Drupal::service('date.formatter')->format($node->getChangedTime(), 'short'));
 
     $this->drupalGet('admin/config/system/monitoring/sensors/node_entity_aggregator_sensor');
     $this->createScreenshot("/tmp/edit.jpg");
@@ -186,7 +186,7 @@ class MonitoringUiJavascriptTest extends WebDriverTestBase {
       $page->pressButton('Add another field');
       $assert_session->assertWaitOnAjaxRequest();
     }
-    $this->drupalPostForm(NULL, $edit, 'Save');
+    $this->submitForm($edit, 'Save');
 
     $assert_session->pageTextContains(new FormattableMarkup('Sensor @label saved.', ['@label' => 'File Entity Aggregator sensor']));
 
@@ -216,7 +216,7 @@ class MonitoringUiJavascriptTest extends WebDriverTestBase {
 
     $this->drupalGet('admin/config/system/monitoring/sensors/node_entity_aggregator_sensor/delete');
     $assert_session->pageTextContains('This action cannot be undone.');
-    $this->drupalPostForm(NULL, [], 'Delete');
+    $this->submitForm([], 'Delete');
     $assert_session->pageTextContains('Node Entity Aggregator sensor has been deleted.');
 
     // Configuration sensor.
@@ -242,7 +242,7 @@ class MonitoringUiJavascriptTest extends WebDriverTestBase {
     $this->assertSession()->assertWaitOnAjaxRequest();
     $assert_session->pageTextContains('The value label represents the units of the sensor value.');
 
-    $this->drupalPostForm(NULL, [
+    $this->submitForm([
       'description' => 'Sensor created to test UI',
       'value_label' => 'Test Value',
       'caching_time' => 100,
@@ -259,7 +259,7 @@ class MonitoringUiJavascriptTest extends WebDriverTestBase {
     $this->assertTrue($option->hasAttribute('selected'));
 
     // Update sensor with a config entity.
-    $this->drupalPostForm(NULL, [
+    $this->submitForm([
       'settings[key]' => 'id',
       'settings[config]' => 'views.view.content',
     ], 'Save');
@@ -275,9 +275,10 @@ class MonitoringUiJavascriptTest extends WebDriverTestBase {
     $this->assertTrue($sensor_cron->status());
     $sensor_theme = SensorConfig::load('core_theme_default');
     $this->assertFalse($sensor_theme->status());
+    $this->drupalGet('admin/config/system/monitoring/sensors');
 
     // Change the status of these sensors.
-    $this->drupalPostForm('admin/config/system/monitoring/sensors', [
+    $this->submitForm([
       'sensors[core_cron_safe_threshold]' => FALSE,
       'sensors[core_theme_default]' => TRUE,
     ], 'Update enabled sensors');
@@ -297,11 +298,12 @@ class MonitoringUiJavascriptTest extends WebDriverTestBase {
 
     $page->selectFieldOption('Sensor Plugin', 'watchdog_aggregator');
     $assert_session->assertWaitOnAjaxRequest();
-    $this->drupalPostForm(NULL, [], 'Save');
+    $this->submitForm([], 'Save');
     $assert_session->pageTextContains('Sensor Watchdog Sensor saved');
+    $this->drupalGet('admin/config/system/monitoring/sensors/watchdog_sensor');
 
     // Edit sensor with invalid fields.
-    $this->drupalPostForm('admin/config/system/monitoring/sensors/watchdog_sensor', [
+    $this->submitForm([
       'conditions[0][field]' => 'condition_invalid',
       'verbose_fields[0][field_key]' => 'verbose_invalid',
     ], 'Save');
@@ -328,7 +330,7 @@ class MonitoringUiJavascriptTest extends WebDriverTestBase {
 
     $page->selectFieldOption('Sensor Plugin', 'entity_aggregator');
     $assert_session->assertWaitOnAjaxRequest();
-    $this->drupalPostForm(NULL, [], 'Save');
+    $this->submitForm([], 'Save');
     $assert_session->pageTextContains('Sensor Test entity id saved.');
 
     // Test that the description of the verbose output changes.
@@ -372,9 +374,10 @@ class MonitoringUiJavascriptTest extends WebDriverTestBase {
 
     // Enable the sensor.
     monitoring_sensor_manager()->enableSensor('monitoring_installed_modules');
+    $this->drupalGet('admin/config/system/monitoring/sensors/monitoring_installed_modules');
 
     // Test submitting the defaults and enabling the sensor.
-    $this->drupalPostForm('admin/config/system/monitoring/sensors/monitoring_installed_modules', [
+    $this->submitForm([
       'status' => TRUE,
     ], 'Save');
     // Reset the sensor config so that it reflects changes done via POST.
@@ -382,9 +385,10 @@ class MonitoringUiJavascriptTest extends WebDriverTestBase {
     // The sensor should now be OK.
     $result = monitoring_sensor_run('monitoring_installed_modules');
     $this->assertTrue($result->isOk());
+    $this->drupalGet('admin/config/system/monitoring/sensors/monitoring_installed_modules');
 
     // Expect the contact and book modules to be installed.
-    $this->drupalPostForm('admin/config/system/monitoring/sensors/monitoring_installed_modules', [
+    $this->submitForm([
       'settings[modules][contact]' => TRUE,
       'settings[modules][book]' => TRUE,
     ], 'Save');
@@ -404,7 +408,7 @@ class MonitoringUiJavascriptTest extends WebDriverTestBase {
     $this->drupalGet('admin/config/system/monitoring/sensors/monitoring_installed_modules');
     $page->pressButton('Update module selection');
     $this->assertSession()->assertWaitOnAjaxRequest();
-    $this->drupalPostForm(NULL, [], 'Save');
+    $this->submitForm([], 'Save');
     $result = $this->runSensor('monitoring_installed_modules');
     $this->assertTrue($result->isOk());
     $this->assertEquals('0 modules delta', $result->getMessage());
@@ -416,8 +420,9 @@ class MonitoringUiJavascriptTest extends WebDriverTestBase {
     $this->assertTrue($result->isCritical());
     $this->assertEquals('1 modules delta, expected 0, Following modules are NOT expected to be installed: Help (help)', $result->getMessage());
     $this->assertEquals(1, $result->getValue());
+    $this->drupalGet('admin/config/system/monitoring/sensors/monitoring_installed_modules');
     // Allow additional, the sensor should not escalate anymore.
-    $this->drupalPostForm('admin/config/system/monitoring/sensors/monitoring_installed_modules', [
+    $this->submitForm([
       'settings[allow_additional]' => 1,
     ], 'Save');
     $result = $this->runSensor('monitoring_installed_modules');
diff --git a/tests/src/Kernel/MonitoringApiTest.php b/tests/src/Kernel/MonitoringApiTest.php
index 4d11ced..228c391 100644
--- a/tests/src/Kernel/MonitoringApiTest.php
+++ b/tests/src/Kernel/MonitoringApiTest.php
@@ -19,12 +19,12 @@ use Drupal\monitoring\Entity\SensorConfig;
  */
 class MonitoringApiTest extends MonitoringUnitTestBase {
 
-  public static $modules = array('dblog');
+  protected static $modules = array('dblog');
 
   /**
    * {@inheritdoc}
    */
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     $this->installSchema('dblog', array('watchdog'));
   }
@@ -37,8 +37,8 @@ class MonitoringApiTest extends MonitoringUnitTestBase {
     // == Test sensor config. == //
     $sensor_config = SensorConfig::load('test_sensor_config');
 
-    $this->assertEqual($sensor_config->getLabel(), 'Test sensor config');
-    $this->assertEqual($sensor_config->getDescription(), 'To test correct sensor config hook implementation precedence.');
+    $this->assertEquals($sensor_config->getLabel(), 'Test sensor config');
+    $this->assertEquals($sensor_config->getDescription(), 'To test correct sensor config hook implementation precedence.');
     // @todo - add tests for compulsory sensor config attributes.
 
     // @todo - add tests for default values of attributes.
@@ -49,8 +49,8 @@ class MonitoringApiTest extends MonitoringUnitTestBase {
     // defined value label must be used.
     $sensor_config->value_label = 'Test label';
     $sensor_config->save();
-    $this->assertEqual($sensor_config->getValueType(), 'number');
-    $this->assertEqual($sensor_config->getValueLabel(), 'Test label');
+    $this->assertEquals($sensor_config->getValueType(), 'number');
+    $this->assertEquals($sensor_config->getValueLabel(), 'Test label');
     $this->assertTrue($sensor_config->isNumeric());
     $this->assertFalse($sensor_config->isBool());
 
@@ -60,14 +60,14 @@ class MonitoringApiTest extends MonitoringUnitTestBase {
     $sensor_config->value_label = '';
     $sensor_config->save();
     $value_types = monitoring_value_types();
-    $this->assertEqual($sensor_config->getValueLabel(), $value_types['time_interval']['value_label']);
+    $this->assertEquals($sensor_config->getValueLabel(), $value_types['time_interval']['value_label']);
     $this->assertTrue($sensor_config->isNumeric());
     $this->assertFalse($sensor_config->isBool());
 
     // Test value type without value label.
     $sensor_config->value_type = 'bool';
     $sensor_config->save();
-    $this->assertEqual($sensor_config->getValueLabel(), NULL);
+    $this->assertEquals($sensor_config->getValueLabel(), NULL);
     $this->assertFalse($sensor_config->isNumeric());
     $this->assertTrue($sensor_config->isBool());
     // == Test basic sensor infrastructure - value, status and message. == //
@@ -82,19 +82,19 @@ class MonitoringApiTest extends MonitoringUnitTestBase {
     $result = $this->runSensor('test_sensor');
 
     $this->assertTrue($result->getExecutionTime() > 0);
-    $this->assertEqual($result->getStatus(), $test_sensor_result_data['sensor_status']);
-    $this->assertEqual($result->getMessage(), 'Value 3, ' . $test_sensor_result_data['sensor_message']);
-    $this->assertEqual($result->getValue(), $test_sensor_result_data['sensor_value']);
+    $this->assertEquals($result->getStatus(), $test_sensor_result_data['sensor_status']);
+    $this->assertEquals($result->getMessage(), 'Value 3, ' . $test_sensor_result_data['sensor_message']);
+    $this->assertEquals($result->getValue(), $test_sensor_result_data['sensor_value']);
 
     // == Test sensor result cache == //
 
     // Test cached result
     $result_cached = monitoring_sensor_run('test_sensor');
     $this->assertTrue($result_cached->isCached());
-    $this->assertEqual($result_cached->getTimestamp(), \Drupal::time()->getRequestTime());
-    $this->assertEqual($result_cached->getStatus(), $test_sensor_result_data['sensor_status']);
-    $this->assertEqual($result_cached->getMessage(), 'Value 3, ' . $test_sensor_result_data['sensor_message']);
-    $this->assertEqual($result_cached->getValue(), $test_sensor_result_data['sensor_value']);
+    $this->assertEquals($result_cached->getTimestamp(), \Drupal::time()->getRequestTime());
+    $this->assertEquals($result_cached->getStatus(), $test_sensor_result_data['sensor_status']);
+    $this->assertEquals($result_cached->getMessage(), 'Value 3, ' . $test_sensor_result_data['sensor_message']);
+    $this->assertEquals($result_cached->getValue(), $test_sensor_result_data['sensor_value']);
 
     // Call a setter method to invalidate cache and reset values.
     $result_cached->setValue(5);
@@ -108,14 +108,12 @@ class MonitoringApiTest extends MonitoringUnitTestBase {
       monitoring_sensor_manager()->getSensorConfigByName('non_existing_sensor');
       $this->fail('Expected exception for non-existing sensor not thrown.');
     } catch (NonExistingSensorException $e) {
-      $this->pass('Expected exception for non-existing sensor thrown.');
     }
 
     try {
       monitoring_sensor_run('non_existing_sensor');
       $this->fail('Expected exception for non-existing sensor not thrown.');
     } catch (NonExistingSensorException $e) {
-      $this->pass('Expected exception for non-existing sensor thrown.');
     }
 
     // == Test disabled sensor. == //
@@ -128,7 +126,6 @@ class MonitoringApiTest extends MonitoringUnitTestBase {
       monitoring_sensor_run('test_sensor');
       $this->fail('Expected exception for disabled sensor not thrown.');
     } catch (DisabledSensorException $e) {
-      $this->pass('Expected exception for disabled sensor thrown.');
     }
 
     // Enable the sensor again.
@@ -146,16 +143,16 @@ class MonitoringApiTest extends MonitoringUnitTestBase {
     );
     \Drupal::state()->set('monitoring_test.sensor_result_data', $test_sensor_result_data);
     $result = monitoring_sensor_run('test_sensor_inner', TRUE);
-    $this->assertEqual($result->getStatus(), SensorResultInterface::STATUS_OK);
-    $this->assertEqual($result->getMessage(), 'Value 11');
+    $this->assertEquals($result->getStatus(), SensorResultInterface::STATUS_OK);
+    $this->assertEquals($result->getMessage(), 'Value 11');
 
     $test_sensor_result_data = array(
       'sensor_value' => 0,
     );
     \Drupal::state()->set('monitoring_test.sensor_result_data', $test_sensor_result_data);
     $result = monitoring_sensor_run('test_sensor_inner', TRUE);
-    $this->assertEqual($result->getStatus(), SensorResultInterface::STATUS_OK);
-    $this->assertEqual($result->getMessage(), 'Value 0');
+    $this->assertEquals($result->getStatus(), SensorResultInterface::STATUS_OK);
+    $this->assertEquals($result->getMessage(), 'Value 0');
 
     // Test for warning values.
     $test_sensor_result_data = array(
@@ -163,16 +160,16 @@ class MonitoringApiTest extends MonitoringUnitTestBase {
     );
     \Drupal::state()->set('monitoring_test.sensor_result_data', $test_sensor_result_data);
     $result = monitoring_sensor_run('test_sensor_inner', TRUE);
-    $this->assertEqual($result->getStatus(), SensorResultInterface::STATUS_WARNING);
-    $this->assertEqual($result->getMessage(), t('Value 7, violating the interval @expected', array('@expected' => '1 - 9')));
+    $this->assertEquals($result->getStatus(), SensorResultInterface::STATUS_WARNING);
+    $this->assertEquals($result->getMessage(), t('Value 7, violating the interval @expected', array('@expected' => '1 - 9')));
 
     $test_sensor_result_data = array(
       'sensor_value' => 2,
     );
     \Drupal::state()->set('monitoring_test.sensor_result_data', $test_sensor_result_data);
     $result = monitoring_sensor_run('test_sensor_inner', TRUE);
-    $this->assertEqual($result->getStatus(), SensorResultInterface::STATUS_WARNING);
-    $this->assertEqual($result->getMessage(), t('Value 2, violating the interval @expected', array('@expected' => '1 - 9')));
+    $this->assertEquals($result->getStatus(), SensorResultInterface::STATUS_WARNING);
+    $this->assertEquals($result->getMessage(), t('Value 2, violating the interval @expected', array('@expected' => '1 - 9')));
 
     // Test for critical values.
     $test_sensor_result_data = array(
@@ -180,16 +177,16 @@ class MonitoringApiTest extends MonitoringUnitTestBase {
     );
     \Drupal::state()->set('monitoring_test.sensor_result_data', $test_sensor_result_data);
     $result = monitoring_sensor_run('test_sensor_inner', TRUE);
-    $this->assertEqual($result->getStatus(), SensorResultInterface::STATUS_CRITICAL);
-    $this->assertEqual($result->getMessage(), t('Value 5, violating the interval @expected', array('@expected' => '4 - 6')));
+    $this->assertEquals($result->getStatus(), SensorResultInterface::STATUS_CRITICAL);
+    $this->assertEquals($result->getMessage(), t('Value 5, violating the interval @expected', array('@expected' => '4 - 6')));
 
     $test_sensor_result_data = array(
       'sensor_value' => 5,
     );
     \Drupal::state()->set('monitoring_test.sensor_result_data', $test_sensor_result_data);
     $result = monitoring_sensor_run('test_sensor_inner', TRUE);
-    $this->assertEqual($result->getStatus(), SensorResultInterface::STATUS_CRITICAL);
-    $this->assertEqual($result->getMessage(), t('Value 5, violating the interval @expected', array('@expected' => '4 - 6')));
+    $this->assertEquals($result->getStatus(), SensorResultInterface::STATUS_CRITICAL);
+    $this->assertEquals($result->getMessage(), t('Value 5, violating the interval @expected', array('@expected' => '4 - 6')));
 
     // == outer_intervals give error statuses.
 
@@ -199,16 +196,16 @@ class MonitoringApiTest extends MonitoringUnitTestBase {
     );
     \Drupal::state()->set('monitoring_test.sensor_result_data', $test_sensor_result_data);
     $result = monitoring_sensor_run('test_sensor_outer', TRUE);
-    $this->assertEqual($result->getStatus(), SensorResultInterface::STATUS_OK);
-    $this->assertEqual($result->getMessage(), 'Value 75');
+    $this->assertEquals($result->getStatus(), SensorResultInterface::STATUS_OK);
+    $this->assertEquals($result->getMessage(), 'Value 75');
 
     $test_sensor_result_data = array(
       'sensor_value' => 71,
     );
     \Drupal::state()->set('monitoring_test.sensor_result_data', $test_sensor_result_data);
     $result = monitoring_sensor_run('test_sensor_outer', TRUE);
-    $this->assertEqual($result->getStatus(), SensorResultInterface::STATUS_OK);
-    $this->assertEqual($result->getMessage(), 'Value 71');
+    $this->assertEquals($result->getStatus(), SensorResultInterface::STATUS_OK);
+    $this->assertEquals($result->getMessage(), 'Value 71');
 
     // Test for warning values.
     $test_sensor_result_data = array(
@@ -216,16 +213,16 @@ class MonitoringApiTest extends MonitoringUnitTestBase {
     );
     \Drupal::state()->set('monitoring_test.sensor_result_data', $test_sensor_result_data);
     $result = monitoring_sensor_run('test_sensor_outer', TRUE);
-    $this->assertEqual($result->getStatus(), SensorResultInterface::STATUS_WARNING);
-    $this->assertEqual($result->getMessage(), t('Value 69, outside the allowed interval @expected', array('@expected' => '70 - 80')));
+    $this->assertEquals($result->getStatus(), SensorResultInterface::STATUS_WARNING);
+    $this->assertEquals($result->getMessage(), t('Value 69, outside the allowed interval @expected', array('@expected' => '70 - 80')));
 
     $test_sensor_result_data = array(
       'sensor_value' => 65,
     );
     \Drupal::state()->set('monitoring_test.sensor_result_data', $test_sensor_result_data);
     $result = monitoring_sensor_run('test_sensor_outer', TRUE);
-    $this->assertEqual($result->getStatus(), SensorResultInterface::STATUS_WARNING);
-    $this->assertEqual($result->getMessage(), t('Value 65, outside the allowed interval @expected', array('@expected' => '70 - 80')));
+    $this->assertEquals($result->getStatus(), SensorResultInterface::STATUS_WARNING);
+    $this->assertEquals($result->getMessage(), t('Value 65, outside the allowed interval @expected', array('@expected' => '70 - 80')));
 
     // Test for critical values.
     $test_sensor_result_data = array(
@@ -233,16 +230,16 @@ class MonitoringApiTest extends MonitoringUnitTestBase {
     );
     \Drupal::state()->set('monitoring_test.sensor_result_data', $test_sensor_result_data);
     $result = monitoring_sensor_run('test_sensor_outer', TRUE);
-    $this->assertEqual($result->getStatus(), SensorResultInterface::STATUS_CRITICAL);
-    $this->assertEqual($result->getMessage(), t('Value 55, outside the allowed interval @expected', array('@expected' => '60 - 90')));
+    $this->assertEquals($result->getStatus(), SensorResultInterface::STATUS_CRITICAL);
+    $this->assertEquals($result->getMessage(), t('Value 55, outside the allowed interval @expected', array('@expected' => '60 - 90')));
 
     $test_sensor_result_data = array(
       'sensor_value' => 130,
     );
     \Drupal::state()->set('monitoring_test.sensor_result_data', $test_sensor_result_data);
     $result = monitoring_sensor_run('test_sensor_outer', TRUE);
-    $this->assertEqual($result->getStatus(), SensorResultInterface::STATUS_CRITICAL);
-    $this->assertEqual($result->getMessage(), t('Value 130, outside the allowed interval @expected', array('@expected' => '60 - 90')));
+    $this->assertEquals($result->getStatus(), SensorResultInterface::STATUS_CRITICAL);
+    $this->assertEquals($result->getMessage(), t('Value 130, outside the allowed interval @expected', array('@expected' => '60 - 90')));
 
     // == Exceeds interval gives error statuses.
 
@@ -251,24 +248,24 @@ class MonitoringApiTest extends MonitoringUnitTestBase {
     );
     \Drupal::state()->set('monitoring_test.sensor_result_data', $test_sensor_result_data);
     $result = monitoring_sensor_run('test_sensor_exceeds', TRUE);
-    $this->assertEqual($result->getStatus(), SensorResultInterface::STATUS_OK);
-    $this->assertEqual($result->getMessage(), 'Value 4');
+    $this->assertEquals($result->getStatus(), SensorResultInterface::STATUS_OK);
+    $this->assertEquals($result->getMessage(), 'Value 4');
 
     $test_sensor_result_data = array(
       'sensor_value' => 6,
     );
     \Drupal::state()->set('monitoring_test.sensor_result_data', $test_sensor_result_data);
     $result = monitoring_sensor_run('test_sensor_exceeds', TRUE);
-    $this->assertEqual($result->getStatus(), SensorResultInterface::STATUS_WARNING);
-    $this->assertEqual($result->getMessage(), t('Value 6, exceeds @expected', array('@expected' => '5')));
+    $this->assertEquals($result->getStatus(), SensorResultInterface::STATUS_WARNING);
+    $this->assertEquals($result->getMessage(), t('Value 6, exceeds @expected', array('@expected' => '5')));
 
     $test_sensor_result_data = array(
       'sensor_value' => 14,
     );
     \Drupal::state()->set('monitoring_test.sensor_result_data', $test_sensor_result_data);
     $result = monitoring_sensor_run('test_sensor_exceeds', TRUE);
-    $this->assertEqual($result->getStatus(), SensorResultInterface::STATUS_CRITICAL);
-    $this->assertEqual($result->getMessage(), t('Value 14, exceeds @expected', array('@expected' => '10')));
+    $this->assertEquals($result->getStatus(), SensorResultInterface::STATUS_CRITICAL);
+    $this->assertEquals($result->getMessage(), t('Value 14, exceeds @expected', array('@expected' => '10')));
 
     // == Falls interval gives error statuses.
 
@@ -277,24 +274,24 @@ class MonitoringApiTest extends MonitoringUnitTestBase {
     );
     \Drupal::state()->set('monitoring_test.sensor_result_data', $test_sensor_result_data);
     $result = monitoring_sensor_run('test_sensor_falls', TRUE);
-    $this->assertEqual($result->getStatus(), SensorResultInterface::STATUS_OK);
-    $this->assertEqual($result->getMessage(), 'Value 12');
+    $this->assertEquals($result->getStatus(), SensorResultInterface::STATUS_OK);
+    $this->assertEquals($result->getMessage(), 'Value 12');
 
     $test_sensor_result_data = array(
       'sensor_value' => 9,
     );
     \Drupal::state()->set('monitoring_test.sensor_result_data', $test_sensor_result_data);
     $result = monitoring_sensor_run('test_sensor_falls', TRUE);
-    $this->assertEqual($result->getStatus(), SensorResultInterface::STATUS_WARNING);
-    $this->assertEqual($result->getMessage(), t('Value 9, falls below @expected', array('@expected' => '10')));
+    $this->assertEquals($result->getStatus(), SensorResultInterface::STATUS_WARNING);
+    $this->assertEquals($result->getMessage(), t('Value 9, falls below @expected', array('@expected' => '10')));
 
     $test_sensor_result_data = array(
       'sensor_value' => 3,
     );
     \Drupal::state()->set('monitoring_test.sensor_result_data', $test_sensor_result_data);
     $result = monitoring_sensor_run('test_sensor_falls', TRUE);
-    $this->assertEqual($result->getStatus(), SensorResultInterface::STATUS_CRITICAL);
-    $this->assertEqual($result->getMessage(), t('Value 3, falls below @expected', array('@expected' => '5')));
+    $this->assertEquals($result->getStatus(), SensorResultInterface::STATUS_CRITICAL);
+    $this->assertEquals($result->getMessage(), t('Value 3, falls below @expected', array('@expected' => '5')));
 
     // Test the case when sensor value is not set.
     $test_sensor_result_data = array(
@@ -327,12 +324,12 @@ class MonitoringApiTest extends MonitoringUnitTestBase {
     $this->runSensor('test_sensor');
 
     $logs = $this->loadSensorLog('test_sensor');
-    $this->assertEqual(count($logs), 1);
+    $this->assertEquals(count($logs), 1);
     $log = array_shift($logs);
-    $this->assertEqual($log->sensor_name->value, 'test_sensor');
-    $this->assertEqual($log->sensor_status->value, SensorResultInterface::STATUS_OK);
-    $this->assertEqual($log->sensor_value->value, 1);
-    $this->assertEqual($log->sensor_message->value, 'Value 1, test message');
+    $this->assertEquals($log->sensor_name->value, 'test_sensor');
+    $this->assertEquals($log->sensor_status->value, SensorResultInterface::STATUS_OK);
+    $this->assertEquals($log->sensor_value->value, 1);
+    $this->assertEquals($log->sensor_message->value, 'Value 1, test message');
 
     // Set log_calls sensor settings to false - that should prevent logging.
     $sensor->settings['result_logging'] = FALSE;
@@ -341,7 +338,7 @@ class MonitoringApiTest extends MonitoringUnitTestBase {
     $runner = \Drupal::service('monitoring.sensor_runner');
     $runner->runSensors(array(SensorConfig::load('test_sensor')));
     $logs = $this->loadSensorLog('test_sensor');
-    $this->assertEqual(count($logs), 1);
+    $this->assertEquals(count($logs), 1);
 
     // Now change the status - that should result in the call being logged.
     $test_sensor_result_data = array(
@@ -350,9 +347,9 @@ class MonitoringApiTest extends MonitoringUnitTestBase {
     \Drupal::state()->set('monitoring_test.sensor_result_data', $test_sensor_result_data);
     $this->runSensor('test_sensor');
     $logs = $this->loadSensorLog('test_sensor');
-    $this->assertEqual(count($logs), 2);
+    $this->assertEquals(count($logs), 2);
     $log = array_pop($logs);
-    $this->assertEqual($log->sensor_status->value, SensorResultInterface::STATUS_WARNING);
+    $this->assertEquals($log->sensor_status->value, SensorResultInterface::STATUS_WARNING);
 
     // Set the logging strategy to "Log all events".
     $this->config('monitoring.settings')->set('sensor_call_logging', 'all')->save();
@@ -362,7 +359,7 @@ class MonitoringApiTest extends MonitoringUnitTestBase {
     $this->container->set('monitoring.sensor_runner', NULL);
     $this->runSensor('test_sensor');
     $logs = $this->loadSensorLog('test_sensor');
-    $this->assertEqual(count($logs), 3);
+    $this->assertEquals(count($logs), 3);
 
     // Set the logging strategy to "No logging".
     $this->config('monitoring.settings')->set('sensor_call_logging', 'none')->save();
@@ -372,7 +369,7 @@ class MonitoringApiTest extends MonitoringUnitTestBase {
     $this->container->set('monitoring.sensor_runner', NULL);
     $logs = $this->loadSensorLog('test_sensor');
     $this->runSensor('test_sensor');
-    $this->assertEqual(count($logs), 3);
+    $this->assertEquals(count($logs), 3);
 
   }
 
diff --git a/tests/src/Kernel/MonitoringCoreKernelTest.php b/tests/src/Kernel/MonitoringCoreKernelTest.php
index cfa6848..ab04819 100644
--- a/tests/src/Kernel/MonitoringCoreKernelTest.php
+++ b/tests/src/Kernel/MonitoringCoreKernelTest.php
@@ -16,7 +16,7 @@ use Drupal\node\Entity\NodeType;
  */
 class MonitoringCoreKernelTest extends MonitoringUnitTestBase {
 
-  public static $modules = [
+  protected static $modules = [
     'dblog',
     'image',
     'file',
@@ -28,7 +28,7 @@ class MonitoringCoreKernelTest extends MonitoringUnitTestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     $this->installSchema('dblog', ['watchdog']);
@@ -111,7 +111,7 @@ class MonitoringCoreKernelTest extends MonitoringUnitTestBase {
     $this->config('automated_cron.settings')->set('interval', 3600)->save();
     $result = $this->runSensor('core_cron_safe_threshold');
     $this->assertTrue($result->isCritical());
-    $this->assertEqual($result->getMessage(), 'TRUE, expected FALSE');
+    $this->assertEquals($result->getMessage(), 'TRUE, expected FALSE');
   }
 
   /**
@@ -131,7 +131,7 @@ class MonitoringCoreKernelTest extends MonitoringUnitTestBase {
 
     // Switch out of maintenance mode to continue regularly.
     \Drupal::state()->set('system.maintenance_mode', FALSE);
-    $this->assertEqual($result->getMessage(), 'TRUE, expected FALSE');
+    $this->assertEquals($result->getMessage(), 'TRUE, expected FALSE');
   }
 
   /**
@@ -157,7 +157,7 @@ class MonitoringCoreKernelTest extends MonitoringUnitTestBase {
     $queue->createItem(array());
     $queue->createItem(array());
     $result = $this->runSensor('core_queue_monitoring_test');
-    $this->assertEqual($result->getValue(), 2);
+    $this->assertEquals($result->getValue(), 2);
   }
 
   /**
@@ -182,7 +182,7 @@ class MonitoringCoreKernelTest extends MonitoringUnitTestBase {
     $message = $result->getMessage();
     $error['%file'] = str_replace(DRUPAL_ROOT . '/', '', $error['%file']);
     // Assert the message has been set and replaced successfully.
-    $this->assertEqual($message, new FormattableMarkup('2 times: %type: @message in %function (Line %line of %file).', $error));
+    $this->assertEquals($message, new FormattableMarkup('2 times: %type: @message in %function (Line %line of %file).', $error));
 
     // Prepare another fake PHP notice.
     $new_error = [
@@ -197,8 +197,8 @@ class MonitoringCoreKernelTest extends MonitoringUnitTestBase {
     $result = $this->runSensor('dblog_php_notices');
     $message = $result->getMessage();
     // Assert the message is still the one from above and not the new message.
-    $this->assertEqual($message, new FormattableMarkup('2 times: %type: @message in %function (Line %line of %file).', $error), 'The sensor message is still the old message.');
-    $this->assertNotEqual($message, new FormattableMarkup('%type: @message in %function (Line %line of %file).', $new_error), 'The sensor message is not the new message.');
+    $this->assertEquals($message, new FormattableMarkup('2 times: %type: @message in %function (Line %line of %file).', $error), 'The sensor message is still the old message.');
+    $this->assertNotEquals($message, new FormattableMarkup('%type: @message in %function (Line %line of %file).', $new_error), 'The sensor message is not the new message.');
 
     // Log the new error twice more, check it is now the sensor message.
     \Drupal::logger('php')->log($new_error['severity_level'], '%type: @message in %function (Line %line of %file).', $new_error);
@@ -207,8 +207,8 @@ class MonitoringCoreKernelTest extends MonitoringUnitTestBase {
     $message = $result->getMessage();
     $new_error['%file'] = str_replace(DRUPAL_ROOT . '/', '', $new_error['%file']);
     // Assert the new message is returned as a message.
-    $this->assertEqual($message, new FormattableMarkup('3 times: %type: @message in %function (Line %line of %file).', $new_error), 'The new message is now the sensor message.');
-    $this->assertNotEqual($message, new FormattableMarkup('2 times: %type: @message in %function (Line %line of %file).', $error), 'The old message is not the sensor message anymore.');
+    $this->assertEquals($message, new FormattableMarkup('3 times: %type: @message in %function (Line %line of %file).', $new_error), 'The new message is now the sensor message.');
+    $this->assertNotEquals($message, new FormattableMarkup('2 times: %type: @message in %function (Line %line of %file).', $error), 'The old message is not the sensor message anymore.');
   }
 
   /**
@@ -233,8 +233,8 @@ class MonitoringCoreKernelTest extends MonitoringUnitTestBase {
     // Run sensor and test the output.
     $result = $this->runSensor('dblog_404');
     $this->assertTrue($result->isOk());
-    $this->assertEqual($result->getMessage(), '1 watchdog events in 1 day, not/found');
-    $this->assertEqual($result->getValue(), 1);
+    $this->assertEquals($result->getMessage(), '1 watchdog events in 1 day, not/found');
+    $this->assertEquals($result->getValue(), 1);
 
     // Fake more 404s.
     for ($i = 1; $i <= 20; $i++) {
@@ -251,7 +251,7 @@ class MonitoringCoreKernelTest extends MonitoringUnitTestBase {
 
     // Run sensor and check the aggregate value.
     $result = $this->runSensor('dblog_404');
-    $this->assertEqual($result->getValue(), 21);
+    $this->assertEquals($result->getValue(), 21);
     $this->assertTrue($result->isWarning());
 
     // Fake more 404s.
@@ -269,7 +269,7 @@ class MonitoringCoreKernelTest extends MonitoringUnitTestBase {
 
     // Run sensor and check the aggregate value.
     $result = $this->runSensor('dblog_404');
-    $this->assertEqual($result->getValue(), 101);
+    $this->assertEquals($result->getValue(), 101);
     $this->assertTrue($result->isCritical());
   }
 
@@ -286,7 +286,7 @@ class MonitoringCoreKernelTest extends MonitoringUnitTestBase {
     $this->installConfig(['system']);
 
     // Fake some image style derivative errors.
-    $file = file_save_data($this->randomMachineName());
+    $file = \Drupal::service('file.repository')->writeData($this->randomMachineName(), 'public://');
     /** @var \Drupal\file\FileUsage\FileUsageInterface $usage */
     $usage = \Drupal::service('file.usage');
     $usage->add($file, 'monitoring_test', 'node', 123456789);
@@ -335,7 +335,7 @@ class MonitoringCoreKernelTest extends MonitoringUnitTestBase {
   public function testCoreRequirementsSensorPlugin() {
     $result = $this->runSensor('core_requirements_monitoring_test');
     $this->assertTrue($result->isOk());
-    $this->assertEqual($result->getMessage(), 'Requirements check OK');
+    $this->assertEquals($result->getMessage(), 'Requirements check OK');
 
     // Set basic requirements saying that all is OK.
     $requirements = array(
@@ -365,7 +365,7 @@ class MonitoringCoreKernelTest extends MonitoringUnitTestBase {
     $result = $this->runSensor('core_requirements_monitoring_test');
     // We expect OK status as REQUIREMENT_ERROR is set by excluded requirement.
     $this->assertTrue($result->isOk());
-    $this->assertEqual($result->getMessage(), 'requirement1, requirement1 description');
+    $this->assertEquals($result->getMessage(), 'requirement1, requirement1 description');
 
     // Add warning state.
     $requirements['requirement2'] = array(
@@ -378,7 +378,7 @@ class MonitoringCoreKernelTest extends MonitoringUnitTestBase {
     // Now the sensor escalates to the requirement in warning state.
     $result = $this->runSensor('core_requirements_monitoring_test');
     $this->assertTrue($result->isWarning());
-    $this->assertEqual($result->getMessage(), 'requirement2, requirement2 description');
+    $this->assertEquals($result->getMessage(), 'requirement2, requirement2 description');
 
     // Add error state.
     $requirements['requirement3'] = array(
@@ -391,7 +391,7 @@ class MonitoringCoreKernelTest extends MonitoringUnitTestBase {
     // Now the sensor escalates to the requirement in critical state.
     $result = $this->runSensor('core_requirements_monitoring_test');
     $this->assertTrue($result->isCritical());
-    $this->assertEqual($result->getMessage(), 'requirement3, requirement3 description');
+    $this->assertEquals($result->getMessage(), 'requirement3, requirement3 description');
 
     // Check verbose message. All output should be part of it.
     $verbose_output = $result->getVerboseOutput();
@@ -491,9 +491,9 @@ class MonitoringCoreKernelTest extends MonitoringUnitTestBase {
 
     // Run sensor for type1.
     $result = $this->runSensor('node_new_' . $type1->id());
-    $this->assertEqual($result->getValue(), 2);
+    $this->assertEquals($result->getValue(), 2);
     // Test for the ContentEntityAggregatorSensorPlugin custom message.
-    $this->assertEqual($result->getMessage(), new FormattableMarkup('@count @unit in @time_interval', array(
+    $this->assertEquals($result->getMessage(), new FormattableMarkup('@count @unit in @time_interval', array(
       '@count' => $result->getValue(),
       '@unit' => strtolower($result->getSensorConfig()->getValueLabel()),
       '@time_interval' => \Drupal::service('date.formatter')
@@ -503,7 +503,7 @@ class MonitoringCoreKernelTest extends MonitoringUnitTestBase {
 
     // Run sensor for all types.
     $result = $this->runSensor('node_new_all');
-    $this->assertEqual($result->getValue(), 3);
+    $this->assertEquals($result->getValue(), 3);
 
     // Verify that hooks do not break when sensors unexpectedly do exist or
     // don't exist.
@@ -563,7 +563,7 @@ class MonitoringCoreKernelTest extends MonitoringUnitTestBase {
     // Run sensor and test the output.
     $severities = monitoring_event_severities();
     $result = $this->runSensor('dblog_event_severity_' . $severities[RfcLogLevel::ALERT]);
-    $this->assertEqual($result->getValue(), 1);
+    $this->assertEquals($result->getValue(), 1);
   }
 
   /**
@@ -581,8 +581,8 @@ class MonitoringCoreKernelTest extends MonitoringUnitTestBase {
 
     // Run sensor and test the output.
     $result = $this->runSensor('user_failed_logins');
-    $this->assertEqual($result->getValue(), 5);
-    $this->assertEqual($result->getMessage(), '5 login attempts in 1 day, user2: 3, user1: 2');
+    $this->assertEquals($result->getValue(), 5);
+    $this->assertEquals($result->getMessage(), '5 login attempts in 1 day, user2: 3, user1: 2');
   }
 
   /**
@@ -598,8 +598,8 @@ class MonitoringCoreKernelTest extends MonitoringUnitTestBase {
 
     // Run sensor and test the output.
     $result = $this->runSensor('user_session_logouts');
-    $this->assertEqual($result->getValue(), 3);
-    $this->assertEqual($result->getMessage(), '3 logouts in 1 day');
+    $this->assertEquals($result->getValue(), 3);
+    $this->assertEquals($result->getMessage(), '3 logouts in 1 day');
   }
 
   /**
@@ -627,7 +627,7 @@ class MonitoringCoreKernelTest extends MonitoringUnitTestBase {
     $this->assertText('M sites/all/modules/monitoring/test/tests/monitoring.core.test');
     $this->assertText('D deleted file.txt');
     // Check if the sensor message has the expected value.
-    $this->assertEqual($result->getMessage(), '3 files in unexpected state: A addedfile.txt, M …modules/monitoring/test/tests/monitoring.core.test');
+    $this->assertEquals($result->getMessage(), '3 files in unexpected state: A addedfile.txt, M …modules/monitoring/test/tests/monitoring.core.test');
 
     // Now echo empty string.
     $sensor_config->settings['status_cmd'] = 'true';
@@ -636,7 +636,7 @@ class MonitoringCoreKernelTest extends MonitoringUnitTestBase {
     $result = $this->runSensor('monitoring_git_dirty_tree');
     $this->assertTrue($result->isOk());
     // The message should say that it is ok.
-    $this->assertEqual($result->getMessage(), 'Git repository clean');
+    $this->assertEquals($result->getMessage(), 'Git repository clean');
 
     // Test 2 commits ahead of origin.
     $sensor_config->settings['ahead_cmd'] = 'printf "a4ea5e3ac5b7cca0c96aee4d00447c36121bd128\n299d85344fab9befbf6a275a4b64bda7b464b493"';
@@ -648,7 +648,7 @@ class MonitoringCoreKernelTest extends MonitoringUnitTestBase {
     $this->setRawContent(\Drupal::service('renderer')->renderPlain($verbose_output));
     $this->assertText('a4ea5e3ac5b7cca0c96aee4d00447c36121bd128');
     $this->assertText('299d85344fab9befbf6a275a4b64bda7b464b493');
-    $this->assertEqual($result->getMessage(), 'Branch is 2 ahead of origin');
+    $this->assertEquals($result->getMessage(), 'Branch is 2 ahead of origin');
 
     // Test not in main branch.
     $sensor_config->settings['check_branch'] = TRUE;
@@ -662,7 +662,7 @@ class MonitoringCoreKernelTest extends MonitoringUnitTestBase {
     $verbose_output = $result->getVerboseOutput();
     $this->setRawContent(\Drupal::service('renderer')->renderPlain($verbose_output));
     $this->assertText('7.0.x');
-    $this->assertEqual($result->getMessage(), 'Active branch 7.0.x, expected 8.0.x');
+    $this->assertEquals($result->getMessage(), 'Active branch 7.0.x, expected 8.0.x');
 
     // Test same as main branch.
     $sensor_config->settings['actual_branch_cmd'] = 'printf "8.0.x"';
@@ -670,7 +670,7 @@ class MonitoringCoreKernelTest extends MonitoringUnitTestBase {
 
     $result = $this->runSensor('monitoring_git_dirty_tree');
     $this->assertTrue($result->isOk());
-    $this->assertEqual($result->getMessage(), 'Git repository clean');
+    $this->assertEquals($result->getMessage(), 'Git repository clean');
 
     // Test submodule not initialized.
     $sensor_config->settings['submodules_cmd'] = 'printf -- "-a5066d1778b9ec7c86631234ff2795e777bdff12 test\n156fff6ee58497fa22b57c32e22e3f13377b4120 test (8.x-1.0-240-g156fff6)"';
@@ -681,7 +681,7 @@ class MonitoringCoreKernelTest extends MonitoringUnitTestBase {
     $verbose_output = $result->getVerboseOutput();
     $this->setRawContent(\Drupal::service('renderer')->renderPlain($verbose_output));
     $this->assertText('-a5066d1778b9ec7c86631234ff2795e777bdff12 test');
-    $this->assertEqual($result->getMessage(), '1 submodules in unexpected state: -a5066d1778b9ec7c86631234ff2795e777bdff12 test');
+    $this->assertEquals($result->getMessage(), '1 submodules in unexpected state: -a5066d1778b9ec7c86631234ff2795e777bdff12 test');
 
     // Test submodule with uncommitted changes.
     $sensor_config->settings['submodules_cmd'] = 'printf "a5066d1778b9ec7c86631234ff2795e777bdff12 test\n+156fff6ee58497fa22b57c32e22e3f13377b4120 test (8.x-1.0-240-g156fff6)"';
@@ -692,7 +692,7 @@ class MonitoringCoreKernelTest extends MonitoringUnitTestBase {
     $verbose_output = $result->getVerboseOutput();
     $this->setRawContent(\Drupal::service('renderer')->renderPlain($verbose_output));
     $this->assertText('+156fff6ee58497fa22b57c32e22e3f13377b4120 test (8.x-1.0-240-g156fff6)');
-    $this->assertEqual($result->getMessage(), '1 submodules in unexpected state: +156fff6ee58497fa22b57c32e22e3f13377b4120 test (8.x-1.0-240-g156fff6)');
+    $this->assertEquals($result->getMessage(), '1 submodules in unexpected state: +156fff6ee58497fa22b57c32e22e3f13377b4120 test (8.x-1.0-240-g156fff6)');
 
     // Test submodules in expected state.
     $sensor_config->settings['submodules_cmd'] = 'printf "a5066d1778b9ec7c86631234ff2795e777bdff12 test\n156fff6ee58497fa22b57c32e22e3f13377b4120 test (8.x-1.0-240-g156fff6)"';
@@ -700,7 +700,7 @@ class MonitoringCoreKernelTest extends MonitoringUnitTestBase {
 
     $result = $this->runSensor('monitoring_git_dirty_tree');
     $this->assertTrue($result->isOk());
-    $this->assertEqual($result->getMessage(), 'Git repository clean');
+    $this->assertEquals($result->getMessage(), 'Git repository clean');
   }
 
   /**
@@ -712,7 +712,7 @@ class MonitoringCoreKernelTest extends MonitoringUnitTestBase {
     $this->config('system.theme')->set('default', 'bartik')->save();
     $result = $this->runSensor('core_theme_default');
     $this->assertTrue($result->isOk());
-    $this->assertEqual($result->getMessage(), 'Value bartik');
+    $this->assertEquals($result->getMessage(), 'Value bartik');
 
     $this->config('system.theme')->set('default', 'garland')->save();
     $result = $this->runSensor('core_theme_default');
@@ -735,7 +735,7 @@ class MonitoringCoreKernelTest extends MonitoringUnitTestBase {
     \Drupal::logger('test_type')->notice($this->randomMachineName());
     \Drupal::logger('other_test_type')->notice($this->randomMachineName());
     $result = $this->runSensor('watchdog_aggregate_test');
-    $this->assertEqual($result->getValue(), 2);
+    $this->assertEquals($result->getValue(), 2);
 
     // Aggregate by watchdog message.
     $sensor_config->settings['conditions'] = array(
@@ -746,7 +746,7 @@ class MonitoringCoreKernelTest extends MonitoringUnitTestBase {
     \Drupal::logger($this->randomMachineName())->notice('another_test_message');
     \Drupal::logger($this->randomMachineName())->notice('another_test_message');
     $result = $this->runSensor('watchdog_aggregate_test');
-    $this->assertEqual($result->getValue(), 1);
+    $this->assertEquals($result->getValue(), 1);
 
     // Aggregate by watchdog severity.
     $sensor_config->settings['conditions'] = array(
@@ -762,7 +762,7 @@ class MonitoringCoreKernelTest extends MonitoringUnitTestBase {
     \Drupal::logger($this->randomMachineName())
       ->critical($this->randomMachineName());
     $result = $this->runSensor('watchdog_aggregate_test');
-    $this->assertEqual($result->getValue(), 4);
+    $this->assertEquals($result->getValue(), 4);
 
     // Aggregate by watchdog location.
     $sensor_config->settings['conditions'] = array(
@@ -775,7 +775,7 @@ class MonitoringCoreKernelTest extends MonitoringUnitTestBase {
       ->condition('type', 'test_type')
       ->execute();
     $result = $this->runSensor('watchdog_aggregate_test');
-    $this->assertEqual($result->getValue(), 2);
+    $this->assertEquals($result->getValue(), 2);
 
     // Filter for time period.
     $sensor_config->settings['conditions'] = array();
@@ -790,7 +790,7 @@ class MonitoringCoreKernelTest extends MonitoringUnitTestBase {
       ->execute();
     $count_latest = \Drupal::database()->query('SELECT COUNT(*) FROM {watchdog} WHERE timestamp > :timestamp', array(':timestamp' => \Drupal::time()->getRequestTime() - 10))->fetchField();
     $result = $this->runSensor('watchdog_aggregate_test');
-    $this->assertEqual($result->getValue(), $count_latest);
+    $this->assertEquals($result->getValue(), $count_latest);
 
     // Test for thresholds and statuses.
     $sensor_config->settings['conditions'] = array(
@@ -799,18 +799,18 @@ class MonitoringCoreKernelTest extends MonitoringUnitTestBase {
     $sensor_config->save();
     $result = $this->runSensor('watchdog_aggregate_test');
     $this->assertTrue($result->isOk());
-    $this->assertEqual($result->getValue(), 0);
+    $this->assertEquals($result->getValue(), 0);
 
     \Drupal::logger('test_watchdog_aggregate_sensor')->notice('testing');
     \Drupal::logger('test_watchdog_aggregate_sensor')->notice('testing');
     $result = $this->runSensor('watchdog_aggregate_test');
     $this->assertTrue($result->isWarning());
-    $this->assertEqual($result->getValue(), 2);
+    $this->assertEquals($result->getValue(), 2);
 
     \Drupal::logger('test_watchdog_aggregate_sensor')->notice('testing');
     $result = $this->runSensor('watchdog_aggregate_test');
     $this->assertTrue($result->isCritical());
-    $this->assertEqual($result->getValue(), 3);
+    $this->assertEquals($result->getValue(), 3);
 
     // Test database aggregator with invalid conditions.
     $sensor = SensorConfig::create(array(
@@ -835,14 +835,14 @@ class MonitoringCoreKernelTest extends MonitoringUnitTestBase {
     );
     $sensor_config->save();
     $result = $this->runSensor('watchdog_aggregate_test');
-    $this->assertEqual($result->getValue(), 1);
+    $this->assertEquals($result->getValue(), 1);
 
     $sensor_config->settings['conditions'] = array(
       array('field' => 'type', 'value' => 'test_type', 'operator' => 'CONTAINS'),
     );
     $sensor_config->save();
     $result = $this->runSensor('watchdog_aggregate_test');
-    $this->assertEqual($result->getValue(), 3);
+    $this->assertEquals($result->getValue(), 3);
   }
 
   /**
diff --git a/tests/src/Kernel/MonitoringCronErrorPluginTest.php b/tests/src/Kernel/MonitoringCronErrorPluginTest.php
index f7c29e7..bbfea37 100644
--- a/tests/src/Kernel/MonitoringCronErrorPluginTest.php
+++ b/tests/src/Kernel/MonitoringCronErrorPluginTest.php
@@ -21,7 +21,7 @@ class MonitoringCronErrorPluginTest extends MonitoringUnitTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setup() {
+  public function setup(): void {
     parent::setUp();
 
     // Install schema to create the required tables.
diff --git a/tests/src/Kernel/MonitoringPastTest.php b/tests/src/Kernel/MonitoringPastTest.php
index adb8ed5..44b9bc7 100644
--- a/tests/src/Kernel/MonitoringPastTest.php
+++ b/tests/src/Kernel/MonitoringPastTest.php
@@ -21,7 +21,7 @@ class MonitoringPastTest extends MonitoringUnitTestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     // Install the past entities and tables.
@@ -41,25 +41,25 @@ class MonitoringPastTest extends MonitoringUnitTestBase {
 
     // Run each sensor and test output.
     $result = $this->runSensor('past_db_critical');
-    $this->assertEqual($result->getMessage(), '3 events in 1 day');
+    $this->assertEquals($result->getMessage(), '3 events in 1 day');
 
     $result = $this->runSensor('past_db_debug');
-    $this->assertEqual($result->getMessage(), '2 events in 1 day');
+    $this->assertEquals($result->getMessage(), '2 events in 1 day');
 
     $result = $this->runSensor('past_db_emergency');
-    $this->assertEqual($result->getMessage(), '3 events in 1 day');
+    $this->assertEquals($result->getMessage(), '3 events in 1 day');
 
     $result = $this->runSensor('past_db_error');
-    $this->assertEqual($result->getMessage(), '3 events in 1 day');
+    $this->assertEquals($result->getMessage(), '3 events in 1 day');
 
     $result = $this->runSensor('past_db_info');
-    $this->assertEqual($result->getMessage(), '2 events in 1 day');
+    $this->assertEquals($result->getMessage(), '2 events in 1 day');
 
     $result = $this->runSensor('past_db_notice');
-    $this->assertEqual($result->getMessage(), '2 events in 1 day');
+    $this->assertEquals($result->getMessage(), '2 events in 1 day');
 
     $result = $this->runSensor('past_db_warning');
-    $this->assertEqual($result->getMessage(), '3 events in 1 day');
+    $this->assertEquals($result->getMessage(), '3 events in 1 day');
   }
 
   /**
diff --git a/tests/src/Kernel/MonitoringRedirect404SensorTest.php b/tests/src/Kernel/MonitoringRedirect404SensorTest.php
index 648c109..847f28d 100644
--- a/tests/src/Kernel/MonitoringRedirect404SensorTest.php
+++ b/tests/src/Kernel/MonitoringRedirect404SensorTest.php
@@ -21,7 +21,7 @@ class MonitoringRedirect404SensorTest extends MonitoringUnitTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     $this->installSchema('redirect_404', 'redirect_404');
     $this->installConfig(array('system'));
diff --git a/tests/src/Kernel/MonitoringResponseTimeSensorTest.php b/tests/src/Kernel/MonitoringResponseTimeSensorTest.php
index 5a81de1..e0daeee 100644
--- a/tests/src/Kernel/MonitoringResponseTimeSensorTest.php
+++ b/tests/src/Kernel/MonitoringResponseTimeSensorTest.php
@@ -30,7 +30,7 @@ class MonitoringResponseTimeSensorTest extends MonitoringUnitTestBase {
       'settings' => [
         'main_metric' => 'percentile_90',
         'lines' => 25,
-        'log_file' => drupal_get_path('module', 'monitoring') . '/tests/fixtures/example.php.access.log',
+        'log_file' => \Drupal::service('extension.list.module')->getPath('monitoring') . '/tests/fixtures/example.php.access.log',
       ],
     ]);
     $sensor->save();
diff --git a/tests/src/Kernel/MonitoringSearchAPITest.php b/tests/src/Kernel/MonitoringSearchAPITest.php
index 2b0e9a1..6901e84 100644
--- a/tests/src/Kernel/MonitoringSearchAPITest.php
+++ b/tests/src/Kernel/MonitoringSearchAPITest.php
@@ -35,7 +35,7 @@ class MonitoringSearchAPITest extends MonitoringUnitTestBase {
   /**
    * {@inheritdoc}
    */
-  public function setUp() {
+  public function setUp(): void {
     parent::setUp();
     // Install required database tables for each module.
     $this->installSchema('search_api', ['search_api_item']);
@@ -68,7 +68,7 @@ class MonitoringSearchAPITest extends MonitoringUnitTestBase {
     $entity->save();
 
     $result = $this->runSensor('search_api_database_search_index');
-    $this->assertEqual($result->getValue(), 2);
+    $this->assertEquals($result->getValue(), 2);
 
     // Update the index to test sensor result.
     $index = Index::load('database_search_index');
@@ -83,14 +83,14 @@ class MonitoringSearchAPITest extends MonitoringUnitTestBase {
 
     // New articles are not yet indexed.
     $result = $this->runSensor('search_api_database_search_index');
-    $this->assertEqual($result->getValue(), 3);
+    $this->assertEquals($result->getValue(), 3);
 
     $index = Index::load('database_search_index');
     $index->indexItems();
 
     // Everything should be indexed.
     $result = $this->runSensor('search_api_database_search_index');
-    $this->assertEqual($result->getValue(), 0);
+    $this->assertEquals($result->getValue(), 0);
 
     // Verify that hooks do not break when sensors unexpectedly do exist or
     // don't exist.
diff --git a/tests/src/Kernel/MonitoringUnitTestBase.php b/tests/src/Kernel/MonitoringUnitTestBase.php
index 284fca1..ee71e7d 100644
--- a/tests/src/Kernel/MonitoringUnitTestBase.php
+++ b/tests/src/Kernel/MonitoringUnitTestBase.php
@@ -13,12 +13,12 @@ use Drupal\KernelTests\KernelTestBase;
  */
 abstract class MonitoringUnitTestBase extends KernelTestBase {
 
-  public static $modules = array('monitoring', 'monitoring_test', 'field', 'system', 'user', 'views', 'text', 'node');
+  protected static $modules = array('monitoring', 'monitoring_test', 'field', 'system', 'user', 'views', 'text', 'node');
 
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     $this->installEntitySchema('monitoring_sensor_result');
