Archive

Archive for the ‘Test’ Category

AngularJS CheatSheet

ng-app (usually on html)

ng-controller (on the body or on the container)

‘use strict’;

scripts order: Jquery – Angular (in the head possibly) other scripts: 

var testApp = angular.module(‘myFirstAng’, []);
testApp.controller(‘myController’, function ($scope) {
$scope.Test = “hello world”;
});


 

use of $http:

myApp.controller(‘myController’, function ($scope, $http) {

$http({
dataType: ‘json’, headers: {
“Content-Type”: “application/json”
}, data: ”, method: ‘GET’,
url: ‘/api/Sdb’
}).success(function (data, status, headers, config) {
$scope.Result = data;
})
.error(function (data, status, headers, config) {
}); 
});


 

NG-Repeat: ng-repeat=”friend in friends”

ng-click

<select
data-ng-model=”selection.bg”
data-ng-options=”bg.Name for bg in businessGroups”
data-ng-change=”ChangeEvent()” >
<option value=””>-Select-</option>
</select>


 

ng-grid

 <div class=“gridStyle” ng-grid=“gridOptions” style=“width: 90%; height: 90%”></div>

 

 $scope.gridOptions = {
                data: ‘users’, columnDefs: [
                    { field: ‘FullName’, displayName: ‘FullName’, resizable:true, width:200 },
                    { field: ‘UserName’, displayName: ‘UserName’, resizable: true },
                    {
                        field: ‘LastLogin’, displayName: ‘LastLogin’,
                        cellFilter: “date:’dd/MM/yyyy HH:mm'”
                    },
                    { field: ‘AssignedRoles’, displayName: ‘AssignedRoles’, resizable: true, cellFilter: ‘stringArrayFilter’ }]
            };
 
getUsersService.getUsers(data).then(
                            function (dataReturned) {
                                $scope.users = dataReturned;
                            });
 

Jasmine testing:
describe("myApp", function() {
 
    beforeEach(module('myApp'));
 
    describe("SimpleController", function() {
 
        var scope;
        beforeEach(inject(function($rootScope, $controller) {
            scope = $rootScope.$new();
            $controller("SimpleController", {
                $scope: scope
            });
        }));
 
        it("should double the numbers", function() {
            scope.doubleIt();
            expect(scope.x).toBe(6);
        });
    });
});
 
Advertisements
Categories: DEV, Test Tags: ,

Mocking Azure TableStorage

In these links you will understand how to Mock Azure Table Storage…

Unit Testing and Azure is not an easy job, but it is worth doing it sometimes.

http://blogs.southworks.net/fboerr/2010/07/23/windows-azure-storage-tdd-and-mocks/

http://stackoverflow.com/questions/4636248/how-to-fake-azure-table-storage-in-net-for-unit-testing

http://stackoverflow.com/questions/3291629/unit-testing-code-for-azure

Categories: DEV, Test Tags: ,

how to run a VS 2010 web test from command line

you need to have installed VS 2010 go in the VS 2010 prompt and run:

mstest /TestContainer:WebTest1.webtest

http://msdn.microsoft.com/en-us/library/ms243149.aspx#Single

Categories: Test Tags: ,

WebUi test with powerShell

As you already know, I am a fan of WebUI test… some time you do not have a test framework and you need to run your test in the powerShell context…

http://msdn.microsoft.com/en-us/magazine/cc337896.aspx

this article will explain how to do it Smile

Categories: Test Tags: , ,

testing framework for Web UI

When it comes to web UI testing, you have several choices:

WebAii Telerik ( http://www.telerik.com/automated-testing-tools/free-testing-framework.aspx )

or VS (I would recommend it only on specific scenario…)
Categories: Test Tags: