{"action":"created","issue":{"url":"https://api.github.com/repos/cbeust/testng/issues/1773","repository_url":"https://api.github.com/repos/cbeust/testng","labels_url":"https://api.github.com/repos/cbeust/testng/issues/1773/labels{/name}","comments_url":"https://api.github.com/repos/cbeust/testng/issues/1773/comments","events_url":"https://api.github.com/repos/cbeust/testng/issues/1773/events","html_url":"https://github.com/cbeust/testng/issues/1773","id":319029706,"number":1773,"title":"Parallel=\"classes\" executes methods of test class in different threads","user":{"login":"ryudice","id":125211,"avatar_url":"https://avatars3.githubusercontent.com/u/125211?v=4","gravatar_id":"","url":"https://api.github.com/users/ryudice","html_url":"https://github.com/ryudice","followers_url":"https://api.github.com/users/ryudice/followers","following_url":"https://api.github.com/users/ryudice/following{/other_user}","gists_url":"https://api.github.com/users/ryudice/gists{/gist_id}","starred_url":"https://api.github.com/users/ryudice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ryudice/subscriptions","organizations_url":"https://api.github.com/users/ryudice/orgs","repos_url":"https://api.github.com/users/ryudice/repos","events_url":"https://api.github.com/users/ryudice/events{/privacy}","received_events_url":"https://api.github.com/users/ryudice/received_events","type":"User","site_admin":false},"labels":[{"id":239156267,"url":"https://api.github.com/repos/cbeust/testng/labels/Feature:%20parallel","name":"Feature: parallel","color":"0e8a16","default":false},{"id":259875963,"url":"https://api.github.com/repos/cbeust/testng/labels/Feature:%20priority","name":"Feature: priority","color":"0e8a16","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-04-30T20:45:58Z","updated_at":"2018-05-01T04:59:25Z","closed_at":null,"author_association":"NONE","body":"### TestNG Version\r\n6.14.3\r\n\r\n### Expected behavior\r\nWhen using parallel=\"classes\" attribute in a suite XML file and using either the \"dependsOnMethods\" or the \"priority\" attribute on the test annotation it should run classes in parallel and the methods of each of the classes in the same thread\r\n\r\n### Actual behavior\r\nUsing parallel=\"classes\" on test methods with the priority or dependsOnMethods properties defined causes each of the methods of the test class to run in different thread, eventhough they seem to run sequentially.\r\n\r\n\r\n### Is the issue reproductible on runner?\r\nI'm passing the suite xml file to the testng runner.\r\n\r\n- [ ] Shell\r\n- [ ] Maven\r\n- [ ] Gradle\r\n- [ ] Ant\r\n- [ ] Eclipse\r\n- [ ] IntelliJ\r\n- [ ] NetBeans\r\n\r\n\r\n### Test case sample\r\nIf you create a test class like this: \r\n\r\n```java\r\npublic class PriorityTest2 {\r\n\r\n    @Test(priority = 1)\r\n    public void FirstTest(){\r\n        System.out.println(\"First test ran\");\r\n        System.out.println(Thread.currentThread().getId());\r\n    }\r\n\r\n    @Test(priority = 2)\r\n    public void SecondTest(){\r\n        System.out.println(\"Second test ran\");\r\n        System.out.println(Thread.currentThread().getId());\r\n    }\r\n\r\n    @Test(priority = 3)\r\n    public void ThridTest(){\r\n        System.out.println(\"Third test ran\");\r\n        System.out.println(Thread.currentThread().getId());\r\n    }\r\n}\r\n```\r\n\r\nand then a suite XML file like this:\r\n\r\n```xml\r\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<suite name=\"Mozilla Test Suite\" parallel=\"classes\" thread-count=\"6\" >\r\n    <test name=\"Test 1\" group-by-instances=\"true\" >\r\n        <classes>\r\n            <class name = \"PriorityTest\"/>\r\n        </classes>\r\n    </test>\r\n</suite>\r\n```\r\n\r\nYou get the following output:\r\n```\r\nFirst test ran\r\n12\r\nSecond test ran\r\n13\r\nThird test ran\r\n14\r\n```\r\n\r\nHowever if you change the test suite to use parallel='tests', then you get the correct output, which is each test method running in the same thread:\r\n\r\n```\r\nFirst test ran\r\n12\r\nSecond test ran\r\n12\r\nThird test ran\r\n12\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/cbeust/testng/issues/comments/385599686","html_url":"https://github.com/cbeust/testng/issues/1773#issuecomment-385599686","issue_url":"https://api.github.com/repos/cbeust/testng/issues/1773","id":385599686,"user":{"login":"tetienne","id":8216238,"avatar_url":"https://avatars1.githubusercontent.com/u/8216238?v=4","gravatar_id":"","url":"https://api.github.com/users/tetienne","html_url":"https://github.com/tetienne","followers_url":"https://api.github.com/users/tetienne/followers","following_url":"https://api.github.com/users/tetienne/following{/other_user}","gists_url":"https://api.github.com/users/tetienne/gists{/gist_id}","starred_url":"https://api.github.com/users/tetienne/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tetienne/subscriptions","organizations_url":"https://api.github.com/users/tetienne/orgs","repos_url":"https://api.github.com/users/tetienne/repos","events_url":"https://api.github.com/users/tetienne/events{/privacy}","received_events_url":"https://api.github.com/users/tetienne/received_events","type":"User","site_admin":false},"created_at":"2018-05-01T04:59:25Z","updated_at":"2018-05-01T04:59:25Z","author_association":"NONE","body":"Seems a duplicate of #1185"}}
{"actor":{"display_login":"tetienne"}}