{"action":"created","issue":{"url":"https://api.github.com/repos/smartystreets/goconvey/issues/425","repository_url":"https://api.github.com/repos/smartystreets/goconvey","labels_url":"https://api.github.com/repos/smartystreets/goconvey/issues/425/labels{/name}","comments_url":"https://api.github.com/repos/smartystreets/goconvey/issues/425/comments","events_url":"https://api.github.com/repos/smartystreets/goconvey/issues/425/events","html_url":"https://github.com/smartystreets/goconvey/issues/425","id":150601975,"number":425,"title":"Convey registration with some side effects and panics","user":{"login":"yuriy-yarosh","id":6811933,"avatar_url":"https://avatars.githubusercontent.com/u/6811933?v=3","gravatar_id":"","url":"https://api.github.com/users/yuriy-yarosh","html_url":"https://github.com/yuriy-yarosh","followers_url":"https://api.github.com/users/yuriy-yarosh/followers","following_url":"https://api.github.com/users/yuriy-yarosh/following{/other_user}","gists_url":"https://api.github.com/users/yuriy-yarosh/gists{/gist_id}","starred_url":"https://api.github.com/users/yuriy-yarosh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yuriy-yarosh/subscriptions","organizations_url":"https://api.github.com/users/yuriy-yarosh/orgs","repos_url":"https://api.github.com/users/yuriy-yarosh/repos","events_url":"https://api.github.com/users/yuriy-yarosh/events{/privacy}","received_events_url":"https://api.github.com/users/yuriy-yarosh/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-04-23T22:15:00Z","updated_at":"2016-04-24T04:51:07Z","closed_at":null,"body":"So, it's related to the Issue https://github.com/smartystreets/goconvey/issues/288\r\n\r\nIn my case it's a side effect when several Conveys with the same name are registered inside a loop:\r\n```\r\nConvey(\"SDP Session description should be valid\", func() {\r\n\tfor _, packet := range sdpFixtures {\r\n\t\tfor lineNum, line := range strings.Split(packet, \"\\n\") {\r\n\t\t\tConvey(\"This one will cause panics\", func() {})\r\n\r\n\t\t\tfor isVal, typeOrValue := range strings.Split(line, \"=\") {\r\n\t\t\t\tSo(typeOrValue, ShouldNotBeNil)\r\n\t\t\t\tSo(typeOrValue, ShouldNotBeBlank)\r\n\r\n\t\t\t\tif lineNum == 0 && isVal == 0 {\r\n\t\t\t\t\tConvey(\"This one will be executed, if your PC is fast enough to not cause a panic\", func() {\r\n\t\t\t\t\t\tSo(typeOrValue, ShouldEqual, \"v\")\r\n\t\t\t\t\t})\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n})\r\n```\r\n\r\nIt's related to the Convey registration inside the `convey/context.go`:\r\n```\r\nfunc (ctx *context) Convey(items ...interface{}) {\r\n\tentry := discover(items)\r\n\r\n\t// we're a branch, or leaf (on the wind)\r\n\tif entry.Test != nil {\r\n\t\tconveyPanic(extraGoTest)\r\n\t}\r\n\tif ctx.focus && !entry.Focus {\r\n\t\treturn\r\n\t}\r\n\r\n\tvar inner_ctx *context\r\n\tif ctx.executedOnce {\r\n\t\tvar ok bool\r\n\t\tinner_ctx, ok = ctx.children[entry.Situation]\r\n\t\tif !ok {\r\n\t\t\tconveyPanic(differentConveySituations, entry.Situation)\r\n\t\t}\r\n\t} else {\r\n\t\tif _, ok := ctx.children[entry.Situation]; ok { // LINE 146 \r\n\t\t\t// I don't think that it's a good idea to panic here, It's better to wait 'till the other convey\r\n\t\t\t// finished it's execution with a timeout, or just create new one with a suffix\r\n\t\t\t// like 1, 2, 3, and so on ...\r\n\t\t\t// or put 'em all inside some kind of container with barrier synchronization etc \r\n\t\t\tconveyPanic(multipleIdenticalConvey, entry.Situation)\r\n\t\t}\r\n\t\tinner_ctx = &context{\r\n\t\t\treporter: ctx.reporter,\r\n\r\n\t\t\tchildren: make(map[string]*context),\r\n\r\n\t\t\texpectChildRun: ctx.expectChildRun,\r\n\r\n\t\t\tfocus:       entry.Focus,\r\n\t\t\tfailureMode: ctx.failureMode.combine(entry.FailMode),\r\n\t\t}\r\n\t\tctx.children[entry.Situation] = inner_ctx\r\n\t}\r\n\r\n\tif inner_ctx.shouldVisit() {\r\n\t\tctxMgr.SetValues(gls.Values{nodeKey: inner_ctx}, func() {\r\n\t\t\tinner_ctx.conveyInner(entry.Situation, entry.Func)\r\n\t\t})\r\n\t}\r\n}\r\n```\r\n\r\nPanics looks like:\r\n```\r\npanic: Multiple convey suites with identical names: \"SDP Session description consists of a number of lines of text of the form: <type>=<value>\" [recovered]\r\n\tpanic: Multiple convey suites with identical names: \"SDP Session description consists of a number of lines of text of the form: <type>=<value>\" [recovered]\r\n\tpanic: Multiple convey suites with identical names: \"SDP Session description consists of a number of lines of text of the form: <type>=<value>\" [recovered]\r\n\tpanic: Multiple convey suites with identical names: \"SDP Session description consists of a number of lines of text of the form: <type>=<value>\"\r\n```\r\n\r\nWell, few years ago goconvey has no such side effects, as far as I remember :| \r\n\r\nIt would be a nice thing to provide an additional ExecutionMode for TDD.\r\nSo, the test cases would be executed in linear order without additional repeats.\r\nIt's probably the most common misconception for the newcomers, and the most common reason to switch to the tools like [goblin](https://github.com/franela/goblin)"},"comment":{"url":"https://api.github.com/repos/smartystreets/goconvey/issues/comments/213889438","html_url":"https://github.com/smartystreets/goconvey/issues/425#issuecomment-213889438","issue_url":"https://api.github.com/repos/smartystreets/goconvey/issues/425","id":213889438,"user":{"login":"yuriy-yarosh","id":6811933,"avatar_url":"https://avatars.githubusercontent.com/u/6811933?v=3","gravatar_id":"","url":"https://api.github.com/users/yuriy-yarosh","html_url":"https://github.com/yuriy-yarosh","followers_url":"https://api.github.com/users/yuriy-yarosh/followers","following_url":"https://api.github.com/users/yuriy-yarosh/following{/other_user}","gists_url":"https://api.github.com/users/yuriy-yarosh/gists{/gist_id}","starred_url":"https://api.github.com/users/yuriy-yarosh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yuriy-yarosh/subscriptions","organizations_url":"https://api.github.com/users/yuriy-yarosh/orgs","repos_url":"https://api.github.com/users/yuriy-yarosh/repos","events_url":"https://api.github.com/users/yuriy-yarosh/events{/privacy}","received_events_url":"https://api.github.com/users/yuriy-yarosh/received_events","type":"User","site_admin":false},"created_at":"2016-04-24T04:51:07Z","updated_at":"2016-04-24T04:51:07Z","body":"@riannucci are there any way to make test case execution linear ?\r\nIt's most obvious and expected behavior."}}