Search Results

Search found 10010 results on 401 pages for 'a b testing'.

Page 88/401 | < Previous Page | 84 85 86 87 88 89 90 91 92 93 94 95  | Next Page >

  • Where to place unit test project

    - by Karsten
    I'm thinking about where to put the unit/integration test project. I follow the 1 test project pr. project convention I can think of 3 ways, that all seems good to me, which make it kind of hard to choose :-) Test project is put under a Tests sub folder to the project it tests. Test project is put next to the project it tests, in a "project".Tests folder. I believe this is what Roy Osherove recommends. Put all test projects in a sub folder in the root. e.g. \Tests\"project".Tests Something else? What you choose and why?

    Read the article

  • TFSBuild.Proj and Manual SQL Server Work Help?

    - by ScSub
    Using the VS 2008 GDR update, I have created a database project. I have created a SQL Server deployment package. I have created a database unit test. Using some wizards, the stuff got into my tfsbuild.proj file so near the end of the automated build process a database is created. I lack a little control of the whole process, I now see. What I would like to do is manually deploy the DB, run 3 custom scripts against the DB, and then manually start the DB unit test. I have other non-DB unit tests that already run. I do not want to use VSMDI or ordered unit test stuff because in out multi-developer environment it gets messy. Help!

    Read the article

  • Running a JUnit4 test - from a java program

    - by markovuksanovic
    I was wondering how to run some JUnit4 test inside a java program. Basically - depending on some conditions during runtime I need to decide which test runner to use. Using Junit3 I could override runTest method from TestCase class - but in JUnit4 tests do not extend TestCase class so I have nothing to override... Is there maybe some method that I need to implement... or sth else...

    Read the article

  • How to set locale default_url_options for functional tests (Rails)

    - by insane.dreamer
    In my application_controller, I have the following set to include the locale with all paths generated by url_for: def default_url_options(options={}) { :locale => I18n.locale } end My resource routes then have a :path_prefix = "/:locale" Works fine on the site. But when it comes to my functional tests, the :locale is not passed with the generated urls, and therefore they all fail. I can get around it by adding the locale to the url in my tests, like so: get :new, :locale => 'en' But I don't want to have to manually add the locale to every functional test. I tried adding the default_url_options def above to test_helper, but it seems to have no effect. Is there any way I can change the default_url_options to include the locale for all my tests? Thanks.

    Read the article

  • ImportError using nose, no ImportError using raw unittest ?

    - by southof40
    I get an ImportError when running my unittests using Nose and I don't when I just run it standalone. All files referred to here may be seen at http://gist.github.com/395541# . If I run the test script, importTest-Test.py, directly I get this output: C:\usr\x\data\src\Python\mmm>python importTest-Test.py In mmdb In BusinessLogic [] . ---------------------------------------------------------------------- Ran 1 test in 0.001s If I allow Nose to run it I get an error : C:\usr\x\data\src\Python\mmm>nosetests.exe E ====================================================================== ERROR: Failure: ImportError (No module named mmdb.DataAccess.AttemptDB) ---------------------------------------------------------------------- Traceback (most recent call last): File "c:\bin\installed\python2.6\lib\site-packages\nose-0.11.3-py2.6.egg\nose\loader.py", line 382, in loadTestsFromName addr.filename, addr.module) File "c:\bin\installed\python2.6\lib\site-packages\nose-0.11.3-py2.6.egg\nose\importer.py", line 39, in importFromPath return self.importFromDir(dir_path, fqname) File "c:\bin\installed\python2.6\lib\site-packages\nose-0.11.3-py2.6.egg\nose\importer.py", line 86, in importFromDir mod = load_module(part_fqname, fh, filename, desc) File "C:\usr\x\data\src\Python\mmm\importtest-Test.py", line 2, in <module> import importtest File "C:\usr\x\data\src\Python\mmm\importtest.py", line 1, in <module> from mmdb.BusinessLogic.AttemptManager import AttemptManager File "C:\usr\x\data\src\Python\mmm\mmdb\BusinessLogic\AttemptManager.py", line 1, in <module> from mmdb.DataAccess.AttemptDB import AttemptDB ImportError: No module named mmdb.DataAccess.AttemptDB ---------------------------------------------------------------------- Ran 1 test in 0.002s FAILED (errors=1) The files involved in the package which nose is having difficulties with are in the following structure - some may be seen here http://gist.github.com/395541# .: mmm\importtest-Test.py mmm\importtest.py mmm\mmdb mmm\__init__.py mmm\mmdb\BusinessLogic mmm\mmdb\BusinessObject mmm\mmdb\DataAccess mmm\mmdb\__init__.py mmm\mmdb\BusinessLogic\AttemptManager.py mmm\mmdb\BusinessLogic\Collections mmm\mmdb\BusinessLogic\__init__.py mmm\mmdb\BusinessLogic\Collections\__init__.py mmm\mmdb\BusinessObject\__init__.py mmm\mmdb\DataAccess\AttemptDB.py mmm\mmdb\DataAccess\__init__.py This is happening on Win32 / Python 2.6 / Nose 0.11.3 . I'd be grateful for any help. thanks.

    Read the article

  • How do I mock an object in this case? no obvious way to replace object with mock

    - by Tristan
    Hi there, Suppose I have this very simple method in Store's model: def geocode_address loc = Store.geocode(address) self.lat = loc.lat self.lng = loc.lng end If I want to write some test scripts that aren't affected by the geocoding service, which may be down, have limitations or depend on my internet connection, how do I mock out the geocoding service? If I could pass a geocoding object into the method, it would be easy, but I don't see how I could do it in this case. Thanks! Tristan

    Read the article

  • Establish context with Watin

    - by Ian Quigley
    Feel free to tell me I'm doing this wrong but... I have the Watin attribute [Browser("IE")] and want to extend this attribute so that it will perform an action (login) to establish the context for the test (setup). I've created public class LoggedInBrowserAttribute : BrowserAttribute which takes URL, username, password and performs the login steps. However, if for some reason the username/password won't login to the system I don't want to perform the test. In the GetBrowser method I'm doing an Assert (is logged in) which seems wrong. What is the correct way to establish this context / abort the test? I don't want to return null from GetBrowser and then have if (browser == null) at the top of my test.

    Read the article

  • Cross compiling unit tests with CppUnit or similar

    - by Mark
    Has anyone used a package like CppUnit to cross-compile C++ unit tests to run on an embedded platform? I'm using G++ on a Linux box to compile executables that must be run on a LynxOS board. I can't seem to get any of the common unit test packages to configure and build something that will create unit tests. I see a lot of unit test packages, CppUnit, UnitTest++, GTest, CppUTest, etc., but very little about using these packages in a cross-compiler scenario. The ones with a "configure" script imply that this is possible, but I can't seem to get them to configure and build.

    Read the article

  • Session variables with Cucumber Stories

    - by Matthew Savage
    I am working on some Cucumber stories for a 'sign up' application which has a number of steps. Rather then writing a Huuuuuuuge story to cover all the steps at once, which would be bad, I'd rather work through each action in the controller like a regular user. My problem here is that I am storing the account ID which is created in the first step as a session variable, so when step 2, step 3 etc are visited the existing registration data is loaded. I'm aware of being able to access controller.session[..] within RSpec specifications however when I try to do this in Cucumber stories it fails with the following error (and, I've also read somewhere this is an anti-pattern etc...): Using controller.session[:whatever] or session[:whatever] You have a nil object when you didn't expect it! The error occurred while evaluating nil.session (NoMethodError) Using session(:whatever) wrong number of arguments (1 for 0) (ArgumentError) So, it seems accession the session store isn't really possible. What I'm wondering is if it might be possible to (and I guess which would be best..): Mock out the session store etc Have a method within the controller and stub that out (e.g. get_registration which assigns an instance variable...) I've looked through the RSpec book (well, skimmed) and had a look through WebRat etc, but I haven't really found an answer to my problem... To clarify a bit more, the signup process is more like a state machine - e.g. the user progresses through four steps before the registration is complete - hence 'logging in' isn't really an option (it breaks the model of how the site works)... In my spec for the controller I was able to stub out the call to the method which loads the model based on the session var - but I'm not sure if the 'antipattern' line also applies to stubs as well as mocks? Thanks!

    Read the article

  • wxWidgets: How to initialize wxApp without using macros and without entering the main application l

    - by m_pGladiator
    We need to write unit tests for a wxWidgets application using Google Test Framework. The problem is that wxWidgets uses the macro IMPLEMENT_APP(MyApp) to initialize and enter the application main loop. This macro creates several functions including int main(). The google test framework also uses macro definitions for each test. One of the problems is that it is not possible to call the wxWidgets macro from within the test macro, because the first one creates functions.. So, we found that we could replace the macro with the following code: wxApp* pApp = new MyApp(); wxApp::SetInstance(pApp); wxEntry(argc, argv); That's a good replacement, but wxEntry() call enters the original application loop. If we don't call wxEntry() there are still some parts of the application not initialized. The question is how to initialize everything required for a wxApp to run, without actually running it, so we are able to unit test portions of it?

    Read the article

  • test questiontest question test question test question? [closed]

    - by user365217
    TestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestionTestQuestion

    Read the article

  • How test guice injections?

    - by yeraycaballero
    I gave to Google Guice the responsability of wiring my objects. But, How can I test if the bindings are working well. For example, suppose we have a class A which has a dependence B. How can I test than B is injected correctly. class A { private B b; public A() {} @Inject public void setB(B b) { this.b = b } } Notice A hasn't got a getB() method and I want to assert that A.b isn't null.

    Read the article

  • Java JUnit: The method X is ambiguous for type Y

    - by Rosarch
    I had some tests working fine. Then, I moved it to a different package, and am now getting errors. Here is the code: import static org.junit.Assert.*; import java.util.HashSet; import java.util.Map; import java.util.Set; import org.jgrapht.Graphs; import org.jgrapht.WeightedGraph; import org.jgrapht.graph.DefaultWeightedEdge; import org.jgrapht.graph.SimpleWeightedGraph; import org.junit.*; @Test public void testEccentricity() { WeightedGraph<String, DefaultWeightedEdge> g = generateSimpleCaseGraph(); Map<String, Double> eccen = JGraphtUtilities.eccentricities(g); assertEquals(70, eccen.get("alpha")); assertEquals(80, eccen.get("l")); assertEquals(130, eccen.get("l-0")); assertEquals(100, eccen.get("l-1")); assertEquals(90, eccen.get("r")); assertEquals(120, eccen.get("r-0")); assertEquals(130, eccen.get("r-1")); } The error message is this: The method assertEquals(Object, Object) is ambiguous for the type JGraphtUtilitiesTest How can I fix this? Why did this problem occur as I moved the class to a different package?

    Read the article

  • junit4 functions

    - by lamisse
    how to create generic functions that could be called from each java test? In my function startappli I have : public class startappli{ public void testMain (String[] args) { String[] logInfos = new String[3]; logInfos[0] = (String) args[0]; logInfos[1] = (String) args[1]; } @BeforeClass public static void setupOnce() { final Thread thread = new Thread() { public void run() { entrypointtoGUI.main(new String[]{"arg0 ", "arg1"}); } }; try { thread.start(); } catch (Exception ex) { } } } in the toto.java , I call the function as follow : startappli.testmain(loginfo) it doesn't work help ?

    Read the article

  • TestNG's groups

    - by the qwerty
    If we have <include name="web" > and <include name="weekend" >, TestNG runs all the methods that belong to either web or weekend. Is it possible to change this behaviour so TestNG would run all the methods that belong to web and weekend? Does anyone knows a way to accomplish this?

    Read the article

  • Moq and accessing called parameters

    - by lozzar
    I've just started to implement unit tests (using xUnit and Moq) on an already established project of mine. The project extensively uses dependency injection via the unity container. I have two services A and B. Service A is the one being tested in this case. Service A calls B and gives it a delegate to an internal function. This 'callback' is used to notify A when a message has been received that it must handle. Hence A calls (where b is an instance of service B): b.RegisterHandler(Guid id, Action<byte[]> messageHandler); In order to test service A, I need to be able to call messageHandler, as this is the only way it currently accepts messages. Can this be done using Moq? ie. Can I mock service B, such that when RegisterHandler is called, the value of messageHandler is passed out to my test? Or do I need to redesign this? Are there any design patterns I should be using in this case? Does anyone know of any good resources on this kind of design?

    Read the article

  • How rspec works with rails3 for integration-tests?

    - by makevoid
    What I'm trying to ahieve is to do integration tests with webrat in rails3 like Yehuda does with test-unit in http://pivotallabs.com/talks/76-extending-rails-3 minute 34. an example: describe SomeApp it "should show the index page" visit "/" body.should =~ /hello world/ end end Does someone knows a way to do it?

    Read the article

  • Asp.Net MVC Tutorial Unit Tests

    - by Nicholas
    I am working through Steve Sanderson's book Pro ASP.NET MVC Framework and I having some issues with two unit tests which produce errors. In the example below it tests the CheckOut ViewResult: [AcceptVerbs(HttpVerbs.Post)] public ViewResult CheckOut(Cart cart, FormCollection form) { // Empty carts can't be checked out if (cart.Lines.Count == 0) { ModelState.AddModelError("Cart", "Sorry, your cart is empty!"); return View(); } // Invoke model binding manually if (TryUpdateModel(cart.ShippingDetails, form.ToValueProvider())) { orderSubmitter.SubmitOrder(cart); cart.Clear(); return View("Completed"); } else // Something was invalid return View(); } with the following unit test [Test] public void Submitting_Empty_Shipping_Details_Displays_Default_View_With_Error() { // Arrange CartController controller = new CartController(null, null); Cart cart = new Cart(); cart.AddItem(new Product(), 1); // Act var result = controller.CheckOut(cart, new FormCollection { { "Name", "" } }); // Assert Assert.IsEmpty(result.ViewName); Assert.IsFalse(result.ViewData.ModelState.IsValid); } I have resolved any issues surrounding 'TryUpdateModel' by upgrading to ASP.NET MVC 2 (Release Candidate 2) and the website runs as expected. The associated error messages are: *Tests.CartControllerTests.Submitting_Empty_Shipping_Details_Displays_Default_View_With_Error: System.ArgumentNullException : Value cannot be null. Parameter name: controllerContext* and the more detailed at System.Web.Mvc.ModelValidator..ctor(ModelMetadata metadata, ControllerContext controllerContext) at System.Web.Mvc.DefaultModelBinder.OnModelUpdated(ControllerContext controllerContext, ModelBindingContext bindingContext) at System.Web.Mvc.DefaultModelBinder.BindComplexModel(ControllerContext controllerContext, ModelBindingContext bindingContext) at System.Web.Mvc.Controller.TryUpdateModel[TModel](TModel model, String prefix, String[] includeProperties, String[] excludeProperties, IValueProvider valueProvider) at System.Web.Mvc.Controller.TryUpdateModel[TModel](TModel model, IValueProvider valueProvider) at WebUI.Controllers.CartController.CheckOut(Cart cart, FormCollection form) Has anyone run into a similar issue or indeed got the test to pass?

    Read the article

  • C# unit test code questions

    - by 5YrsLaterDBA
    We start use C# build-in unit test functionality. I have VisualStudio 2008 created unit test code for me. I have few question above the generated code. Following are code I copied from the generated file: #region Additional test attributes // //You can use the following additional attributes as you write your tests: // //Use ClassInitialize to run code before running the first test in the class //[ClassInitialize()] //public static void MyClassInitialize(TestContext testContext) //{ //} // //Use ClassCleanup to run code after all tests in a class have run //[ClassCleanup()] //public static void MyClassCleanup() //{ //} // //Use TestInitialize to run code before running each test //[TestInitialize()] //public void MyTestInitialize() //{ //} // //Use TestCleanup to run code after each test has run //[TestCleanup()] //public void MyTestCleanup() //{ //} // #endregion If I need the initialize and cleanup methods, do I need to remove those "My" from the method name when I enable them? //Use ClassInitialize to run code before running the first test in the class //[ClassInitialize()] //public static void MyClassInitialize(TestContext testContext) //{ //} Do I need to call the "MyClassInitialize" method somewhere before running the first test or it will be called automatically before other methods are called. Similar questions for other three methods, are they called automatically at right time frame?

    Read the article

  • How to mock Request.Files[] in MVC unit test class?

    - by kapil
    I want to test a controller method in MVC unit test. For my controller method to test, I require a Request.Files[] collection with length one. I want to mock Request.Files[] as I have used a file upload control on my view rendered by controller method. Can anyone please suggest how can I mock request.file collection in my unit test. thanks, kapil

    Read the article

  • How to turn off Turbo Boost temporarily?

    - by actual
    In our application we have many versions of the same routine optimized for different kind of processor architectures. During install we run performance tests and select the best version of routine. Latest processors can boost their frequencies if few cores are in use, so sometimes our tests peeking wrong version of routine. Is there some way to temporarily turn off Turbo Boost?

    Read the article

< Previous Page | 84 85 86 87 88 89 90 91 92 93 94 95  | Next Page >