Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> SonarQube z UnitTests
nospor
post 9.01.2018, 11:31:41
Post #1





Grupa: Moderatorzy
Postów: 36 447
Pomógł: 6292
Dołączył: 27.12.2004




hejka, do analizy projektu uzywam SonarQube. W projekcie mam unittests i generuje raporty
W konfiguracji sonarqube w projekcie ustawiam

Kod
sonar.php.tests.reportPath=/.../logfile.xml
sonar.php.coverage.reportPaths=/.../coverage.xml

O ile code coverage jest ladnie lykane przez SonarQube o tyle testy juz nie. CIagle dostaje bledy w stylu:
Kod
WARN: Test cases must always be descendants of a file-based suite, skipping : Tests\Unit\DataService\Reader\GridTest.testGrid with data set #0 in Tests\Unit\DataService\Reader\GridTest::testGrid
WARN: Test cases must always be descendants of a file-based suite, skipping : Tests\Unit\DataService\Reader\GridTest.testGrid with data set #1 in Tests\Unit\DataService\Reader\GridTest::testGrid
WARN: Test cases must always be descendants of a file-based suite, skipping : Tests\Unit\DataService\Reader\GridTest.testGrid with data set #2 in Tests\Unit\DataService\Reader\GridTest::testGrid
WARN: Test cases must always be descendants of a file-based suite, skipping : Tests\Unit\DataService\Reader\GridTest.testGrid with data set #3 in Tests\Unit\DataService\Reader\GridTest::testGrid
WARN: Test cases must always be descendants of a file-based suite, skipping : Tests\Unit\DataService\Reader\GridTest.testGrid with data set #4 in Tests\Unit\DataService\Reader\GridTest::testGrid
WARN: Test cases must always be descendants of a file-based suite, skipping : Tests\Unit\DataService\Reader\GridTest.testGrid with data set #5 in Tests\Unit\DataService\Reader\GridTest::testGrid
WARN: Test cases must always be descendants of a file-based suite, skipping : Tests\Unit\DataService\Reader\GridTest.testGrid with data set #6 in Tests\Unit\DataService\Reader\GridTest::testGrid
WARN: Test cases must always be descendants of a file-based suite, skipping : Tests\Unit\DataService\Reader\GridTest.testGrid with data set #7 in Tests\Unit\DataService\Reader\GridTest::testGrid
WARN: Test cases must always be descendants of a file-based suite, skipping : Tests\Unit\DataService\SurveyTest.testNames with data set #0 in Tests\Unit\DataService\SurveyTest::testNames
WARN: Test cases must always be descendants of a file-based suite, skipping : Tests\Unit\DataService\SurveyTest.testNames with data set #1 in Tests\Unit\DataService\SurveyTest::testNames
WARN: Test cases must always be descendants of a file-based suite, skipping : Tests\Unit\DataService\SurveyTest.testNames with data set #2 in Tests\Unit\DataService\SurveyTest::testNames
WARN: Test cases must always be descendants of a file-based suite, skipping : Tests\Unit\DataService\SurveyTest.testNames with data set #3 in Tests\Unit\DataService\SurveyTest::testNames
WARN: Test cases must always be descendants of a file-based suite, skipping : Tests\Unit\DataService\SurveyTest.testTypes with data set #0 in Tests\Unit\DataService\SurveyTest::testTypes
WARN: Test cases must always be descendants of a file-based suite, skipping : Tests\Unit\DataService\SurveyTest.testTypes with data set #1 in Tests\Unit\DataService\SurveyTest::testTypes
WARN: Test cases must always be descendants of a file-based suite, skipping : Tests\Unit\DataService\SurveyTest.testTypes with data set #2 in Tests\Unit\DataService\SurveyTest::testTypes
WARN: Test cases must always be descendants of a file-based suite, skipping : Tests\Unit\DataService\SurveyTest.testTypes with data set #3 in Tests\Unit\DataService\SurveyTest::testTypes


Plik logfile.xml jest wygenerowany przez phpunit z takie konfiguracji
<log type="junit" target="/.../logfile.xml" logIncompleteSkipped="false"/>
<log type="coverage-clover" target="/.../coverage.xml"/>


