{"action":"created","issue":{"url":"https://api.github.com/repos/picklesdoc/pickles/issues/467","repository_url":"https://api.github.com/repos/picklesdoc/pickles","labels_url":"https://api.github.com/repos/picklesdoc/pickles/issues/467/labels{/name}","comments_url":"https://api.github.com/repos/picklesdoc/pickles/issues/467/comments","events_url":"https://api.github.com/repos/picklesdoc/pickles/issues/467/events","html_url":"https://github.com/picklesdoc/pickles/issues/467","id":237374610,"number":467,"title":"Report generation doesn't consider tags/categories when locating feature elements in results","user":{"login":"freshlytyped","id":9586778,"avatar_url":"https://avatars1.githubusercontent.com/u/9586778?v=3","gravatar_id":"","url":"https://api.github.com/users/freshlytyped","html_url":"https://github.com/freshlytyped","followers_url":"https://api.github.com/users/freshlytyped/followers","following_url":"https://api.github.com/users/freshlytyped/following{/other_user}","gists_url":"https://api.github.com/users/freshlytyped/gists{/gist_id}","starred_url":"https://api.github.com/users/freshlytyped/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/freshlytyped/subscriptions","organizations_url":"https://api.github.com/users/freshlytyped/orgs","repos_url":"https://api.github.com/users/freshlytyped/repos","events_url":"https://api.github.com/users/freshlytyped/events{/privacy}","received_events_url":"https://api.github.com/users/freshlytyped/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-06-20T23:37:27Z","updated_at":"2017-06-21T16:06:33Z","closed_at":"2017-06-21T16:06:33Z","body":"Consider the following nunit result snippet:\r\n\r\n```xml\r\n<test-suite type=\"Test\" name=\"AddingSeveralNumbers\" description=\"Adding several numbers\"\r\n            executed=\"False\" result=\"Ignored\">\r\n  <categories>\r\n    <category name=\"tag1\" />\r\n  </categories>\r\n  <results>\r\n    <test-case name=\"AddingSeveralNumbers\" executed=\"False\" result=\"Ignored\" />\r\n  </results>\r\n</test-suite type>\r\n\r\n<test-suite type=\"Test\" name=\"AddingSeveralNumbers\" \r\n  description=\"Adding several numbers\" executed=\"True\" result=\"Success\" success=\"True\" time=\"0.231\" asserts=\"0\">\r\n  <categories>\r\n    <category name=\"tag2\" />\r\n  </categories>\r\n  <results>\r\n    <test-case name=\"AddingOtherNumbers\" executed=\"True\" result=\"Success\" success=\"True\" time=\"0.221\" asserts=\"0\" />\r\n  </results>\r\n</test-suite type>\r\n```\r\n\r\nAlthough the two features have been distinguished using gherkin tags resulting in different categories for each entry in the nunit output, pickles currently marks the AddingOtherNumbers scenario as \"Inconclusive\".\r\n\r\nI have solved this for my purposes with the following change, but I'd like your feedback as to whether this is a general enough solution to warrant a pull-request. It makes the assumption that all tags except @ignore translate to a category in the nunit output. If you'd like, I can submit a pull request with tests and any suggested improvements.\r\n\r\nfrom pickles/src/Pickles/Pickles.TestFrameworks/NUnit/NUnit2/NUnit2SingleResults.cs:\r\n```cs\r\nprotected override XElement GetFeatureElement(Feature feature)\r\n{\r\n    return this.resultsDocument\r\n        .Descendants(\"test-suite\")\r\n        .Where(x => x.Attribute(\"description\") != null)\r\n        .FirstOrDefault(x => x.Attribute(\"description\").Value == feature.Name \r\n                                 && FeatureHasSameCategoriesAsElement(feature, x));\r\n}\r\n\r\nprivate static bool FeatureHasSameCategoriesAsElement(Feature feature, XElement element)\r\n{\r\n    var customFeatureTags = feature.Tags.Except(new[] { \"@ignore\" }).Select(t => t.TrimStart('@'));\r\n    var elementCategories = element.Elements(\"categories\").FirstOrDefault()?.Elements(\"category\")\r\n                                   .Where(c => c.Attribute(\"name\")?.Value != null)\r\n                                   .Select(c => c.Attribute(\"name\").Value) ?? new List<string>();\r\n    return new HashSet<string>(customFeatureTags).SetEquals(elementCategories);\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/picklesdoc/pickles/issues/comments/310127369","html_url":"https://github.com/picklesdoc/pickles/issues/467#issuecomment-310127369","issue_url":"https://api.github.com/repos/picklesdoc/pickles/issues/467","id":310127369,"user":{"login":"freshlytyped","id":9586778,"avatar_url":"https://avatars1.githubusercontent.com/u/9586778?v=3","gravatar_id":"","url":"https://api.github.com/users/freshlytyped","html_url":"https://github.com/freshlytyped","followers_url":"https://api.github.com/users/freshlytyped/followers","following_url":"https://api.github.com/users/freshlytyped/following{/other_user}","gists_url":"https://api.github.com/users/freshlytyped/gists{/gist_id}","starred_url":"https://api.github.com/users/freshlytyped/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/freshlytyped/subscriptions","organizations_url":"https://api.github.com/users/freshlytyped/orgs","repos_url":"https://api.github.com/users/freshlytyped/repos","events_url":"https://api.github.com/users/freshlytyped/events{/privacy}","received_events_url":"https://api.github.com/users/freshlytyped/received_events","type":"User","site_admin":false},"created_at":"2017-06-21T16:06:33Z","updated_at":"2017-06-21T16:06:33Z","body":"The problem occurs when the same Feature name is used in multiple .Feature files, with each occurrence distinguished by tags. This allows tests to be grouped based on those tags, rather than solely by Feature name.\r\n\r\nFor example, I might have the following file structure:\r\n+- Less_Important\r\n     +- Notifier.feature  (includes the @lessImportant flag, and the @ignore flag)\r\n+- Important\r\n     +- Notifier.feature  (includes the @important flag)\r\n\r\nPickles currently marks any scenarios under the @important Notifier feature as as \"Inconclusive\", even if the provided results file has passing and failing results for those scenarios. This is because Pickles only considers the feature name when locating the feature for each scenario; all scenarios under the @important Notifier feature get mapped back to the @lessImportant Notifier feature, which is marked as @ignore."}}
{"actor":{"display_login":"freshlytyped"}}