部署后运行验收/冒烟测试

时间:2015-05-18 15:06:02

标签: asp.net asp.net-mvc git asp.net-mvc-4 azure

我已经设置了从Visual Studio Online Git存储库到Azure Web App的持续部署。

触发构建并完成部署后,在网站上运行验收/冒烟测试的最佳方法是什么?

我已经尝试了POST_DEPLOYMENT_ACTIONHow to add a custom post deployment script to azure websites?),但这似乎被忽略了。

我还看了一下Kudu PostDeployment钩子(https://github.com/projectkudu/kudu/wiki/Post-Deployment-Action-Hooks),看起来过于苛刻。

顺便说一句,我正在部署标准的ASP.NET 4 MVC站点。任何帮助表示赞赏。

2 个答案:

答案 0 :(得分:1)

关于PostDeployment钩子有什么问题?

另一种方法是从Kudu / SCM网站订阅PostDeployment钩子

POST /api/hooks
{
  "url": "http://www.callback.com/callback",
  "event": "PostDeployment",
  "insecure_ssl": false (set to true to ignore https certificate check, for test purposes only)
}

在部署完成后,这将在指定的URL上为您提供如下的POST:

{
  "id": "cd5bee7181e74ea38a3522e73253f6ebb8ed72fb",
  "status": "success", (could be pending, building, deploying, failed, success)
  "author_email": "someone@somewhere.com",
  "author": "Some One",
  "message": "My fix",
  "deployer": "Some One",
  "start_time": "2013-06-06T01:24:16.5873293Z",
  "end_time": "2013-06-06T01:24:17.63342Z"
}

More info here on kudu github wiki

答案 1 :(得分:-1)

我最终做的是自定义构建过程以在最后添加RunScriptTask,从而调用我的测试。

您可以将构建参数传递给RunScriptTask,如下所示:

"-username user@example.org -password test123 -environment " + DeploymentSettings.GetValue(Of String)("ProviderHostedDeploymentEnvironmentName")

如果从Visual Studio编辑构建定义 - >团队资源管理器 - >构建时,左侧有一个名为Process的选项卡,用于分解构建步骤。如果单击顶部的显示详细信息,则可以选择下载XAML构建过程模板。您可以根据需要自定义,然后从该文件创建新的构建过程模板。 (请注意,必须事先将XAML构建过程模板文件推送到远程存储库)