{"action":"created","issue":{"url":"https://api.github.com/repos/cbeust/testng/issues/1131","repository_url":"https://api.github.com/repos/cbeust/testng","labels_url":"https://api.github.com/repos/cbeust/testng/issues/1131/labels{/name}","comments_url":"https://api.github.com/repos/cbeust/testng/issues/1131/comments","events_url":"https://api.github.com/repos/cbeust/testng/issues/1131/events","html_url":"https://github.com/cbeust/testng/issues/1131","id":174347348,"number":1131,"title":"IObjectFactory not being called for factory test instances with constructor-injected data provider","user":{"login":"mccluresc","id":4512030,"avatar_url":"https://avatars.githubusercontent.com/u/4512030?v=3","gravatar_id":"","url":"https://api.github.com/users/mccluresc","html_url":"https://github.com/mccluresc","followers_url":"https://api.github.com/users/mccluresc/followers","following_url":"https://api.github.com/users/mccluresc/following{/other_user}","gists_url":"https://api.github.com/users/mccluresc/gists{/gist_id}","starred_url":"https://api.github.com/users/mccluresc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mccluresc/subscriptions","organizations_url":"https://api.github.com/users/mccluresc/orgs","repos_url":"https://api.github.com/users/mccluresc/repos","events_url":"https://api.github.com/users/mccluresc/events{/privacy}","received_events_url":"https://api.github.com/users/mccluresc/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/cbeust/testng/labels/Feature:%20factory","name":"Feature: factory","color":"0e8a16"},{"url":"https://api.github.com/repos/cbeust/testng/labels/Feature:%20objectfactory","name":"Feature: objectfactory","color":"0e8a16"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-08-31T18:42:22Z","updated_at":"2016-09-04T15:43:33Z","closed_at":null,"body":"Hi,\r\nThe behavior of IObjectFactory with factories and data providers appears to be inconsistent.\r\n\r\nI created 3 tests:\r\n TestClass1: No factory, just a single test method\r\n TestClass2: A constructor annotated with a factory annotation and a single string parameter with a static data provider method (returning \"foo\" and \"bar\") and single test method.\r\nTestClass3: A constructor annotated with a factory annotation and a single int parameter with a static data provider method (returning 1 and 2) and single test method.\r\n\r\nI also created an IObjectFactory that extends the internal ObjectFactoryImpl and logs its execution.\r\n\r\nRunning the three tests I find:\r\n```\r\nfactory providing new instance of TestClass1\r\ntest class 1 constructor\r\nfactory providing new instance of TestClass2\r\n - parameter: Default test name\r\ntest class 2 constructor with parameter:Default test name\r\ntest class 2 constructor with parameter:foo\r\ntest class 2 constructor with parameter:bar\r\ntest class 3 constructor with parameter:1\r\ntest class 3 constructor with parameter:2\r\n[TestNG] Running:\r\n  C:\\Users\\scott.mcclure\\workspace\\ObjectFactoryTest\\testng.xml\r\n\r\n\r\n===============================================\r\nsuite\r\nTotal tests run: 5, Failures: 0, Skips: 0\r\n===============================================\r\n```\r\n\r\nThis brings up the following issues;\r\n- Why does the test class 2 get constructed with \"Default test name\"?\r\n- Why do the other tests with constructor parameters bypass the IObjectFactory?\r\n\r\nTest case attached.\r\n[ObjectFactoryTest.zip](https://github.com/cbeust/testng/files/448023/ObjectFactoryTest.zip)\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/cbeust/testng/issues/comments/244610556","html_url":"https://github.com/cbeust/testng/issues/1131#issuecomment-244610556","issue_url":"https://api.github.com/repos/cbeust/testng/issues/1131","id":244610556,"user":{"login":"mccluresc","id":4512030,"avatar_url":"https://avatars.githubusercontent.com/u/4512030?v=3","gravatar_id":"","url":"https://api.github.com/users/mccluresc","html_url":"https://github.com/mccluresc","followers_url":"https://api.github.com/users/mccluresc/followers","following_url":"https://api.github.com/users/mccluresc/following{/other_user}","gists_url":"https://api.github.com/users/mccluresc/gists{/gist_id}","starred_url":"https://api.github.com/users/mccluresc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mccluresc/subscriptions","organizations_url":"https://api.github.com/users/mccluresc/orgs","repos_url":"https://api.github.com/users/mccluresc/repos","events_url":"https://api.github.com/users/mccluresc/events{/privacy}","received_events_url":"https://api.github.com/users/mccluresc/received_events","type":"User","site_admin":false},"created_at":"2016-09-04T15:43:33Z","updated_at":"2016-09-04T15:43:33Z","body":"I obviously prefer option 2 as well :-) I wonder if we can maintain the backwards compatibility for the string constructor case only if there is no dataprovider configured - it would be very confusing if the data provider got ignored only for one string argument.\r\n\r\nFor the record, it seems like [others](http://testng.1065351.n5.nabble.com/IObjectFactory-bug-td11200.html) hit this in the past, but the issue got dropped.\r\n"}}
{"actor":{"display_login":"mccluresc"}}