Skip to content

defects,randomconfiguration is supported by implementation, but it is not allowed by the XML configuration file schema #6254

@staabm

Description

@staabm
Q A
PHPUnit version 11.5.24
PHP version 8.3.22
Installation Method Composer / PHAR

Summary

a execution order of "defects,random" seems to be a useful choice, as it combines a very fast feedback loop when re-running previously failed tests while it also allows random test order to harden tests against ordering problems

Current behavior

using a phpunit.xml like

<?xml version="1.0" encoding="UTF-8"?> <phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd" bootstrap="./vendor/autoload.php" colors="true" executionOrder="defects,random" failOnWarning="true" failOnRisky="true" requireCoverageMetadata="true" displayDetailsOnPhpunitDeprecations="true" displayDetailsOnTestsThatTriggerDeprecations="true" displayDetailsOnTestsThatTriggerWarnings="true" cacheDirectory="./build/cache/phpunit" > 

works like expected, but xml validation fails, since defects,random is not a valid combiation per XSD:
see

phpunit/phpunit.xsd

Lines 117 to 138 in 6c7855f

<xs:simpleType name="executionOrderType">
<xs:restriction base="xs:string">
<xs:enumeration value="default"/>
<xs:enumeration value="defects"/>
<xs:enumeration value="depends"/>
<xs:enumeration value="depends,defects"/>
<xs:enumeration value="depends,duration"/>
<xs:enumeration value="depends,random"/>
<xs:enumeration value="depends,reverse"/>
<xs:enumeration value="depends,size"/>
<xs:enumeration value="duration"/>
<xs:enumeration value="no-depends"/>
<xs:enumeration value="no-depends,defects"/>
<xs:enumeration value="no-depends,duration"/>
<xs:enumeration value="no-depends,random"/>
<xs:enumeration value="no-depends,reverse"/>
<xs:enumeration value="no-depends,size"/>
<xs:enumeration value="random"/>
<xs:enumeration value="reverse"/>
<xs:enumeration value="size"/>
</xs:restriction>
</xs:simpleType>

PHPStorm screenshot:

Image

How to reproduce

change phpunit.xml to
executionOrder="defects,random"

Expected behavior

it should be a valid option to use "defects,random"

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions