{"action":"created","issue":{"url":"https://api.github.com/repos/symfony/symfony/issues/17366","labels_url":"https://api.github.com/repos/symfony/symfony/issues/17366/labels{/name}","comments_url":"https://api.github.com/repos/symfony/symfony/issues/17366/comments","events_url":"https://api.github.com/repos/symfony/symfony/issues/17366/events","html_url":"https://github.com/symfony/symfony/issues/17366","id":126625049,"number":17366,"title":"Let's make Symfony tests faster","user":{"login":"javiereguiluz","id":73419,"avatar_url":"https://avatars.githubusercontent.com/u/73419?v=3","gravatar_id":"","url":"https://api.github.com/users/javiereguiluz","html_url":"https://github.com/javiereguiluz","followers_url":"https://api.github.com/users/javiereguiluz/followers","following_url":"https://api.github.com/users/javiereguiluz/following{/other_user}","gists_url":"https://api.github.com/users/javiereguiluz/gists{/gist_id}","starred_url":"https://api.github.com/users/javiereguiluz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/javiereguiluz/subscriptions","organizations_url":"https://api.github.com/users/javiereguiluz/orgs","repos_url":"https://api.github.com/users/javiereguiluz/repos","events_url":"https://api.github.com/users/javiereguiluz/events{/privacy}","received_events_url":"https://api.github.com/users/javiereguiluz/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":19,"created_at":"2016-01-14T10:32:52Z","updated_at":"2016-01-28T08:41:21Z","closed_at":null,"body":"### Problem\r\n\r\nThanks to the work of @nicolas-grekas and the community, Symfony tests are faster every day. But we can do better.\r\n\r\nI've analyzed the Symfony 2.3 test suite and I've found that **some tests are very slow**. I can think of 3 reasons for a slow test:\r\n\r\n1. It's slow because the tested Symfony feature is slow. Let's try to fix that feature.\r\n2. It's slow because the test code is not good enough. Let's fix the test.\r\n3. It's slow because the test or the Symfony feature are complicated. Nothing is wrong with the test. Don't change anything.\r\n\r\n### Solution\r\n\r\n* I propose to work on fixing the slowest Symfony tests. \r\n* If you are experienced with Symfony, add a comment in this issue saying which tests are you going to working on, so we don't duplicate the work (e.g. *I'm looking into Process component tests*).\r\n* If you are new to Symfony and want to contribute, you can ask me for help or guidance.\r\n\r\nWhen fixing a test/feature to make it faster, keep in mind that we'll reject:\r\n\r\n* Meaningless changes (e.g. replace single quotes by double quotes).\r\n* Changes that destroy code readability.\r\n\r\nIn case of doubt, ask us!\r\n\r\n### Details\r\n\r\nI took the fastest test as reference (in my machine it was `InputArgumentTest::testGetDefault`) and this is the list of the slowest Symfony tests:\r\n\r\n#### Tests which are at least 10,000 times slower than the fastest test\r\n\r\n```\r\n 21,107x slower : Symfony\\Component\\HttpFoundation\\Tests\\Session\\Storage\\MetadataBagTest::testInitialize\r\n 20,186x slower : Symfony\\Component\\Routing\\Tests\\Generator\\Dumper\\PhpGeneratorDumperTest::testDumpWithTooManyRoutes\r\n 12,647x slower : Symfony\\Component\\Process\\Tests\\ProcessTest::testProcessPipes with data set #9\r\n [WORKING ON THIS] 10,754x slower : Symfony\\Component\\Filesystem\\Tests\\FilesystemTest::testCopyForOriginUrlsAndExistingLocalFileDefaultsToNotCopy\r\n 10,601x slower : Symfony\\Component\\Finder\\Tests\\Iterator\\SortableIteratorTest::testAccept with data set #2\r\n 10,570x slower : Symfony\\Component\\Finder\\Tests\\Iterator\\SortableIteratorTest::testAccept with data set #4\r\n 10,569x slower : Symfony\\Component\\Finder\\Tests\\Iterator\\SortableIteratorTest::testAccept with data set #3\r\n```\r\n\r\n#### Tests which are at least 1,000 times slower than the fastest test\r\n\r\n```\r\n  9,453x slower : Symfony\\Bundle\\SecurityBundle\\Tests\\Functional\\SecurityRoutingIntegrationTest::testRoutingErrorIsExposedWhenNotProtected with data set #0 ('config.yml')\r\n  9,348x slower : Symfony\\Component\\Finder\\Tests\\Iterator\\RecursiveDirectoryIteratorTest::testRewindOnFtp\r\n  8,898x slower : Symfony\\Component\\Finder\\Tests\\Iterator\\RecursiveDirectoryIteratorTest::testSeekOnFtp\r\n  8,420x slower : Symfony\\Bundle\\SecurityBundle\\Tests\\Functional\\SecurityRoutingIntegrationTest::testRoutingErrorIsNotExposedForProtectedResourceWhenLoggedInWithInsufficientRights with data set #1 ('routes_as_path.yml')\r\n  8,154x slower : Symfony\\Bundle\\FrameworkBundle\\Tests\\Functional\\SessionTest::testTwoClients with data set #0 ('config.yml', true)\r\n  7,588x slower : Symfony\\Component\\Process\\Tests\\ProcessTest::testProcessPipes with data set #8 ('fwrite(STDOUT, $in = file_get... $in);', 4096)\r\n  7,074x slower : Symfony\\Bundle\\SecurityBundle\\Tests\\Functional\\SecurityRoutingIntegrationTest::testRoutingErrorIsNotExposedForProtectedResourceWhenLoggedInWithInsufficientRights with data set #0 ('config.yml')\r\n  7,064x slower : Symfony\\Bundle\\SecurityBundle\\Tests\\Functional\\SecurityRoutingIntegrationTest::testSecurityConfigurationForMultipleIPAddresses with data set #0 ('config.yml')\r\n  6,997x slower : Symfony\\Bundle\\SecurityBundle\\Tests\\Functional\\SecurityRoutingIntegrationTest::testSecurityConfigurationForMultipleIPAddresses with data set #1 ('routes_as_path.yml')\r\n  6,838x slower : Symfony\\Bundle\\SecurityBundle\\Tests\\Functional\\SecurityRoutingIntegrationTest::testRoutingErrorIsExposedWhenNotProtected with data set #1 ('routes_as_path.yml')\r\n  6,774x slower : Symfony\\Bundle\\SecurityBundle\\Tests\\Functional\\CsrfFormLoginTest::testFormLoginAndLogoutWithCsrfTokens with data set #0 ('config.yml')\r\n  6,014x slower : Symfony\\Bundle\\SecurityBundle\\Tests\\Functional\\FormLoginTest::testFormLogin with data set #1 ('routes_as_path.yml')\r\n  5,859x slower : Symfony\\Bundle\\SecurityBundle\\Tests\\Functional\\LocalizedRoutesAsPathTest::testLoginLogoutProcedure with data set #0 ('en')\r\n  5,800x slower : Symfony\\Bundle\\SecurityBundle\\Tests\\Functional\\LocalizedRoutesAsPathTest::testLoginFailureWithLocalizedFailurePath with data set #0 ('en')\r\n  5,646x slower : Symfony\\Bundle\\SecurityBundle\\Tests\\Functional\\SwitchUserTest::testSwitchedUserCannotSwitchToOther\r\n  4,590x slower : Symfony\\Bundle\\FrameworkBundle\\Tests\\Functional\\SessionTest::testWelcome with data set #0 ('config.yml', true)\r\n  4,276x slower : Symfony\\Component\\Stopwatch\\Tests\\StopwatchEventTest::testDuration\r\n  4,142x slower : Symfony\\Bundle\\SecurityBundle\\Tests\\Functional\\FormLoginTest::testFormLogin with data set #0 ('config.yml')\r\n  4,141x slower : Symfony\\Bundle\\SecurityBundle\\Tests\\Functional\\CsrfFormLoginTest::testFormLoginAndLogoutWithCsrfTokens with data set #1 ('routes_as_path.yml')\r\n  3,977x slower : Symfony\\Bundle\\SecurityBundle\\Tests\\Functional\\LocalizedRoutesAsPathTest::testAccessRestrictedResourceWithForward with data set #0 ('en')\r\n  3,941x slower : Symfony\\Bundle\\SecurityBundle\\Tests\\Functional\\SecurityRoutingIntegrationTest::testRoutingErrorIsNotExposedForProtectedResourceWhenAnonymous with data set #1 ('routes_as_path.yml')\r\n  3,874x slower : Symfony\\Bundle\\SecurityBundle\\Tests\\Functional\\SwitchUserTest::testSwitchUser with data set \"authorized_user_cannot_switch_to_non_existent\" ('user_can_switch', 'user_does_not_exist', 'user_can_switch', 500)\r\n  3,849x slower : Symfony\\Bundle\\SecurityBundle\\Tests\\Functional\\SecurityRoutingIntegrationTest::testRoutingErrorIsNotExposedForProtectedResourceWhenAnonymous with data set #0 ('config.yml')\r\n  3,804x slower : Symfony\\Bundle\\SecurityBundle\\Tests\\Functional\\AuthenticationCommencingTest::testAuthenticationIsCommencingIfAccessDeniedExceptionIsWrapped\r\n  3,690x slower : Symfony\\Bundle\\SecurityBundle\\Tests\\Functional\\SecurityRoutingIntegrationTest::testSecurityConfigurationForSingleIPAddress with data set #0 ('config.yml')\r\n  3,686x slower : Symfony\\Bundle\\SecurityBundle\\Tests\\Functional\\SecurityRoutingIntegrationTest::testSecurityConfigurationForSingleIPAddress with data set #1 ('routes_as_path.yml')\r\n  3,332x slower : Symfony\\Bundle\\SecurityBundle\\Tests\\Functional\\FirewallEntryPointTest::testItUsesTheConfiguredEntryPointWhenUsingUnknownCredentials\r\n  3,278x slower : Symfony\\Bundle\\SecurityBundle\\Tests\\Functional\\FirewallEntryPointTest::testItUsesTheConfiguredEntryPointFromTheExceptionListenerWithFormLoginAndNoCredentials\r\n  3,116x slower : Symfony\\Component\\Process\\Tests\\ProcessTest::testGetExitCodeIsNullOnWhenStartingAgain\r\n  3,006x slower : Symfony\\Bundle\\FrameworkBundle\\Tests\\Functional\\ProfilerTest::testProfilerIsDisabled with data set #1 (true)\r\n  2,816x slower : Symfony\\Bundle\\FrameworkBundle\\Tests\\Functional\\SessionTest::testFlash with data set #0 ('config.yml', true)\r\n  2,323x slower : Symfony\\Bundle\\FrameworkBundle\\Tests\\Command\\CacheClearCommand\\CacheClearCommandTest::testCacheIsFreshAfterCacheClearedWithWarmup\r\n  2,278x slower : Symfony\\Component\\Process\\Tests\\ProcessTest::testStartAfterATimeout\r\n  2,214x slower : Symfony\\Component\\Stopwatch\\Tests\\StopwatchEventTest::testEnsureStopped\r\n  2,176x slower : Symfony\\Component\\Process\\Tests\\ProcessTest::testRunProcessWithTimeout\r\n  2,166x slower : Symfony\\Component\\Stopwatch\\Tests\\StopwatchTest::testStop\r\n  2,005x slower : Symfony\\Bundle\\SecurityBundle\\Tests\\DependencyInjection\\YamlCompleteConfigurationTest::testEncoders\r\n  1,991x slower : Symfony\\Bundle\\SecurityBundle\\Tests\\Functional\\CsrfFormLoginTest::testFormLoginWithInvalidCsrfToken with data set #1 ('routes_as_path.yml')\r\n  1,938x slower : Symfony\\Bundle\\FrameworkBundle\\Tests\\Templating\\Helper\\FormHelperDivLayoutTest::testRest\r\n  1,848x slower : Symfony\\Bridge\\Twig\\Tests\\Extension\\FormExtensionDivLayoutTest::testThemeBlockInheritanceUsingUse\r\n  [IMPROVED] 1,784x slower : Symfony\\Bundle\\FrameworkBundle\\Tests\\DependencyInjection\\XmlFrameworkExtensionTest::testDisabledProfiler\r\n  [IMPROVED] 1,758x slower : Symfony\\Bundle\\FrameworkBundle\\Tests\\DependencyInjection\\YamlFrameworkExtensionTest::testValidation\r\n  [IMPROVED] 1,736x slower : Symfony\\Bundle\\FrameworkBundle\\Tests\\DependencyInjection\\XmlFrameworkExtensionTest::testValidation\r\n  1,732x slower : Symfony\\Bundle\\FrameworkBundle\\Tests\\DependencyInjection\\YamlFrameworkExtensionTest::testEsi\r\n  [IMPROVED] 1,703x slower : Symfony\\Bundle\\FrameworkBundle\\Tests\\DependencyInjection\\PhpFrameworkExtensionTest::testValidation\r\n  [IMPROVED] 1,680x slower : Symfony\\Bundle\\FrameworkBundle\\Tests\\DependencyInjection\\PhpFrameworkExtensionTest::testEsi\r\n  1,658x slower : Symfony\\Bundle\\SecurityBundle\\Tests\\DependencyInjection\\XmlCompleteConfigurationTest::testEncoders\r\n  1,617x slower : Symfony\\Component\\HttpKernel\\Tests\\HttpCache\\HttpCacheTest::testDoesNotCacheSomeStatusCodeResponses\r\n  1,614x slower : Symfony\\Bundle\\SecurityBundle\\Tests\\DependencyInjection\\PhpCompleteConfigurationTest::testRolesHierarchy\r\n  1,604x slower : Symfony\\Component\\Process\\Tests\\ProcessTest::testGetExitCodeIsNullOnStart\r\n  1,587x slower : Symfony\\Component\\Process\\Tests\\ProcessTest::testIsSuccessfulOnlyAfterTerminated\r\n  1,574x slower : Symfony\\Bundle\\SecurityBundle\\Tests\\DependencyInjection\\SecurityExtensionTest::testFirewallWithoutAuthenticationListener\r\n  1,560x slower : Symfony\\Component\\Process\\Tests\\ProcessTest::testStatus\r\n  1,536x slower : Symfony\\Component\\Process\\Tests\\ProcessTest::testTTYCommand\r\n  1,462x slower : Symfony\\Component\\Process\\Tests\\ProcessTest::testStopWithTimeoutIsActuallyWorking\r\n  1,377x slower : Symfony\\Bundle\\FrameworkBundle\\Tests\\Templating\\Helper\\FormHelperDivLayoutTest::testDateTime\r\n  1,358x slower : Symfony\\Bundle\\FrameworkBundle\\Tests\\Templating\\Helper\\FormHelperTableLayoutTest::testSingleChoiceRequiredWithEmptyValueViaView\r\n  1,329x slower : Symfony\\Bundle\\FrameworkBundle\\Tests\\Templating\\Helper\\FormHelperTableLayoutTest::testMoney\r\n  1,285x slower : Symfony\\Bundle\\FrameworkBundle\\Tests\\Templating\\Helper\\FormHelperDivLayoutTest::testTimeWithEmptyValueGlobal\r\n  1,260x slower : Symfony\\Component\\Form\\Tests\\Extension\\Validator\\Type\\FormTypeValidatorExtensionTest::testValidationGroupsCanBeSetToCallback\r\n  1,253x slower : Symfony\\Bridge\\ProxyManager\\Tests\\LazyProxy\\PhpDumper\\ProxyDumperTest::testGetProxyCode\r\n  1,227x slower : Symfony\\Bundle\\FrameworkBundle\\Tests\\DependencyInjection\\ConfigurationTest::testValidTrustedProxies with data set #3 (null, array())\r\n  1,174x slower : Symfony\\Component\\Console\\Tests\\Helper\\DialogHelperTest::testAskWithAutocomplete\r\n  1,146x slower : Symfony\\Component\\Process\\Tests\\ProcessTest::testCheckTimeoutOnStartedProcess\r\n  1,119x slower : Symfony\\Component\\BrowserKit\\Tests\\ClientTest::testInsulatedRequests\r\n  1,117x slower : Symfony\\Component\\Validator\\Tests\\Constraints\\CardSchemeValidatorTest::testInvalidNumbers with data set #0 ('VISA', '42424242424242424242')\r\n  1,106x slower : Symfony\\Component\\Finder\\Tests\\BsdFinderTest::testName\r\n  1,083x slower : Symfony\\Component\\ClassLoader\\Tests\\ClassCollectionLoaderTest::testCommentStripping\r\n  1,074x slower : Symfony\\Bundle\\FrameworkBundle\\Tests\\Functional\\FragmentTest::testFragment with data set #1 (true)\r\n  1,073x slower : Symfony\\Component\\Stopwatch\\Tests\\StopwatchEventTest::testStartTime\r\n  1,065x slower : Symfony\\Component\\Process\\Tests\\ProcessTest::testRestart\r\n  1,061x slower : Symfony\\Component\\HttpFoundation\\Tests\\File\\FileTest::testMove\r\n  1,014x slower : Symfony\\Component\\Intl\\Tests\\NumberFormatter\\Verification\\NumberFormatterTest::testFormatRoundingModeHalfEven with data set #0 (1.121, '1.12')\r\n  1,007x slower : Symfony\\Component\\Form\\Tests\\CompoundFormTest::testSetDataSupportsDynamicAdditionAndRemovalOfChildren\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/symfony/symfony/issues/comments/176057776","html_url":"https://github.com/symfony/symfony/issues/17366#issuecomment-176057776","issue_url":"https://api.github.com/repos/symfony/symfony/issues/17366","id":176057776,"user":{"login":"Jean85","id":6729988,"avatar_url":"https://avatars.githubusercontent.com/u/6729988?v=3","gravatar_id":"","url":"https://api.github.com/users/Jean85","html_url":"https://github.com/Jean85","followers_url":"https://api.github.com/users/Jean85/followers","following_url":"https://api.github.com/users/Jean85/following{/other_user}","gists_url":"https://api.github.com/users/Jean85/gists{/gist_id}","starred_url":"https://api.github.com/users/Jean85/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Jean85/subscriptions","organizations_url":"https://api.github.com/users/Jean85/orgs","repos_url":"https://api.github.com/users/Jean85/repos","events_url":"https://api.github.com/users/Jean85/events{/privacy}","received_events_url":"https://api.github.com/users/Jean85/received_events","type":"User","site_admin":false},"created_at":"2016-01-28T08:41:20Z","updated_at":"2016-01-28T08:41:20Z","body":"I don't think that tests with sleeps are an issue: since we are running them in parallel, while they sleep other tests will have their (CPU) time to do their work..."}}