{"action":"created","issue":{"url":"https://api.github.com/repos/Particular/NServiceBus/issues/4602","repository_url":"https://api.github.com/repos/Particular/NServiceBus","labels_url":"https://api.github.com/repos/Particular/NServiceBus/issues/4602/labels{/name}","comments_url":"https://api.github.com/repos/Particular/NServiceBus/issues/4602/comments","events_url":"https://api.github.com/repos/Particular/NServiceBus/issues/4602/events","html_url":"https://github.com/Particular/NServiceBus/pull/4602","id":219919979,"number":4602,"title":"[Spike] Provide cleanup hook in ATT Framework.","user":{"login":"timbussmann","id":3524870,"avatar_url":"https://avatars2.githubusercontent.com/u/3524870?v=3","gravatar_id":"","url":"https://api.github.com/users/timbussmann","html_url":"https://github.com/timbussmann","followers_url":"https://api.github.com/users/timbussmann/followers","following_url":"https://api.github.com/users/timbussmann/following{/other_user}","gists_url":"https://api.github.com/users/timbussmann/gists{/gist_id}","starred_url":"https://api.github.com/users/timbussmann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timbussmann/subscriptions","organizations_url":"https://api.github.com/users/timbussmann/orgs","repos_url":"https://api.github.com/users/timbussmann/repos","events_url":"https://api.github.com/users/timbussmann/events{/privacy}","received_events_url":"https://api.github.com/users/timbussmann/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-04-06T14:35:31Z","updated_at":"2017-04-07T09:04:23Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/Particular/NServiceBus/pulls/4602","html_url":"https://github.com/Particular/NServiceBus/pull/4602","diff_url":"https://github.com/Particular/NServiceBus/pull/4602.diff","patch_url":"https://github.com/Particular/NServiceBus/pull/4602.patch"},"body":"moves the `IConfigureEndpointTestExecution` interface from the acceptance testing framework project to the acceptance tests source package. This interface is used in the source package to allow downstreams to configure their custom transport/persistence configuration. Additionally to that, it comes with a cleanup mechanism.\r\n\r\nthe testing framework was using this interface to provide the cleanup mechanism, while the configuration aspect is completely managed by the sources package. Therefore, implementing this interface in a test project which doesn't use the sources package has absolutely no effect.\r\nThis also causes certain test projects (e.g. MSMQ) to rely on the sources package as these projects typically want to have a cleanup mechanism which isn't provided by the testing framework alone.\r\n\r\nThis change adds a mechanism to register your own callbacks when the test run completed. This can then be used to hook in your custom cleanup code (which now also has more information available, e.g. whether the test succeeded or not).\r\n\r\nThis is a first step, but it will allow to decouple MSMQ tests from the sources package. /cc @andreasohlund \r\n\r\n@SzymonPobiega have a look at this. I think we could use the same callbacks approach to allow registering hooks before the test is started?"},"comment":{"url":"https://api.github.com/repos/Particular/NServiceBus/issues/comments/292482750","html_url":"https://github.com/Particular/NServiceBus/pull/4602#issuecomment-292482750","issue_url":"https://api.github.com/repos/Particular/NServiceBus/issues/4602","id":292482750,"user":{"login":"timbussmann","id":3524870,"avatar_url":"https://avatars2.githubusercontent.com/u/3524870?v=3","gravatar_id":"","url":"https://api.github.com/users/timbussmann","html_url":"https://github.com/timbussmann","followers_url":"https://api.github.com/users/timbussmann/followers","following_url":"https://api.github.com/users/timbussmann/following{/other_user}","gists_url":"https://api.github.com/users/timbussmann/gists{/gist_id}","starred_url":"https://api.github.com/users/timbussmann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timbussmann/subscriptions","organizations_url":"https://api.github.com/users/timbussmann/orgs","repos_url":"https://api.github.com/users/timbussmann/repos","events_url":"https://api.github.com/users/timbussmann/events{/privacy}","received_events_url":"https://api.github.com/users/timbussmann/received_events","type":"User","site_admin":false},"created_at":"2017-04-07T09:04:23Z","updated_at":"2017-04-07T09:04:23Z","body":"@SzymonPobiega so I think I could easily extend my PR to provide something like:\r\n\r\n```\r\nawait Scenario.Define<Context>()\r\n    .WithEndpoint<MyEndpoint>()\r\n    .Done(...)\r\n    .OnTestCompleted((ctx, runResult) => { ... })\r\n    .OnTestWhateverState(ctx  => { --- ])\r\n    .Run();\r\n```\r\n\r\nMaybe a global approach like\r\n```\r\nScenario.All.OnTestCompleted((ctx, result) => { .. });\r\n```\r\n\r\nwould be even more valuable?\r\n\r\nthoughts?\r\n\r\nbut I wonder, where the difference would be to something like the following:\r\n\r\n```\r\nvar ctx = new Context();\r\nctx.Starting = true;\r\nvar result = await Scenario.Define(ctx)\r\n    .WithEndpoint<MyEndpoint>()\r\n    .Done(...)\r\n    .Run();\r\nresult.Stopped = true;\r\n```"}}
{"actor":{"display_login":"timbussmann"}}