Error executing PHPUnit I was trying to write PHPUnit test in D8, but am blocked due to a weird issue which I am not able to track.

The module for which I am writing the test is at https://github.com/ajitdev/phpunit_d8

I have created a basic class Math with some functions https://github.com/ajitdev/phpunit_d8/blob/master/src/Math.php

&lt;?php
namespace Drupal\phpunit_d8;
class Math {
  public function addNum($a, $b, $c) {
    return $a + $b + $c;
  }
  public function substract($a, $b) {
    return $a - $b;
  }
  public function divide($a, $b) {
    return $a / $b;
  }
}


And the test in tests/src/Unit directory https://github.com/ajitdev/phpunit_d8/blob/master/tests/src/Unit/MathTest.php

&lt;?php
/**
 * @file
 * Contains Drupal\Tests\phpunit_d8\Unit\MathTest
 */
namespace Drupal\Tests\phpunit_d8\Unit;
use Drupal\Tests\UnitTestCase;
use Drupal\phpunit_d8\Math;
/**
 * Class MathTest
 * @package Drupal\Tests\phpunit_d8\Unit
 *
 * @group math
 */
class MathTest extends UnitTestCase {
  public function addNumTest() {
    $math = new Math();
    $this-&gt;assertEquals($math-&gt;addNum(1,2,3), 6);
  }
}


The test shows up on /admin/config/development/testing, but throws the following exception:

Uncaught PHP Exception Drupal\Core\Database\IntegrityConstraintViolationException: "SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'file' cannot be null: INSERT INTO {simpletest} (test_id, test_class, status, message, message_group, function, line, file) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7); Array
(
    [:db_insert_placeholder_0] =&gt; 14
    [:db_insert_placeholder_1] =&gt; Drupal\Tests\phpunit_d8\Unit\MathTest
    [:db_insert_placeholder_2] =&gt; fail
    [:db_insert_placeholder_3] =&gt; 
    [:db_insert_placeholder_4] =&gt; Other
    [:db_insert_placeholder_5] =&gt; Drupal\Tests\phpunit_d8\Unit\MathTest-&gt;Warning()
    [:db_insert_placeholder_6] =&gt; 0
    [:db_insert_placeholder_7] =&gt; 
)
" at /Applications/MAMP/htdocs/d8/core/lib/Drupal/Core/Database/Connection.php line 673


The issue is empty value for the file value. I am not able to trace down the issue. Any pointers would be really helpful.
I was able to resolve the issue. You just have to prefix your test with test_. Seriously! No kidding!

My test looks like the following:

&lt;?php
/**
 * @file
 * Contains Drupal\Tests\phpunit_d8\Unit\MathTest
 */

namespace Drupal\Tests\phpunit_d8\Unit;

use Drupal\Tests\UnitTestCase;
use Drupal\phpunit_d8\Math;

/**
 * Class MathTest
 * @package Drupal\Tests\phpunit_d8\Unit
 *
 * @group math
 */
class MathTest extends UnitTestCase {
  /**
   * Very simple test to MathTest::addNum().
   */
  public function testAddNum() {
    $math = new Math();
    $this-&gt;assertEquals($math-&gt;addNum(1,2,3), 6);
  }
}


Also, pushed at https://github.com/ajitdev/phpunit_d8