我正在尝试在fitnesse套件页面中添加变量及其值的表,以便它可以用于我的所有测试。我正在为肥皂网服务和fhoeben / hsac-fitnesse-fixture(苗条)使用xmlHtttp测试。是否需要编写单独的灯具来添加表格。 感谢
答案 0 :(得分:0)
是的,你可以。
angular.module('searchPolicy').factory('modeldata', function () {
var modelsession = @Html.Raw(Model.sessionno);
return modelsession;
})
var app = angular.module('searchPolicy', []);
app.controller("getresult", ["$scope", "$http", "$compile", "$window", "modeldata", function ($scope, $http, $compile, $window, modeldata) {
console.log(modeldata)
//Submit and search policy
$scope.submit = function () {
$scope.results = [];
$("#svedea_spinner").show();
console.log($scope.sessionno);
$scope.data = {
sessionno: "@Model.sessionno",
saleschannelno: "@Model.saleschannelno",
currentpage: "@Model.currentpage",
AvtalDDJson: "@Model.AvtalDDJson",
ForsakringsNr: $scope.forsakringsnr,
FirstNamn: $scope.firstname,
LastName: $scope.lastname,
OrgNr: $scope.orgnr,
SelectedAvtal: $scope.avtal.Value,
SelectedSubBroker: $scope.broker.Value,
SelectedStatus: $scope.status.Value,
productName: "@Model.productName",
};
$http({
method: "POST",
url: "/umbraco/Surface/WinsureSearchSurface/PolicySearch",
data: $scope.data
}).then(function (response) {
console.log(response.data)
$scope.results = response.data.psr.results;
$("#svedea_spinner").hide();
}), function (response) {
console.log("error");
$("#svedea_spinner").hide();
}
}
}])
在此示例中,使用变量Using a scenario allows us to generate multiple request, only changing certain values.
!*> Scenario definition
!define POST_BODY_2 { {{{
<s11:Envelope xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/">
<s11:Body>
<ns1:GetCityWeatherByZIP xmlns:ns1="http://ws.cdyne.com/WeatherWS/">
<ns1:ZIP>@{zip}</ns1:ZIP>
</ns1:GetCityWeatherByZIP>
</s11:Body>
</s11:Envelope>
}}} }
|script|xml http test|
|table template |send request |
|post |${POST_BODY_2} |to |${URL} |
|check |response status|200 |
|show |response |
|register prefix|weather |for namespace|http://ws.cdyne.com/WeatherWS/|
|$City= |xPath |//weather:City/text() |
*!
|send request |
|zip |City? |
|10007|New York |
|94102|San Francisco|
,因此请求以10007或94102发送。