zoukankan      html  css  js  c++  java
  • 使用Visual Studio创建WebService Unit Test

    1.使用Unit Test Wizard创建单元测试.不必说

    2.Copy WebService项目下面的Web.config到单元测试项目下,改名App.config,如有需要修改修改相应配置

    3.HostType 注释掉

    4.UrlToTest 修改为指定的webservice url

    如下:

            [TestMethod()]
           // [HostType("ASP.NET")] 注释掉
            [AspNetDevelopmentServerHost("E:\\Project\\Elp2.5\\source\\web\\ElpWeb\\ELPApp\\Elp.AppServices", "/")]
            [UrlToTest("http://localhost:3166/UserService.asmx")]//asmx地址
            public void LoginTest()
            {
                UserService target = new UserService(); // TODO: Initialize to an appropriate value
                string userName = "test"; // TODO: Initialize to an appropriate value
                string password = "edit"; // TODO: Initialize to an appropriate value
                bool actul=  target.Login(userName, password);
                Assert.AreEqual(true, actul);
    
               // Assert.Inconclusive("A method that does not return a value cannot be verified.");
            }
  • 相关阅读:
    nginx+tomcat配置websocket反向代理
    jmter 参数化
    postman 自动化
    python yaml文件读写
    python redis 操作
    pycharm 连接github操作
    校验身份证号
    python faker 造数据
    pandas处理日期相关的操作
    python的time几种用法strptime、strftime、localtime、mktime
  • 原文地址:https://www.cnblogs.com/solo/p/1552695.html
Copyright © 2011-2022 走看看