SonarPHP doesn't analyze php-unit tests with dataProvider

php

(Ilia) #1
  • SonarQube Version 7.3 (build 15553), Scanner 3.2.0.1227, SonarPHP 2.14.0.3569, php 7.2.10, php-unit 7.3.5
  • Sonarphp doesn’t analyze php-unit tests with dataProvider.
    In logs i have warnings:
WARN: Test cases must always be descendants of a file-based suite, skipping : Adsterra\Tests\Unit\Core\Helper\ArrHelperTest.testIsStrKeysArray with data set #0 in Adsterra\Tests\Unit\Core\Helper\ArrHelperTest::testIsStrKeysArray
WARN: Test cases must always be descendants of a file-based suite, skipping : Adsterra\Tests\Unit\Core\Helper\ArrHelperTest.testIsStrKeysArray with data set #1 in Adsterra\Tests\Unit\Core\Helper\ArrHelperTest::testIsStrKeysArray
WARN: Test cases must always be descendants of a file-based suite, skipping : Adsterra\Tests\Unit\Core\Helper\ArrHelperTest.testIsStrKeysArray with data set #2 in Adsterra\Tests\Unit\Core\Helper\ArrHelperTest::testIsStrKeysArray
WARN: Test cases must always be descendants of a file-based suite, skipping : Adsterra\Tests\Unit\Core\Helper\ArrHelperTest.testIsStrKeysArray with data set #3 in Adsterra\Tests\Unit\Core\Helper\ArrHelperTest::testIsStrKeysArray
  • steps to reproduce
  1. Create unit test on php with dataProvider;
  2. Run this test;
  3. Scan reults test xml file use SonarQube scanner;

(Colin Mueller) #2

Ilia,

Is your issue that the tests are not being analyzed, or that the test results are not being imported to SonarQube. Simply scanning a test results file is not enough, you will need to follow the SonarPHP documentation for PHP Unit Test and Coverage Results Import.

Colin