Search Results

Search found 5783 results on 232 pages for 'translation unit'.

Page 46/232 | < Previous Page | 42 43 44 45 46 47 48 49 50 51 52 53  | Next Page >

  • ExpectedException on TestMethod Visual Studio 2010

    - by Joop
    Today I upgraded my solution with all the underlying projects from VS2008 to VS2010. Everything went well except for my unit tests. First of all only the web projects had as target framework .NET 4. All the other projects still had .NET 3.5. I changed them all to .NET 4. Now when I debug my unit tests it breaks on every exception. In 2008 it just wouldn't pass and tell me that an exception occurred. Even when I have the ExpectedException attribute defined it stops debugging on every exception. And example of one of my tests: [TestMethod] [ExpectedException(typeof(EntityDoesNotExistException))] public void ConstructorTest() { AddressType type = new AddressType(int.MaxValue); } The EntityDoesNotExistException is a custom exception and inherits Exception.

    Read the article

  • Google Toolbox For Mac with Core Data on iPhone results in error

    - by JaanusSiim
    I have set up my project for using Google Toolbox for Mac as described on official wiki. And everything is working as expected. For core data usage I have created a 'database' class that uses for final application SQLite storage (this is done based on Xcode template code). For unit tests I have created separate init method for 'database' to use in memory storage (storage url is [NSURL URLWithString:@"memory://store"] and type NSInMemoryStoreType). Without adding my model file (*.xcdatamodel) to unit tests target, test fail in expected place with message: executeFetchRequest:error: A fetch request must have an entity. If I add model file to the test target, then test is executed as expected (core data part looks OK), but after tests execution I get: RunIPhoneUnitTest.sh: line 123: 9487 Segmentation fault "$TARGET_BUILD_DIR/$EXECUTABLE_PATH" -RegisterForSystemEvents Command /bin/sh failed with exit code 139 This problem does not looks directly related to core data, but only happens if model file is added to target. Any pointers on resolving this issue would be appreciated!

    Read the article

  • AutoFixture refactoring

    - by Thomas Jaskula
    I started to use AutoFixture http://autofixture.codeplex.com/ as my unit tests was bloated with a lot of data setup. I was spending more time on seting up the data than to write my unit test. Here's an example of how my initial unit test looks like (example taken from cargo application sample from DDD blue book) [Test] public void should_create_instance_with_correct_ctor_parameters() { var carrierMovements = new List<CarrierMovement>(); var deparureUnLocode1 = new UnLocode("AB44D"); var departureLocation1 = new Location(deparureUnLocode1, "HAMBOURG"); var arrivalUnLocode1 = new UnLocode("XX44D"); var arrivalLocation1 = new Location(arrivalUnLocode1, "TUNIS"); var departureDate1 = new DateTime(2010, 3, 15); var arrivalDate1 = new DateTime(2010, 5, 12); var carrierMovement1 = new CarrierMovement(departureLocation1, arrivalLocation1, departureDate1, arrivalDate1); var deparureUnLocode2 = new UnLocode("CXRET"); var departureLocation2 = new Location(deparureUnLocode2, "GDANSK"); var arrivalUnLocode2 = new UnLocode("ZEZD4"); var arrivalLocation2 = new Location(arrivalUnLocode2, "LE HAVRE"); var departureDate2 = new DateTime(2010, 3, 18); var arrivalDate2 = new DateTime(2010, 3, 31); var carrierMovement2 = new CarrierMovement(departureLocation2, arrivalLocation2, departureDate2, arrivalDate2); carrierMovements.Add(carrierMovement1); carrierMovements.Add(carrierMovement2); new Schedule(carrierMovements).ShouldNotBeNull(); } Here's how I tried to refactor it with AutoFixture [Test] public void should_create_instance_with_correct_ctor_parameters_AutoFixture() { var fixture = new Fixture(); fixture.Register(() => new UnLocode(UnLocodeString())); var departureLoc = fixture.CreateAnonymous<Location>(); var arrivalLoc = fixture.CreateAnonymous<Location>(); var departureDateTime = fixture.CreateAnonymous<DateTime>(); var arrivalDateTime = fixture.CreateAnonymous<DateTime>(); fixture.Register<Location, Location, DateTime, DateTime, CarrierMovement>( (departure, arrival, departureTime, arrivalTime) => new CarrierMovement(departureLoc, arrivalLoc, departureDateTime, arrivalDateTime)); var carrierMovements = fixture.CreateMany<CarrierMovement>(50).ToList(); fixture.Register<List<CarrierMovement>, Schedule>((carrierM) => new Schedule(carrierMovements)); var schedule = fixture.CreateAnonymous<Schedule>(); schedule.ShouldNotBeNull(); } private static string UnLocodeString() { var stringBuilder = new StringBuilder(); for (int i = 0; i < 5; i++) stringBuilder.Append(GetRandomUpperCaseCharacter(i)); return stringBuilder.ToString(); } private static char GetRandomUpperCaseCharacter(int seed) { return ((char)((short)'A' + new Random(seed).Next(26))); } I would like to know if there's better way to refactor it. Would like to do it shorter and easier than that.

    Read the article

  • WAMP phpundercontrol installation guide / tutorial

    - by Shiro
    Our team just thinking to start using php unit test for our problem. I not able to find a complete tutorial or installation which is install phpundercontrol in WAMP environment, I have no any experience about php unit test, but we know we need it. Our goal is everyday we would like to build the project, so we know where is the bug happen. We also would like to learn more collaboration between the team. I would like to ask / someone to teach, how to start install phpundercontrol in WAMP environment, or some link might be help. I did some research, most of the page I found kind of outdated, the command they provided doesn't work for me. Thank you so much.

    Read the article

  • How can a Windows program temporarily change its time zone?

    - by Rob Kennedy
    I've written a function to return the time_t value corresponding to midnight on a given day. When there is no midnight for a given day, it returns the earliest time available; that situation can occur, for example, when Egypt enters daylight-saving time. This year, the time change takes effect at midnight on the night of April 29, so the clock goes directly from 23:59 to 01:00. Now I'm writing unit tests for this function, and one of the tests should replicate the Egypt scenario. In Unix, I can accomplish it like this: putenv("TZ", "Egypt", true); tzset(); After doing that, further calls to localtime behave as if they're in Egypt instead of Minnesota, and my tests pass. Merely setting the environment variable doesn't have any effect on Windows, though. What can I do to make the unit test think it's somewhere else without affecting the rest of the programs running on the system?

    Read the article

  • Zend_Test: No default module defined for this application

    - by jiewmeng
    UPDATE 23 Dec I had the problem where Zend Framework complains about "No default module defined for this application". I didn't use Modules and the main app works fine. I finally solved the problem with the help from weierophinney.net Your bootstrap needs to minimally set the controller directory -- do a call to $this->frontController->addControllerDirectory(...) in your appBootstrap() method. I didn't in my example, as my Initialization plugin does that sort of thing for me. The problem is solved by adding the below to setUp() $this->getFrontController()->setControllerDirectory(APPLICATION_PATH . '/controllers'); But now, I have afew other questions: 1. Why does that value not get initialized by application.ini? In application.ini, I have [production] resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers" [testing : production] // didn't change anything regarding modules nor controllers 2. I tried setting the controllerDirectory in bootstrap.php of my unit test, but it does not work $front = Zend_Controller_Front::getInstance(); $front->setControllerDirectory(APPLICATION_PATH . '/controllers'); The only way that works is using setUp(). Why is that? END UPDATE 23 Dec I am getting the above error when unit testing my controller plugins. I am not using any modules. in my bootstrap.php for unit testing, I even tried adding $front = Zend_Controller_Front::getInstance(); $front->setDefaultModule('default'); But it still does not work. Anyways my bootstrap.php looks like this UPDATE: the error looks something like There were 2 errors: 1) Application_Controller_Plugin_AclTest::testAccessToUnauthorizedPageRedirectsToLogin Zend_Controller_Exception: No default module defined for this application D:\ResourceLibrary\Frameworks\PHPFrameworks\Zend\Controller\Dispatcher\Standard.php:391 D:\ResourceLibrary\Frameworks\PHPFrameworks\Zend\Controller\Dispatcher\Standard.php:204 D:\ResourceLibrary\Frameworks\PHPFrameworks\Zend\Controller\Dispatcher\Standard.php:244 D:\ResourceLibrary\Frameworks\PHPFrameworks\Zend\Controller\Front.php:954 D:\ResourceLibrary\Frameworks\PHPFrameworks\Zend\Test\PHPUnit\ControllerTestCase.php:205 D:\Projects\Tickle\tests\application\controllers\plugins\aclTest.php:6 2) Application_Controller_Plugin_AclTest::testAccessToAllowedPageWorks Zend_Controller_Exception: No default module defined for this application D:\ResourceLibrary\Frameworks\PHPFrameworks\Zend\Controller\Dispatcher\Standard.php:391 D:\ResourceLibrary\Frameworks\PHPFrameworks\Zend\Controller\Dispatcher\Standard.php:204 D:\ResourceLibrary\Frameworks\PHPFrameworks\Zend\Controller\Dispatcher\Standard.php:244 D:\ResourceLibrary\Frameworks\PHPFrameworks\Zend\Controller\Front.php:954 D:\ResourceLibrary\Frameworks\PHPFrameworks\Zend\Test\PHPUnit\ControllerTestCase.php:205 D:\Projects\Tickle\tests\application\controllers\plugins\aclTest.php:16 UPDATE I tried adding public function setUp() { $front = Zend_Controller_Front::getInstance(); $front->setDefaultModule('default'); } then 1 part works. public function testAccessToUnauthorizedPageRedirectsToLogin() { // this fails with exception "Zend_Controller_Exception: No default module defined for this application" $this->dispatch('/projects'); $this->assertController('auth'); $this->assertAction('login'); } public function testAccessToAllowedPageWorks() { // this passes $auth = Zend_Auth::getInstance(); $authAdapter = new Application_Auth_Adapter('jiewmeng', 'password'); $auth->authenticate($authAdapter); $this->dispatch('/projects'); $this->assertController('projects'); $this->assertAction('index'); }

    Read the article

  • How doe we name test methods where we are checking for more than one condition?

    - by Sandbox
    I follow the technique specified in Roy Osherove's The Art Of Unit Testing book while naming test methods - MethodName_Scenario_Expectation. It suits perfectly well for my 'unit' tests. But,for tests that I write in 'controller' or 'coordinator' class, there isn't necessarily a method which I want to test. For these tests, I generate multiple conditions which make up one scenario and then I verify the expectation. For example, I may set some properties on different instances, generate an event and then verify that my expectations from controller/coordinator is being met. Now, my controller handles events using a private event handler. Here my scenario is that, I set some properties, say 3 condition1,condition2 and condition3 Also, my scenario includes an event is raised I don't have a method name as my event handler is private. How do I name such a test method?

    Read the article

  • moqing static method call to c# library class

    - by Joe
    This seems like an easy enough issue but I can't seem to find the keywords to effect my searches. I'm trying to unit test by mocking out all objects within this method call. I am able to do so to all of my own creations except for this one: public void MyFunc(MyVarClass myVar) { Image picture; ... picture = Image.FromStream(new MemoryStream(myVar.ImageStream)); ... } FromStream is a static call from the Image class (part of c#). So how can I refactor my code to mock this out because I really don't want to provide a image stream to the unit test.

    Read the article

  • Free Testing / Code Coverage systems for C++

    - by Billy ONeal
    I'd like to start using a Test Driven Development system for a private project since I saw my employer using it and realized it was very useful. My employer's project was in C# but mines are in C and C++. I looked around and saw that several packages exist for both Java and .NET (for example: NCover, NUnit, ...). Unfortunately I found it difficult to find good C++ testing frameworks. Do you know of any unit testing frameworks that satisfy the following requirements? IMPORTANT: Must provide code coverage statistics, as I'd like to have some idea of how well my tests cover my code-base. Must be free Usable with C++ projects EDIT: To be clear, I know of many existing unit test frameworks. The code coverage piece is what's most important.

    Read the article

  • What is the best approach to write test cases using sentestinkit in iPhone / iPad ?

    - by Madhup
    I am developing an application for iPad application. I need to perform unit testing in the application, but I am not sure why I should do unit testing in this application. Edit: And since the iPhone SenTestingKit is not well documented, the implementation and writing test cases is so time consuming. So why should we waste time with this? Also if we have to what would be the best approach to write the test cases? My focus is on the second question. So please answer more for the second part, I would be very pleased.

    Read the article

  • Why is a menu item disabled when using SWTBot?

    - by reprogrammer
    I've written up a GUI test using SWTBot to test the Extract Method refactoring. I use editor.selectRange() to select a statement to extract into a method. But, when I run the unit test, the Extract Method refactoring menu item is disabled. Thus, SWTBot fails to invoke the refactoring. When we change org.eclipse.jdt.ui.actions.ExtractMethodAction so that the "Extract Method..." menu item is always enabled, our SWTBot passes. But, SWTBot should let us select the menu item without hacking the org.eclipse.jdt.ui plugin. The whole project containing the above unit test is available at github. I've also reported the problem on the Eclipse forum for SWTBot. But, we haven't received a solution from the forum.

    Read the article

  • C# testing framework that works like JUnit in Eclipse?

    - by bluebomber357
    Hello all, I come from a Java/Eclipse background and I fear that I am spoiled by how easy it is to get JUnit and JMock running in Eclipse, and have that GUI with the bar and pass/fail information pop up. It just works with no hassle. I see a lot of great options for testing in C# with Visual Studio. NUnit looks really nice because it contains unit and mock testing all in one. The trouble is, I can't figure out how to get the IDE display my results. The NUnit documentation seems to show that it doesn't automatically show results through the VS IDE. I found http://testdriven.net/, which seems to trumpet that is makes VS display these stats and work with multiple frameworks, but it isn't open source. Is there anyway to get unit and mock testing working with the VS IDE like it does in Java with Eclipse?

    Read the article

  • Mocking imported modules in Python

    - by Evgenyt
    I'm trying to implement unit tests for function that uses imported external objects. For example helpers.py is: import os import pylons def some_func(arg): ... var1 = os.path.exist(...) var2 = os.path.getmtime(...) var3 = pylons.request.environ['HTTP_HOST'] ... So when I'm creating unit test for it I do some mocking (minimock in my case) and replacing references to pylons.request and os.path: import helpers def test_some_func(): helpers.pylons.request = minimock.Mock("pylons.request") helpers.pylons.request.environ = { 'HTTP_HOST': "localhost" } helpers.os.path = minimock.Mock(....) ... some_func(...) # assert ... This does not look good for me. Is there any other better way or strategy to substitute imported function/objects in Python?

    Read the article

  • supply inputs to python unittests

    - by zubin71
    I`m relatively new to the concept of unit-testing and have very little experience in the same. I have been looking at lots of articles on how to write unit-tests; however, I still have difficulty in writing tests where conditions like the following arise:- Test user Input. Test input read from a file. Test input read from an environment variable. Itd be great if someone could show me how to approach the above mentioned scenarios; itd still be awesome if you could point me to a few docs/articles/blog posts which I could read.

    Read the article

  • SQL Azure server as unit of billing

    - by vtortola
    Hi, One of the azure training kit presentation says: Each account has zero or more logical servers Provisioned via a common portal Establishes a billing instrument Each logical server has one or more databases Contains metadata about database & usage Unit of authentication, geo-location, billing, reporting Generated DNS-based name Each database has standard SQL objects Users, Tables, Views, Indices, etc Unit of consistency So now I'm lost :D. Were not the databases themselves the units of billing? I mean, I thought that servers were just like logical containers and you were charged per number and size of databases. How servers are billed? Thanks.

    Read the article

  • Integrating Hudson with MS Test?

    - by hangy
    Is it possible to integrate Hudson with MS Test? I am setting up a smaller CI server on my development machine with Hudson right now, just so that I can have some statistics (ie. FxCop and compiler warnings). Of course, it would also be nice if it could just run my unit tests and present their output. Up to now, I have added the following batch task to Hudson, which makes it run the tests properly. "%PROGRAMFILES%\Microsoft Visual Studio 9.0\Common7\IDE\MSTest.exe" /runconfig:LocalTestRun.testrunconfig /testcontainer:Tests\bin\Debug\Tests.dll However, as far as I know, Hudson does not support analysis of MS Test results, yet. Does anyone know whether the TRX files generated by MSTest.exe can be transformed to the JUnit or NUnit result format (because those are supported by Hudson), or whether there is any other way to integrate MS Test unit tests with Hudson?

    Read the article

  • Access inner function variables in Javascript

    - by Elazar Leibovich
    In many frameworks, internal function variables are used as private variables, for example Raphael = (function(){ var private = function(a,b) {return a+b;}; var public = function(a) {return private(a,a);} var object = {mult2:public}; return object; })(); here, we cannot access from the global namespace the variable named private, as it is an inner variable of the anonymous function in the first line. Sometimes this function is contains a big Javascript framework, so that it wouldn't pollute the global namespace. I need to unit tests some object Raphael uses internally (in the above example, I wish to run unit tests on the object private). How can I test them?

    Read the article

  • Expected specifier-qualifier-list before 'CGPoint'

    - by Rob
    My project compiles and runs fine unless I try to compile my Unit Test Bundle it bombs out on the following with an "Expected specifier-qualifier-list before 'CGPoint'" error on line 5: #import <Foundation/Foundation.h> #import "Force.h" @interface WorldObject : NSObject { CGPoint coordinates; float altitude; NSMutableDictionary *forces; } @property (nonatomic) CGPoint coordinates; @property (nonatomic) float altitude; @property (nonatomic,retain) NSMutableDictionary *forces; - (void)setObject:(id)anObject inForcesForKey:(id)aKey; - (void)removeObjectFromForcesForKey:(id)aKey; - (id)objectFromForcesForKey:(id)aKey; - (void)applyForces; @end I have made sure that my Unit Test Bundle is a target of my WorldObject.m and it's header is imported in my testing header: #define USE_APPLICATION_UNIT_TEST 1 #import <SenTestingKit/SenTestingKit.h> #import <UIKit/UIKit.h> #import "Force.h" #import "WorldObject.h" @interface LogicTests : SenTestCase { Force *myForce; WorldObject *myWorldObject; } @end

    Read the article

  • mocking static method call to c# library class

    - by Joe
    This seems like an easy enough issue but I can't seem to find the keywords to effect my searches. I'm trying to unit test by mocking out all objects within this method call. I am able to do so to all of my own creations except for this one: public void MyFunc(MyVarClass myVar) { Image picture; ... picture = Image.FromStream(new MemoryStream(myVar.ImageStream)); ... } FromStream is a static call from the Image class (part of c#). So how can I refactor my code to mock this out because I really don't want to provide a image stream to the unit test.

    Read the article

  • How to access Dispatcher in Silverlight tests?

    - by bluebit
    I am using the SL unit test framework for tests (http://code.msdn.microsoft.com/silverlightut). My code is heavily client-server communications dependant, and I access the GUI dispatcher in several places to make sure important data is only accessed on a single thread (ie. the GUI thread). This dispatcher seems unavailable in the unit tests - I have tried using Deployment.Current.Dispatcher and even created an instance of a blank control to try use its own dispatcher, but both don't work. The code inside of Dispatcher.BeginInvoke() just never executes, even if I include a Thread.Sleep afterwards.

    Read the article

  • Given a short (2-week) sprint, is it ever acceptable to forgo TDD to "get things done"?

    - by Ben Aston
    Given a short sprint, is it ever acceptable to forgo TDD to "get things done" within the sprint. For example a given piece of work might need say 1/3 of the sprint to design the object model around an existing implementation. Under this scenario you might well end up with implemented code, say half way through the sprint, without any tests (implementing unit tests during this "design" stage would add significant effort and the tests would likely be thrown away a few times until the final "design" is settled upon). You might then spend a day or two in the second week adding in unit / integration tests after the fact. Is this acceptable?

    Read the article

  • How do we name test methods where we are checking for more than one condition?

    - by Sandbox
    I follow the technique specified in Roy Osherove's The Art Of Unit Testing book while naming test methods - MethodName_Scenario_Expectation. It suits perfectly well for my 'unit' tests. But,for tests that I write in 'controller' or 'coordinator' class, there isn't necessarily a method which I want to test. For these tests, I generate multiple conditions which make up one scenario and then I verify the expectation. For example, I may set some properties on different instances, generate an event and then verify that my expectation from controller/coordinator is being met. Now, my controller handles events using a private event handler. Here my scenario is that, I set some properties, say 3 condition1,condition2 and condition3 Also, my scenario includes an event is raised I don't have a method name as my event handler is private. How do I name such a test method?

    Read the article

  • What is the most idiomatic way to emulating Perl's Test::More::done_testing?

    - by DVK
    I have to build unit tests for in environment with a very old version of Test::More (perl5.8 with $Test::More::VERSION being '0.80') which predates the addition of done_testing(). Upgrading to newer Test::More is out of the question for practical reasons. And I am trying to avoid using no_tests - it's generally a bad idea not catching when your unit test exits prematurely - say due to some logic not executing when you expected it to. What is the most idiomatic way of running a configurable amount of tests, assuming no no_tests or done_testing() is used? Details: My unit tests usually take the form of: use Test::More; my @test_set = ( [ "Test #1", $param1, $param2, ... ] ,[ "Test #1", $param1, $param2, ... ] # ,... ); foreach my $test (@test_set) { run_test($test); } sub run_test { # $expected_tests += count_tests($test); ok(test1($test)) || diag("Test1 failed"); # ... } The standard approach of use Test::More tests => 23; or BEGIN {plan tests => 23} does not work since both are obviously executed before @tests is known. My current approach involves making @tests global and defining it in the BEGIN {} block as follows: use Test::More; BEGIN { our @test_set = (); # Same set of tests as above my $expected_tests = 0; foreach my $test (@tests) { my $expected_tests += count_tests($test); } plan tests = $expected_tests; } our @test_set; # Must do!!! Since first "our" was in BEGIN's scope :( foreach my $test (@test_set) { run_test($test); } # Same sub run_test {} # Same I feel this can be done more idiomatically but not certain how to improve. Chief among the smells is the duplicate our @test_test declarations - in BEGIN{} and after it. Another approach is to emulate done_testing() by calling Test::More->builder->plan(tests=>$total_tests_calculated). I'm not sure if it's any better idiomatically-wise.

    Read the article

< Previous Page | 42 43 44 45 46 47 48 49 50 51 52 53  | Next Page >