diff --git a/src/Tests/NodeViewCountBaseFunctionalityTest.php b/src/Tests/NodeViewCountBaseFunctionalityTest.php
index 1cec504..2bbacdb 100644
--- a/src/Tests/NodeViewCountBaseFunctionalityTest.php
+++ b/src/Tests/NodeViewCountBaseFunctionalityTest.php
@@ -36,14 +36,14 @@ class NodeViewCountBaseFunctionalityTest extends NodeViewCountTestBase {
     $query = $this->connection->select('nodeviewcount', 'nvc')
       ->fields('nvc', ['id']);
     $result = $query->execute()->fetchAll();
-    $this->assertEqual(count($result), 2, ' Nodeviewcount statistics is not deleted after cron run.');
+    $this->assertEquals(count($result), 2, ' Nodeviewcount statistics is not deleted after cron run.');
 
     $node_view_count_settings = $this->config('nodeviewcount.settings');
     $node_view_count_settings->set('logs_life_time', 1)->save();
     sleep(2);
     $this->cronRun();
     $result = $query->execute()->fetchAll();
-    $this->assertEqual(count($result), 0, ' Nodeviewcount statistics is deleted after cron run.');
+    $this->assertEquals(count($result), 0, ' Nodeviewcount statistics is deleted after cron run.');
   }
 
   /**
@@ -67,7 +67,8 @@ class NodeViewCountBaseFunctionalityTest extends NodeViewCountTestBase {
     $this->checkTeaserViewMode('administrator', FALSE);
     $this->drupalLogin($this->adminUser);
     $edit['view_modes[teaser]'] = FALSE;
-    $this->drupalPostForm('admin/config/content/nodeviewcount', $edit, $this->t('Save configuration'));
+    $this->drupalGet('admin/config/content/nodeviewcount');
+    $this->submitForm($edit, $this->t('Save configuration'));
     $this->drupalGet('admin/config/content/nodeviewcount');
     $this->drupalLogout();
     $this->checkTeaserViewMode('anonymous', FALSE);
@@ -87,7 +88,7 @@ class NodeViewCountBaseFunctionalityTest extends NodeViewCountTestBase {
       ->condition('nvc.nid', $this->firstTestTrackedNode->id())
       ->execute()
       ->fetchAll();
-    $this->assertEqual(count($result), 2, 'Verifying that the node counter is incremented.');
+    $this->assertEquals(count($result), 2, 'Verifying that the node counter is incremented.');
   }
 
   /**
@@ -123,7 +124,7 @@ class NodeViewCountBaseFunctionalityTest extends NodeViewCountTestBase {
           'view_mode' => 'full',
         ],
       ];
-      $this->assertEqual($expectedSettings, $settings['nodeviewcount']['data'], 'drupalSettings has right node information.');
+      $this->assertEquals($expectedSettings, $settings['nodeviewcount']['data'], 'drupalSettings has right node information.');
     }
     else {
       $this->assertNoRaw('nodeviewcount.js', 'Nodeviewcount statistics library is not included.');
@@ -168,7 +169,7 @@ class NodeViewCountBaseFunctionalityTest extends NodeViewCountTestBase {
           'view_mode' => 'teaser',
         ],
       ];
-      $this->assertEqual($expectedSettings, $settings['nodeviewcount']['data'], 'drupalSettings to mark node as read are present.');
+      $this->assertEquals($expectedSettings, $settings['nodeviewcount']['data'], 'drupalSettings to mark node as read are present.');
     }
     else {
       $this->assertNoRaw('nodeviewcount.js', 'Nodeviewcount statistics library is not included.');
diff --git a/src/Tests/NodeViewCountHooksTest.php b/src/Tests/NodeViewCountHooksTest.php
index 65d4144..778975d 100644
--- a/src/Tests/NodeViewCountHooksTest.php
+++ b/src/Tests/NodeViewCountHooksTest.php
@@ -26,7 +26,7 @@ class NodeViewCountHooksTest extends NodeViewCountTestBase {
       ->condition('type', 'nodeviewcount')
       ->execute()
       ->fetchField();
-    $this->assertEqual($message, $this->firstTestTrackedNode->getTitle(), 'Nodeviewcount hook is called.');
+    $this->assertEquals($message, $this->firstTestTrackedNode->getTitle(), 'Nodeviewcount hook is called.');
   }
 
 }
diff --git a/src/Tests/NodeViewCountSettingsFormTest.php b/src/Tests/NodeViewCountSettingsFormTest.php
index 73fcd0f..83adc82 100644
--- a/src/Tests/NodeViewCountSettingsFormTest.php
+++ b/src/Tests/NodeViewCountSettingsFormTest.php
@@ -27,12 +27,12 @@ class NodeViewCountSettingsFormTest extends NodeViewCountTestBase {
     $this->assertFieldChecked('edit-user-roles-anonymous');
     $this->assertFieldChecked('edit-user-roles-logged');
     $this->assertNoFieldChecked('edit-user-roles-authenticated');
-    $this->assertNoFieldById('edit-user-roles-administrator');
-    $this->assertNoFieldById('edit-excluded-user-roles-anonymous');
-    $this->assertNoFieldById('edit-excluded-user-roles-logged');
+    $this->assertSession()->fieldValueNotEquals('edit-user-roles-administrator', '');
+    $this->assertSession()->fieldValueNotEquals('edit-excluded-user-roles-anonymous', '');
+    $this->assertSession()->fieldValueNotEquals('edit-excluded-user-roles-logged', '');
     $this->assertNoFieldChecked('edit-excluded-user-roles-authenticated');
     $this->assertFieldChecked('edit-excluded-user-roles-administrator');
-    $this->assertOptionSelected('edit-logs-life-time', 0);
+    $this->assertTrue($this->assertSession()->optionExists('edit-logs-life-time', 0)->hasAttribute('selected'));
 
     $this->drupalLogout();
   }
@@ -48,10 +48,10 @@ class NodeViewCountSettingsFormTest extends NodeViewCountTestBase {
       'logs_life_time' => 604800,
       'user_roles[authenticated]' => TRUE,
     ];
-    $this->drupalPostForm(NULL, $edit, $this->t('Save configuration'));
+    $this->submitForm($edit, $this->t('Save configuration'));
     $this->assertFieldChecked('edit-user-roles-authenticated');
-    $this->assertNoFieldById('edit-excluded-user-roles-authenticated');
-    $this->assertOptionSelected('edit-logs-life-time', 604800);
+    $this->assertSession()->fieldValueNotEquals('edit-excluded-user-roles-authenticated', '');
+    $this->assertTrue($this->assertSession()->optionExists('edit-logs-life-time', 604800)->hasAttribute('selected'));
 
     $this->drupalLogout();
   }
diff --git a/src/Tests/NodeViewCountTestBase.php b/src/Tests/NodeViewCountTestBase.php
index 03bc2ed..12c604e 100644
--- a/src/Tests/NodeViewCountTestBase.php
+++ b/src/Tests/NodeViewCountTestBase.php
@@ -79,7 +79,7 @@ abstract class NodeViewCountTestBase extends BrowserTestBase {
   /**
    * {@inheritdoc}
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
     $this->createRole([
@@ -171,7 +171,7 @@ abstract class NodeViewCountTestBase extends BrowserTestBase {
     // Create a user assigned to that role.
     $edit['name'] = $this->randomMachineName();
     $edit['mail'] = $edit['name'] . '@example.com';
-    $edit['pass'] = user_password();
+    $edit['pass'] = \Drupal::service('password_generator')->generate();
     $edit['status'] = 1;
     $edit['roles'] = [$user_role_name];
 
diff --git a/src/Tests/NodeViewCountViewsTest.php b/src/Tests/NodeViewCountViewsTest.php
index 7bfe1d1..d3c6a52 100644
--- a/src/Tests/NodeViewCountViewsTest.php
+++ b/src/Tests/NodeViewCountViewsTest.php
@@ -72,7 +72,7 @@ class NodeViewCountViewsTest extends NodeViewCountTestBase {
   private function assertStatisticsViewRowExists($title, $count) {
     $value = $this->xpath("//td[normalize-space(../td[@class='views-field views-field-title']/text()) = '{$title}'][2]");
     $value = (string) reset($value);
-    $this->assertEqual($value, $count);
+    $this->assertEquals($value, $count);
   }
 
 }
