量角器:如何直接发送post api请求进行测试

时间:2016-01-28 10:58:20

标签: javascript angularjs protractor

我是量角器的新手并且有一个注册页面,所以我想直接发布api以便直接创建用户个人资料

我的控制器

<script>
 var app = angular.module("app", []);
 app.controller("HttpGetController", function($scope, $http) {

$scope.SendData = function() {

    var data = {"firstName":"check","lastName":"raq","roles":["PATIENT"],"contactInfo":{"email":"test1@123.com","primaryPhone":"+918598598547","secondaryPhone":null}}     

    $http.post('/ServerRequest/PostDataResponse', data)
        .success(function(data, status, headers) {
            $scope.PostDataResponse = data;
        })
        .error(function(data, status, header) {
            $scope.ResponseDetails = "Data: " + data +
                "<hr />status: " + status 
        });
    };

});
</script>

我应该如何直接为测试用例编写api调用.......

感谢任何帮助.........提前致谢

0 个答案:

没有答案