astj / flake8-formatter-junit-xml

JUnit XML formatter for flake8
MIT License
17 stars 10 forks source link

Success output is invalid #3

Closed nesl247 closed 6 years ago

nesl247 commented 6 years ago

The output for success is invalid because it shows no tests have been run.

Here's an example from php-cs-fixer:

<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
  <testsuite name="PHP CS Fixer" tests="1" assertions="1" failures="0" errors="0" time="1.392">
    <testcase name="All OK" assertions="1"/>
  </testsuite>
</testsuites>

Here's the output from this formatter:

<?xml version="1.0" ?>
<testsuites disabled="0" errors="0" failures="0" tests="0" time="0.0">
    <testsuite disabled="0" errors="0" failures="0" name="flake8.src/deploy/TrendingDeploy_py" skipped="0" tests="0" time="0"/>
    <testsuite disabled="0" errors="0" failures="0" name="flake8.src/resources/__init___py" skipped="0" tests="0" time="0"/>
    <testsuite disabled="0" errors="0" failures="0" name="flake8.src/controller/controller_py" skipped="0" tests="0" time="0"/>
    <testsuite disabled="0" errors="0" failures="0" name="flake8.src/datasource/model/model_py" skipped="0" tests="0" time="0"/>
    <testsuite disabled="0" errors="0" failures="0" name="flake8.src/deploy/adapter/aerospike_adapter_py" skipped="0" tests="0" time="0"/>
    <testsuite disabled="0" errors="0" failures="0" name="flake8.src/controller/bestseller/best_seller_controller_py" skipped="0" tests="0" time="0"/>
    <testsuite disabled="0" errors="0" failures="0" name="flake8.src/configs/global_config_py" skipped="0" tests="0" time="0"/>
    <testsuite disabled="0" errors="0" failures="0" name="flake8.src/datasource/top_sku_category_brand_py" skipped="0" tests="0" time="0"/>
    <testsuite disabled="0" errors="0" failures="0" name="flake8.src/deploy/adapter/__init___py" skipped="0" tests="0" time="0"/>
    <testsuite disabled="0" errors="0" failures="0" name="flake8.src/migrations/alembic/env_py" skipped="0" tests="0" time="0"/>
    <testsuite disabled="0" errors="0" failures="0" name="flake8.src/datasource/top_sku_category_py" skipped="0" tests="0" time="0"/>
    <testsuite disabled="0" errors="0" failures="0" name="flake8.src/__init___py" skipped="0" tests="0" time="0"/>
    <testsuite disabled="0" errors="0" failures="0" name="flake8.src/configs/trending/__init___py" skipped="0" tests="0" time="0"/>
    <testsuite disabled="0" errors="0" failures="0" name="flake8.src/logs/__init___py" skipped="0" tests="0" time="0"/>
    <testsuite disabled="0" errors="0" failures="0" name="flake8.src/connection/__init___py" skipped="0" tests="0" time="0"/>
    <testsuite disabled="0" errors="0" failures="0" name="flake8.src/credential/__init___py" skipped="0" tests="0" time="0"/>
    <testsuite disabled="0" errors="0" failures="0" name="flake8.src/migrations/alembic/versions/69d29ab22e1b_create_best_seller_table_py" skipped="0" tests="0" time="0"/>
    <testsuite disabled="0" errors="0" failures="0" name="flake8.src/controller/most_viewed_controller_py" skipped="0" tests="0" time="0"/>
    <testsuite disabled="0" errors="0" failures="0" name="flake8.src/datasource/__init___py" skipped="0" tests="0" time="0"/>
    <testsuite disabled="0" errors="0" failures="0" name="flake8.src/controller/bestseller/best_seller_brand_controller_py" skipped="0" tests="0" time="0"/>
    <testsuite disabled="0" errors="0" failures="0" name="flake8.src/controller/recently_viewed_controller_py" skipped="0" tests="0" time="0"/>
    <testsuite disabled="0" errors="0" failures="0" name="flake8.src/datasource/top_sku_brand_py" skipped="0" tests="0" time="0"/>
    <testsuite disabled="0" errors="0" failures="0" name="flake8.src/connection/redis_db_py" skipped="0" tests="0" time="0"/>
    <testsuite disabled="0" errors="0" failures="0" name="flake8.src/controller/trending_controller_py" skipped="0" tests="0" time="0"/>
    <testsuite disabled="0" errors="0" failures="0" name="flake8.src/controller/bestseller/best_seller_category_controller_py" skipped="0" tests="0" time="0"/>
    <testsuite disabled="0" errors="0" failures="0" name="flake8.src/controller/bestseller/__init___py" skipped="0" tests="0" time="0"/>
    <testsuite disabled="0" errors="0" failures="0" name="flake8.src/utils/read_files_py" skipped="0" tests="0" time="0"/>
    <testsuite disabled="0" errors="0" failures="0" name="flake8.src/datasource/model/__init___py" skipped="0" tests="0" time="0"/>
    <testsuite disabled="0" errors="0" failures="0" name="flake8.src/validation/__init___py" skipped="0" tests="0" time="0"/>
    <testsuite disabled="0" errors="0" failures="0" name="flake8.src/controller/bestseller/best_seller_category_brand_controller_py" skipped="0" tests="0" time="0"/>
    <testsuite disabled="0" errors="0" failures="0" name="flake8.src/utils/__init___py" skipped="0" tests="0" time="0"/>
    <testsuite disabled="0" errors="0" failures="0" name="flake8.src/migrations/alembic/versions/4589f1620603_create_database_py" skipped="0" tests="0" time="0"/>
    <testsuite disabled="0" errors="0" failures="0" name="flake8.src/deploy/best_seller_deploy_py" skipped="0" tests="0" time="0"/>
    <testsuite disabled="0" errors="0" failures="0" name="flake8.src/controller/__init___py" skipped="0" tests="0" time="0"/>
    <testsuite disabled="0" errors="0" failures="0" name="flake8.src/deploy/adapter/redis_adapter_py" skipped="0" tests="0" time="0"/>
    <testsuite disabled="0" errors="0" failures="0" name="flake8.src/configs/best_seller/__init___py" skipped="0" tests="0" time="0"/>
    <testsuite disabled="0" errors="0" failures="0" name="flake8.src/deploy/__init___py" skipped="0" tests="0" time="0"/>
    <testsuite disabled="0" errors="0" failures="0" name="flake8.src/configs/most_viewed/__init___py" skipped="0" tests="0" time="0"/>
    <testsuite disabled="0" errors="0" failures="0" name="flake8.src/deploy/MostViewedDeploy_py" skipped="0" tests="0" time="0"/>
    <testsuite disabled="0" errors="0" failures="0" name="flake8.src/start_py" skipped="0" tests="0" time="0"/>
    <testsuite disabled="0" errors="0" failures="0" name="flake8.src/connection/mysql_db_py" skipped="0" tests="0" time="0"/>
    <testsuite disabled="0" errors="0" failures="0" name="flake8.src/configs/__init___py" skipped="0" tests="0" time="0"/>
</testsuites>

With 0 tests and 0 time Jenkins will not report that this is successful as no tests have been recorded.

astj commented 6 years ago

@nesl247 Thank you for reporting. I opened #6.

6 will record a success 1 success testcase per file, though your example from php-cs-fixer records 1 success testcase for whole files.

I prefer the former, but what do you think?

nesl247 commented 6 years ago

I would agree.

astj commented 6 years ago

Thank you. Released as v0.0.4.