{"action":"created","issue":{"url":"https://api.github.com/repos/cbeust/testng/issues/996","repository_url":"https://api.github.com/repos/cbeust/testng","labels_url":"https://api.github.com/repos/cbeust/testng/issues/996/labels{/name}","comments_url":"https://api.github.com/repos/cbeust/testng/issues/996/comments","events_url":"https://api.github.com/repos/cbeust/testng/issues/996/events","html_url":"https://github.com/cbeust/testng/issues/996","id":137052363,"number":996,"title":"packages test (<package name=\"package\"> inside testng.xml) initiates subpackages classes. It can make problems if subpackages classes throw exception on init.","user":{"login":"astafev","id":2178555,"avatar_url":"https://avatars.githubusercontent.com/u/2178555?v=3","gravatar_id":"","url":"https://api.github.com/users/astafev","html_url":"https://github.com/astafev","followers_url":"https://api.github.com/users/astafev/followers","following_url":"https://api.github.com/users/astafev/following{/other_user}","gists_url":"https://api.github.com/users/astafev/gists{/gist_id}","starred_url":"https://api.github.com/users/astafev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/astafev/subscriptions","organizations_url":"https://api.github.com/users/astafev/orgs","repos_url":"https://api.github.com/users/astafev/repos","events_url":"https://api.github.com/users/astafev/events{/privacy}","received_events_url":"https://api.github.com/users/astafev/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/cbeust/testng/labels/xml","name":"xml","color":"bfe5bf"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2016-02-28T13:19:10Z","updated_at":"2016-02-29T17:12:19Z","closed_at":null,"body":"In case we have test for package inside testng.xml and if some classes inside subpackage can't be inited (throw ClassNotFoundException for example), then tests will fail on start.\r\n\r\nIt can be bypassed using exclude in testng.xml:\r\n```\r\n<test name=\"test-success\">\r\n        <packages>\r\n            <package name=\"package\">\r\n                <exclude name=\"package.subpackage.*\"/>\r\n            </package>\r\n        </packages>\r\n    </test>\r\n```\r\n\r\nI created a simple project to demonstrate it: https://github.com/astafev/testng-packages-bug\r\n\r\nLooks like a bug for me.\r\nexample of exception:\r\n```\r\n[[ClassInfoMap]] Unable to open class org.springframework.aop.AopInvocationException - unable to resolve class reference org/springframework/core/NestedRuntimeException\r\njava.lang.NoClassDefFoundError: org/springframework/core/NestedRuntimeException\r\n\tat java.lang.ClassLoader.defineClass1(Native Method)\r\n\tat java.lang.ClassLoader.defineClass(ClassLoader.java:800)\r\n\tat java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)\r\n\tat java.net.URLClassLoader.defineClass(URLClassLoader.java:449)\r\n\tat java.net.URLClassLoader.access$100(URLClassLoader.java:71)\r\n\tat java.net.URLClassLoader$1.run(URLClassLoader.java:361)\r\n\tat java.net.URLClassLoader$1.run(URLClassLoader.java:355)\r\n\tat java.security.AccessController.doPrivileged(Native Method)\r\n\tat java.net.URLClassLoader.findClass(URLClassLoader.java:354)\r\n\tat java.lang.ClassLoader.loadClass(ClassLoader.java:425)\r\n\tat sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)\r\n\tat java.lang.ClassLoader.loadClass(ClassLoader.java:358)\r\n\tat org.testng.internal.ClassHelper.forName(ClassHelper.java:94)\r\n\tat org.testng.xml.XmlClass.loadClass(XmlClass.java:78)\r\n\tat org.testng.xml.XmlClass.getSupportClass(XmlClass.java:89)\r\n\tat org.testng.internal.ClassInfoMap.<init>(ClassInfoMap.java:25)\r\n\tat org.testng.internal.ClassInfoMap.<init>(ClassInfoMap.java:18)\r\n\tat org.testng.TestRunner.initMethods(TestRunner.java:408)\r\n\tat org.testng.TestRunner.init(TestRunner.java:235)\r\n\tat org.testng.TestRunner.init(TestRunner.java:205)\r\n\tat org.testng.TestRunner.<init>(TestRunner.java:153)\r\n\tat org.testng.SuiteRunner$DefaultTestRunnerFactory.newTestRunner(SuiteRunner.java:536)\r\n\tat org.testng.SuiteRunner.init(SuiteRunner.java:159)\r\n\tat org.testng.SuiteRunner.<init>(SuiteRunner.java:113)\r\n\tat org.testng.TestNG.createSuiteRunner(TestNG.java:1299)\r\n\tat org.testng.TestNG.createSuiteRunners(TestNG.java:1286)\r\n\tat org.testng.TestNG.runSuitesLocally(TestNG.java:1140)\r\n\tat org.testng.TestNG.run(TestNG.java:1057)\r\n\tat org.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:72)\r\n\tat org.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:121)\r\n\tat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\r\n\tat sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)\r\n\tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\r\n\tat java.lang.reflect.Method.invoke(Method.java:606)\r\n\tat com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)\r\nCaused by: java.lang.ClassNotFoundException: org.springframework.core.NestedRuntimeException\r\n\tat java.net.URLClassLoader$1.run(URLClassLoader.java:366)\r\n\tat java.net.URLClassLoader$1.run(URLClassLoader.java:355)\r\n\tat java.security.AccessController.doPrivileged(Native Method)\r\n\tat java.net.URLClassLoader.findClass(URLClassLoader.java:354)\r\n\tat java.lang.ClassLoader.loadClass(ClassLoader.java:425)\r\n\tat sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)\r\n\tat java.lang.ClassLoader.loadClass(ClassLoader.java:358)\r\n\t... 35 more\r\n```"},"comment":{"url":"https://api.github.com/repos/cbeust/testng/issues/comments/190295275","html_url":"https://github.com/cbeust/testng/issues/996#issuecomment-190295275","issue_url":"https://api.github.com/repos/cbeust/testng/issues/996","id":190295275,"user":{"login":"cbeust","id":92322,"avatar_url":"https://avatars.githubusercontent.com/u/92322?v=3","gravatar_id":"","url":"https://api.github.com/users/cbeust","html_url":"https://github.com/cbeust","followers_url":"https://api.github.com/users/cbeust/followers","following_url":"https://api.github.com/users/cbeust/following{/other_user}","gists_url":"https://api.github.com/users/cbeust/gists{/gist_id}","starred_url":"https://api.github.com/users/cbeust/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cbeust/subscriptions","organizations_url":"https://api.github.com/users/cbeust/orgs","repos_url":"https://api.github.com/users/cbeust/repos","events_url":"https://api.github.com/users/cbeust/events{/privacy}","received_events_url":"https://api.github.com/users/cbeust/received_events","type":"User","site_admin":false},"created_at":"2016-02-29T17:12:19Z","updated_at":"2016-02-29T17:12:19Z","body":"Agreed, if there’s no .*, then only packages named exactly as specified\n(not sub packages) should be included.\n​\n\n-- \nCédric\n\n\nOn Mon, Feb 29, 2016 at 8:29 PM, Julien Herr <notifications@github.com>\nwrote:\n\n> The DTD says:\n>\n> <!-- The package description.     If the package name ends with .* then subpackages are included too.-->\n> <!ELEMENT package (include?,exclude?)*>\n> <!ATTLIST package\n>     name CDATA #REQUIRED >\n>\n> Then, I think <package name=\"package\"/> and <package name=\"package.*\"/>\n> should not be equivalent, and <package name=\"package\"/> should not\n> include subpackages.\n>\n> What do you think @cbeust <https://github.com/cbeust> ?\n>\n> —\n> Reply to this email directly or view it on GitHub\n> <https://github.com/cbeust/testng/issues/996#issuecomment-190277889>.\n>\n"}}