随笔分类 - Unit Testing
摘要:RAILS INTEGRATION TESTUsing Rails integration test helpers complete the two tests below by calling thetweet_url(@tweet)path usingGET, and asserting as...
阅读全文
摘要:STUBBINGNotice how theshow_author_summarymethod intweetis calling thezombie_summarymethod insidezombie. This isn't good!Stubout thezombie_summarymetho...
阅读全文
摘要:SETUP METHODRefactor the following code using asetupmethod to create the tweet, and properly use instance variables.class TweetTest nil) assert !m...
阅读全文
摘要:First Model TestUsing anassertand thevalid?method, test that a 'tweet' isnot valid without a status.class Tweet < ActiveRecord::Base belongs_to :zomb...
阅读全文
摘要:Unit TestWrite a basic conditional test usingassertwhich checks if1 > 0. Name your test classConditionalTest.require 'test/unit'class ConditionalTest ...
阅读全文
摘要:1. Can set up Auto-test in webstorm2. Only test seleted it or desribe. By doulbe 'i' and 'd'3. You can also exclude the it or describe which you don't...
阅读全文
摘要:app.controller("AppCtrl",function(){ this.message = "hello";}) describe("Hello Controller",function(){ var appCtrl; var $controlle...
阅读全文
摘要:Usually, when we do testing, we inject $compile, $rootScope into the beforeEach funciton();Actually, there is a goodpratice that we write _$compile_, ...
阅读全文
摘要:在测试文件中使用的scope是inject进去的,所以使用scope.clicked也可以找到原来directive定义的scope.但是如果在driectvie中使用了isolated scope:app.directive('testDir',function(){ return{ ...
阅读全文
摘要:describe("Hello world",function(){ var element; var $scope; beforeEach(module("app")) beforeEach(inject(function($compile, $rootScope){ ...
阅读全文
摘要:If wants to use karma with AngualrJS, we need to include angular.min-js and angular-mocks.js inside karma.config.jsBe careful with the order, angular....
阅读全文
摘要:What is Unit Testing:Unit tests try to answer questions such as "Did I think about the logic correctly?" or "Does the sort funciton order the list in ...
阅读全文