A tak wyglada pare pierwszych linijek logfile.xml:
Kod
<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
  <testsuite name="" tests="104" assertions="122" errors="0" failures="0" skipped="0" time="1.011804">
    <testsuite name="functional" tests="44" assertions="50" errors="0" failures="0" skipped="0" time="0.780856">
      <testsuite name="Tests\Functional\DataService\FileIO\AnswersFileIOTest" file="/var/www/test/data-service/tests/Functional/DataService/FileIO/AnswersFileIOTest.php" tests="2" assertions="4" errors="0" failures="0" skipped="0" time="0.006286">
        <testcase name="testLoad" class="Tests\Functional\DataService\FileIO\AnswersFileIOTest" classname="Tests.Functional.DataService.FileIO.AnswersFileIOTest" file="/var/www/test/data-service/tests/Functional/DataService/FileIO/AnswersFileIOTest.php" line="10" assertions="1" time="0.004075"/>
        <testcase name="testWrite" class="Tests\Functional\DataService\FileIO\AnswersFileIOTest" classname="Tests.Functional.DataService.FileIO.AnswersFileIOTest" file="/var/www/test/data-service/tests/Functional/DataService/FileIO/AnswersFileIOTest.php" line="36" assertions="3" time="0.002211"/>
      </testsuite>
      <testsuite name="Tests\Functional\DataService\FileIO\QuestionsFileIOTest" file="/var/www/test/data-service/tests/Functional/DataService/FileIO/QuestionsFileIOTest.php" tests="2" assertions="4" errors="0" failures="0" skipped="0" time="0.004041">
        <testcase name="testLoad" class="Tests\Functional\DataService\FileIO\QuestionsFileIOTest" classname="Tests.Functional.DataService.FileIO.QuestionsFileIOTest" file="/var/www/test/data-service/tests/Functional/DataService/FileIO/QuestionsFileIOTest.php" line="10" assertions="1" time="0.002783"/>
        <testcase name="testWrite" class="Tests\Functional\DataService\FileIO\QuestionsFileIOTest" classname="Tests.Functional.DataService.FileIO.QuestionsFileIOTest" file="/var/www/test/data-service/tests/Functional/DataService/FileIO/QuestionsFileIOTest.php" line="26" assertions="3" time="0.001258"/>
      </testsuite>
.....

Googlalem ale nie bylem wstanie nic znalezc sad.gif



edit:
Pozwole sobie odswiezyc temat po paru miesiacach bo moze ktos cos juz mial podobnego?


--------------------

"Myśl, myśl, myśl..." - Kubuś Puchatek || "Manual, manual, manual..." - Kubuś Programista
"Szukaj, szukaj, szukaj..." - Kubuś Odkrywca || "Debuguj, debuguj, debuguj..." - Kubuś Developer

Go to the top of the page
+Quote Post
com
post 9.01.2018, 20:30:49
Post #2





Grupa: Zarejestrowani
Postów: 3 033
Pomógł: 366
Dołączył: 24.05.2012

Ostrzeżenie: (0%)
-----


http://kwebble.com/blog/2015-05-25_23:22:12 tak próbowałeś?
Go to the top of the page
+Quote Post
nospor
post 10.01.2018, 10:09:52
Post #3





Grupa: Moderatorzy
Postów: 36 447
Pomógł: 6292
Dołączył: 27.12.2004




Jedyna roznica jaka widze to ze u niego tests jest w src a umnie to sa katalogi rownolegle
Mi generalnie coverage pokazuje w sonarqube ale sa te ostrzezenia co pokazalem oraz coverage jest zanizony wzgledem coverage generowanym przez phpunit.


--------------------

"Myśl, myśl, myśl..." - Kubuś Puchatek || "Manual, manual, manual..." - Kubuś Programista
"Szukaj, szukaj, szukaj..." - Kubuś Odkrywca || "Debuguj, debuguj, debuguj..." - Kubuś Developer

Go to the top of the page
+Quote Post
com
post 10.01.2018, 17:53:52
Post #4





Grupa: Zarejestrowani
Postów: 3 033
Pomógł: 366
Dołączył: 24.05.2012

Ostrzeżenie: (0%)
-----


bardziej miałem na myśli te linie
Kod
sonar.tests=src/test/php

Bo tego nie pokazałeś, a to jest ważne tongue.gif
Pamiętam, że też miałem z tym problem, żeby testy ogarniał i to była zabawa. Ale już nie pamiętam czy w końcu je złapał lub czy to olałem.

Ten post edytował com 10.01.2018, 17:54:42
Go to the top of the page
+Quote Post
nospor
post 10.01.2018, 18:09:42
Post #5





Grupa: Moderatorzy
Postów: 36 447
Pomógł: 6292
Dołączył: 27.12.2004




Z ta linia czy bez, wynik ten sam sad.gif


--------------------

"Myśl, myśl, myśl..." - Kubuś Puchatek || "Manual, manual, manual..." - Kubuś Programista
"Szukaj, szukaj, szukaj..." - Kubuś Odkrywca || "Debuguj, debuguj, debuguj..." - Kubuś Developer

Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 20.04.2024 - 04:28