in synergy/client/app/js/controllers.js [4289:4405]
$scope.next = function (result) {
if (parseInt($scope.assignment.completed, 10) === parseInt($scope.assignment.total, 10)) {
$scope.SYNERGY.modal.update("Testing finished", "");
$scope.SYNERGY.modal.show();
return;
}
var alreadyTested = (parseInt($scope.assignment.progress.specification.testSuites[$scope.suiteIndex].testCases[$scope.caseIndex].finished, 10) === 1) ? true : false;
switch (result) {
case "passed":
if (!alreadyTested) {
$scope.assignment.completed++;
$scope.casesFinished = parseInt(100 * (parseInt($scope.assignment.completed, 10) / parseInt($scope.assignment.total, 10)), 10);
if ($scope.assignment.progress.specification.testSuites[$scope.suiteIndex].testCases[$scope.caseIndex].hasOwnProperty("originalDuration")) {
timeFinished += parseInt(Math.round($scope.assignment.progress.specification.testSuites[$scope.suiteIndex].testCases[$scope.caseIndex].originalDuration), 10);
} else {
timeFinished += parseInt(Math.round($scope.assignment.progress.specification.testSuites[$scope.suiteIndex].testCases[$scope.caseIndex].duration), 10);
}
$scope.timeLeft = parseInt($scope.assignment.specificationData.estimation, 10) - timeFinished;
}
var timeTaken = (new Date().getTime()) - started;
$scope.assignment.progress.specification.testSuites[$scope.suiteIndex].testCases[$scope.caseIndex].finished = 1;
$scope.assignment.progress.specification.testSuites[$scope.suiteIndex].testCases[$scope.caseIndex].result = result;
$scope.assignment.progress.specification.testSuites[$scope.suiteIndex].testCases[$scope.caseIndex].comment = $scope.currentCase.comment;
$scope.assignment.progress.specification.testSuites[$scope.suiteIndex].testCases[$scope.caseIndex].commentFreeText = ($scope.currentCase.comment !== -1) ? $scope.currentCase.commentFreeText.substr(0, 100) : "";
if (!$scope.SYNERGY.trackCaseDuration) {
timeTaken = $scope.currentCase.duration * 60000;
}
if ($scope.newIssue.length > 0) {
$scope.assignment.progress.specification.testSuites[$scope.suiteIndex].testCases[$scope.caseIndex].issue = $scope.newIssue.split(" ");
} else {
$scope.assignment.progress.specification.testSuites[$scope.suiteIndex].testCases[$scope.caseIndex].issue = "";
}
$scope.assignment.progress.specification.testSuites[$scope.suiteIndex].testCases[$scope.caseIndex].duration = timeTaken;
$scope.assignment.progress.specification.testSuites[$scope.suiteIndex].testCases[$scope.caseIndex].originalDuration = $scope.currentCase.duration;
parseData($scope.caseIndex + 1, $scope.suiteIndex, $scope.currentCase.duration);
break;
case "failed":
if ($scope.newIssue.length > 0) {
if (!alreadyTested) {
$scope.assignment.completed++;
$scope.casesFinished = parseInt(100 * (parseInt($scope.assignment.completed, 10) / parseInt($scope.assignment.total, 10)), 10);
if ($scope.assignment.progress.specification.testSuites[$scope.suiteIndex].testCases[$scope.caseIndex].hasOwnProperty("originalDuration")) {
timeFinished += parseInt(Math.round($scope.assignment.progress.specification.testSuites[$scope.suiteIndex].testCases[$scope.caseIndex].originalDuration), 10);
} else {
timeFinished += parseInt(Math.round($scope.assignment.progress.specification.testSuites[$scope.suiteIndex].testCases[$scope.caseIndex].duration), 10);
}
$scope.timeLeft = parseInt($scope.assignment.specificationData.estimation, 10) - timeFinished;
}
var timeTaken = (new Date().getTime()) - started;
if (!$scope.SYNERGY.trackCaseDuration) {
timeTaken = $scope.currentCase.duration * 60000;
}
$scope.assignment.progress.specification.testSuites[$scope.suiteIndex].testCases[$scope.caseIndex].issue = $scope.newIssue.split(" ");
$scope.assignment.progress.specification.testSuites[$scope.suiteIndex].testCases[$scope.caseIndex].finished = 1;
$scope.assignment.progress.specification.testSuites[$scope.suiteIndex].testCases[$scope.caseIndex].result = result;
$scope.assignment.progress.specification.testSuites[$scope.suiteIndex].testCases[$scope.caseIndex].duration = timeTaken;
$scope.assignment.progress.specification.testSuites[$scope.suiteIndex].testCases[$scope.caseIndex].originalDuration = $scope.currentCase.duration;
$scope.assignment.progress.specification.testSuites[$scope.suiteIndex].testCases[$scope.caseIndex].comment = $scope.currentCase.comment;
$scope.assignment.progress.specification.testSuites[$scope.suiteIndex].testCases[$scope.caseIndex].commentFreeText = ($scope.currentCase.comment !== -1) ? $scope.currentCase.commentFreeText.substr(0, 100) : "";
parseData($scope.caseIndex + 1, $scope.suiteIndex, $scope.currentCase.duration);
} else {
$scope.SYNERGY.modal.update("Missing issue number", "");
$scope.SYNERGY.modal.show();
return;
}
break;
case "skipped":
if ($scope.currentCase.comment === -1) {
$scope.SYNERGY.modal.update("Missing reason for skipping", "Please select comment using the combo box below Skip button");
$scope.SYNERGY.modal.show();
return;
}
if (!alreadyTested) {
$scope.assignment.completed++;
$scope.casesFinished = parseInt(100 * (parseInt($scope.assignment.completed, 10) / parseInt($scope.assignment.total, 10)), 10);
if ($scope.assignment.progress.specification.testSuites[$scope.suiteIndex].testCases[$scope.caseIndex].hasOwnProperty("originalDuration")) {
timeFinished += parseInt(Math.round($scope.assignment.progress.specification.testSuites[$scope.suiteIndex].testCases[$scope.caseIndex].originalDuration), 10);
} else {
timeFinished += parseInt(Math.round($scope.assignment.progress.specification.testSuites[$scope.suiteIndex].testCases[$scope.caseIndex].duration), 10);
}
$scope.timeLeft = parseInt($scope.assignment.specificationData.estimation, 10) - timeFinished;
}
$scope.assignment.progress.specification.testSuites[$scope.suiteIndex].testCases[$scope.caseIndex].issue = "";
$scope.assignment.progress.specification.testSuites[$scope.suiteIndex].testCases[$scope.caseIndex].finished = 1;
$scope.assignment.progress.specification.testSuites[$scope.suiteIndex].testCases[$scope.caseIndex].result = result;
$scope.assignment.progress.specification.testSuites[$scope.suiteIndex].testCases[$scope.caseIndex].originalDuration = $scope.currentCase.duration;
$scope.assignment.progress.specification.testSuites[$scope.suiteIndex].testCases[$scope.caseIndex].comment = $scope.currentCase.comment;
$scope.assignment.progress.specification.testSuites[$scope.suiteIndex].testCases[$scope.caseIndex].commentFreeText = ($scope.currentCase.comment !== -1) ? $scope.currentCase.commentFreeText.substr(0, 100) : "";
parseData($scope.caseIndex + 1, $scope.suiteIndex, $scope.currentCase.duration);
break;
default:
break;
}
$scope.somethingCompleted = true;
$scope.pauseButtonTitle = "Save current progress and continue later";
$scope.SYNERGY.cache.put("assignment_progress_" + $scope.id, {"date": new Date().toString(), "progress": $scope.assignment.progress});
collectCases();
$scope.caseToPrint = $scope.allCases.filter(function (e) {
return e.caseId === $scope.currentCase.caseId && e.suiteId === $scope.currentCase.suiteId;
})[0];
$scope.SYNERGY.util.scrollTo("caseTitle");
};