testing

MVC Preview 5 - Rendering A View To String For Testing

烈酒焚心 提交于 2019-12-22 04:42:43
问题 I was reading a post by Brad Wilson (http://bradwilson.typepad.com/blog/2008/08/partial-renderi.html) on the new ViewEngine changes to MVC Preview 5 and thought that it would be great to be able to render a view to string for use in tests. I get the impression from the article that it may be possible to achieve this but cannot figure out how. I believe this would enable us to do away with some of our WatIn tests (which are slow and unreliable) as it would allow us to check that the View has

how to test or describe endless possibilities?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-22 04:28:08
问题 Example class in pseudocode: class SumCalculator method calculate(int1, int2) returns int What is a good way to test this? In other words how should I describe the behavior I need? test1: canDetermineSumOfTwoIntegers or test2: returnsSumOfTwoIntegers or test3: knowsFivePlusThreeIsEight Test1 and Test2 seem vague and it would need to test a specific calculation, so it doesn't really describe what is being tested. Yet test3 is very limited. What is a good way to test such classes? 回答1: I would

Factory_girl has_one relation with validates_presence_of

好久不见. 提交于 2019-12-22 04:16:07
问题 I have 2 Models: # user.rb class User < ActiveRecord::Base has_one :profile, :dependent => :destroy end # profile.rb class Profile < ActiveRecord::Base belongs_to :user validates_presence_of :user end # user_factory.rb Factory.define :user do |u| u.login "test" u.association :profile end I want to do this: @user = Factory(:user) => #<User id: 88,....> @user.profile => #<Profile id:123, user_id:88, ......> @user = Factory.build(:user) => #<User id: nil,....> @user.profile => #<Profile id:nil,

In concolic testing, what does “concrete execution” mean?

隐身守侯 提交于 2019-12-22 04:14:19
问题 I came across the terms "concrete & symbolic execution" when I was going through the concept of concolic testing. (The article mentioned there, "CUTE: A concolic unit testing engine for C" , uses that term in its abstract section.) "The approach used builds on previous work combining symbolic and concrete execution, and more specifically, using such a combination to generate test inputs to explore all feasible execution paths." Can anyone please confirm what "concrete execution" means? In

Boost test does not init_unit_test_suite

僤鯓⒐⒋嵵緔 提交于 2019-12-22 04:07:44
问题 I run this piece of code #define BOOST_TEST_MAIN #define BOOST_TEST_DYN_LINK #include <boost/test/unit_test.hpp> #include <boost/test/unit_test_log.hpp> #include <boost/filesystem/fstream.hpp> #include <iostream> using namespace boost::unit_test; using namespace std; void TestFoo() { BOOST_CHECK(0==0); } test_suite* init_unit_test_suite( int argc, char* argv[] ) { std::cout << "Enter init_unit_test_suite" << endl; boost::unit_test::test_suite* master_test_suite = BOOST_TEST_SUITE(

How to test AngularJS Directive with scrolling

纵饮孤独 提交于 2019-12-22 04:07:29
问题 I have an infinite scroll directive that I am trying to unit test. Currently I have this: describe('Infinite Scroll', function(){ var $compile, $scope; beforeEach(module('nag.infiniteScroll')); beforeEach(inject(function($injector) { $scope = $injector.get('$rootScope'); $compile = $injector.get('$compile'); $scope.scrolled = false; $scope.test = function() { $scope.scrolled = true; }; })); var setupElement = function(scope) { var element = $compile('<div><div id="test" style="height:50px;

Boost::test and mocking framework [closed]

こ雲淡風輕ζ 提交于 2019-12-22 04:03:55
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed last year . I am using boost::test and need to use a mocking framework with it. Does anyone have any recommendations? 回答1: I recently did a search for unit testing and mocking frameworks for my latest project and went with Google Mock. It had the best documentation and seems fairly well featured (although I haven't created

How do I test code that should never be executed?

99封情书 提交于 2019-12-22 04:03:43
问题 Following method shall only be called if it has been verified that there are invalid digits (by calling another method). How can I test-cover the throw -line in the following snippet? I know that one way could be to merge together the VerifyThereAreInvalidiDigits and this method. I'm looking for any other ideas. public int FirstInvalidDigitPosition { get { for (int index = 0; index < this.positions.Count; ++index) { if (!this.positions[index].Valid) return index; } throw new

How override Provider in Angular 5 for only one test?

半世苍凉 提交于 2019-12-22 03:51:32
问题 In one of my unit test files, I have to mock several times the same service with different mocks. import { MyService } from '../services/myservice.service'; import { MockMyService1 } from '../mocks/mockmyservice1'; import { MockMyService2 } from '../mocks/mockmyservice2'; describe('MyComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [ MyComponent ], providers: [ { provide: MyService, useClass: MockMyService1 } ] }) .compileComponents(); }));

Is it possible to test against the release version of your app with Android Gradle plugin?

╄→гoц情女王★ 提交于 2019-12-22 03:48:47
问题 When I use the 'gradlew connectedCheck' command it always build the debug version and test against the debug version of my app. Is it also possible to test against the release version of my app? I want to enable proguard and want to make sure that it doesn't filter anything out that is needed during runtime. 回答1: You can only test against a single build type right now (though that may change). To set the build type to test against: android { testBuildType "release" } You could set this