Search Results

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

Page 112/401 | < Previous Page | 108 109 110 111 112 113 114 115 116 117 118 119  | Next Page >

  • How to test soft deletion event listner without setting up NHibernate Sessions

    - by isuruceanu
    I have overridden the default NHibernate DefaultDeleteEventListener according to this source: http://nhforge.org/blogs/nhibernate/archive/2008/09/06/soft-deletes.aspx so I have protected override void DeleteEntity( IEventSource session, object entity, EntityEntry entityEntry, bool isCascadeDeleteEnabled, IEntityPersister persister, ISet transientEntities) { if (entity is ISoftDeletable) { var e = (ISoftDeletable)entity; e.DateDeleted = DateTime.Now; CascadeBeforeDelete(session, persister, entity, entityEntry, transientEntities); CascadeAfterDelete(session, persister, entity, transientEntities); } else { base.DeleteEntity(session, entity, entityEntry, isCascadeDeleteEnabled, persister, transientEntities); } } How can I test only this piece of code, without configuring an NHIbernate Session?

    Read the article

  • Method parameters have incorrect values when using RowTest in VB.Net

    - by simon_bellis
    Hello, I have the following test method (VB.NET) <RowTest()> _ <Row(1, 2, 3)> _ Public Sub AddMultipleNumbers(ByVal number1 As Integer, ByVal number2 As Integer, ByVal result As Integer) Dim dvbc As VbClass = New VbClass() Dim actual As Integer = dvbc.Add(number1, number2) Assert.That(actual, [Is].SameAs(result)) End Sub My problem is that when the test runs, using TestDriven.Net, the three method parameters are 0 and not the values I am expecting. I have referenced the NUnit.Framework (v.2.5.3.9345) anf the NUnitExtension.RowTest (v.1.2.3.0).

    Read the article

  • Why junit ComparisonFailure is not used by assertEquals(Object, Object) ?

    - by Philippe Blayo
    In Junit 4, do you see any drawback to throw a ComparisonFailure instead of an AssertionError when assertEquals(Object, Object) fails ? assertEquals(Object, Object) throws a ComparisonFailure if both expected and actual are String an AssertionError if either is not a String @Test(expected=ComparisonFailure.class ) public void twoString() { assertEquals("a String", "another String"); } @Test(expected=AssertionError.class ) public void oneString() { assertEquals("a String", new Object()); } The two reasons why I ask the question: ComparisonFailure provide far more readable way to spot the differences in dialog box of eclipse or Intellij IDEA (FEST-Assert throws this exception) Junit 4 already use String.valueOf(Object) to build message "expected ... but was ..." (format method invoqued by Assert.assertEquals(message, Object, Object) in junit-4.8.2): static String format(String message, Object expected, Object actual) { ... String expectedString= String.valueOf(expected); String actualString= String.valueOf(actual); if (expectedString.equals(actualString)) return formatted + "expected: " + formatClassAndValue(expected, expectedString) +" but was: " + formatClassAndValue(actual, actualString); else return formatted +"expected:<"+ expectedString +"> but was:<"+ actualString +">"; Isn't it possible in assertEquals(message, Object, Object) to replace fail(format(message, expected, actual)); by throw new ComparisonFailure(message, formatClassAndValue(expectedObject, expectedString), formatClassAndValue(actualObject, actualString)); Do you see any compatibility issue with other tool, any algorithmic problem with that... ?

    Read the article

  • Any suggestions for improvement on this style for BDD/TDD?

    - by Sean B
    I was tinkering with doing the setups with our unit test specifciations which go like Specification for SUT when behaviour X happens in scenario Y Given that this thing And also this other thing When I do X... Then It should do ... And It should also do ... I wrapped each of the steps of the GivenThat in Actions... any feed back whether separating with Actions is good / bad / or better way to make the GivenThat clear? /// <summary> /// Given a product is setup for injection /// And Product Image Factory Is Stubbed(); /// And Product Size Is Stubbed(); /// And Drawing Scale Is Stubbed(); /// And Product Type Is Stubbed(); /// </summary> protected override void GivenThat() { base.GivenThat(); Action givenThatAProductIsSetupforInjection = () => { var randomGenerator = new RandomGenerator(); this.Position = randomGenerator.Generate<Point>(); this.Product = new Diffuser { Size = new RectangularProductSize( 2.Inches()), Position = this.Position, ProductType = Dep<IProductType>() }; }; Action andProductImageFactoryIsStubbed = () => Dep<IProductBitmapImageFactory>().Stub(f => f.GetInstance(Dep<IProductType>())).Return(ExpectedBitmapImage); Action andProductSizeIsStubbed = () => { Stub<IDisplacementProduct, IProductSize>(p => p.Size); var productBounds = new ProductBounds(Width.Feet(), Height.Feet()); Dep<IProductSize>().Stub(s => s.Bounds).Return(productBounds); }; Action andDrawingScaleIsStubbed = () => Dep<IDrawingScale>().Stub(s => s.PixelsPerFoot).Return(PixelsPerFoot); Action andProductTypeIsStubbed = () => Stub<IDisplacementProduct, IProductType>(p => p.ProductType); givenThatAProductIsSetupforInjection(); andProductImageFactoryIsStubbed(); andProductSizeIsStubbed(); andDrawingScaleIsStubbed(); andProductTypeIsStubbed(); }

    Read the article

  • Need help mocking a ASP.NET Controller in RhinoMocks

    - by Pure.Krome
    Hi folks, I'm trying to mock up a fake ASP.NET Controller. I don't have any concrete controllers, so I was hoping to just mock a Controller and it will work. This is what I have, currently. _fakeRequestBase = MockRepository.GenerateMock<HttpRequestBase>(); _fakeRequestBase.Stub(x => x.HttpMethod).Return("GET"); _fakeContextBase = MockRepository.GenerateMock<HttpContextBase>(); _fakeContextBase.Stub(x => x.Request).Return(_fakeRequestBase); var controllerContext = new ControllerContext(_fakeContextBase, new RouteData(), MockRepository.GenerateMock<ControllerBase>()); _fakeController = MockRepository.GenerateMock<Controller>(); _fakeController.Stub(x => x.ControllerContext).Return(controllerContext); Everything works except the last line, which throws a runtime error and is asking me for some Rhino.Mocks source code or something (which I don't have). See how I'm trying to mock up an abstract Controller - is that allowed? Can someone help me?

    Read the article

  • Python: How to run unittest.main() for all source files in a subdirectory?

    - by Pete
    I am developing a Python module with several source files, each with its own test class derived from unittest right in the source. Consider the directory structure: dirFoo\ test.py dirBar\ __init__.py Foo.py Bar.py To test either Foo.py or Bar.py, I would add this at the end of the Foo.py and Bar.py source files: if __name__ == "__main__": unittest.main() And run Python on either source, i.e. $ python Foo.py ........... ---------------------------------------------------------------------- Ran 11 tests in 2.314s OK Ideally, I would have "test.py" automagically search dirBar for any unittest derived classes and make one call to "unittest.main()". What's the best way to do this in practice? I tried using Python to call execfile for every *.py file in dirBar, which runs once for the first .py file found & exits the calling test.py, plus then I have to duplicate my code by adding unittest.main() in every source file--which violates DRY principles.

    Read the article

  • Recipe for creating a corrupt mysql table

    - by Chaim Geretz
    We had a process that crashed while trying to manipulate an expected mysql record set, running the offending query from the mysql cli showed the following. mysql SELECT ...; ERROR 1030: Got error 127 from table handler Is there a way to easily recreate this condition so we can validate our fix ? (production DB was already repaired).

    Read the article

  • Configure lua prosody for localhost only

    - by Alfred
    I want to use prosody or maybe another xmpp server to test my xmpp bot. I want it to only accept connection from the address/localhost(don't want to configure firewall to block access). I would like to know the easiest way to accomplish this.

    Read the article

  • Simulating interaction between two users in Jmeter

    - by Victoria
    I have to register two users and simulate interaction between them (for example, a conversation). I can do the following: register the first user, then register the second, sign in using first user's data, write message to the second user and sign out. Then sign in using the second user's data, answer to the message and sign out. Is it possible to implement users' conversation without signing out if the system requires enabled cookies for users?

    Read the article

  • Is it possible to talk to the iPhone simulator/device.

    - by Plumenator
    I need to automate the build/deploy process for my iphone applications from a script. I can use xcodebuild to build the project, then use Applescript to deploy and debug/run the application. Assuming the application will stop by itself after a while, I need to collect the generated logs for verification. But the problem is I have no way to know when the application ended from outside of the application itself. If the running time is fixed, I can again use Applescript to stop the application (Cmd+Shift+Enter). So there has to be a way to connect to the device/simulator and wait on the application somehow.

    Read the article

  • How do I fix my Unit Test to have global access to everything?

    - by SLC
    Usually when you add one (in Visual Basic), it pops up a message asking if you want to enable an option that lets the test access things like private methods etc. However, I am editing a solution that does not have this enabled. I'd like to enable it so my unit tests will work, but I can't find the setting. Can anyone tell me how to enable it after the project has been created?

    Read the article

  • Not Able to call The method Asynchronously in the Unit Test.

    - by user43838
    Hi everyone, I am trying to call a method that passes an object called parameters. public void LoadingDataLockFunctionalityTest() { DataCache_Accessor target = DataCacheTest.getNewDataCacheInstance(); target.itemsLoading.Add("WebFx.Caching.TestDataRetrieverFactorytestsync", true); DataParameters parameters = new DataParameters("WebFx.Core", "WebFx.Caching.TestDataRetrieverFactory", "testsync"); parameters.CachingStrategy = CachingStrategy.TimerDontWait; parameters.CacheDuration = 0; string data = (string)target.performGetForTimerDontWaitStrategy(parameters); TestSyncDataRetriever.SimulateLoadingForFiveSeconds = true; Thread t1 = new Thread(delegate() { string s = (string)target.performGetForTimerDontWaitStrategy(parameters); Console.WriteLine(s ?? String.Empty); }); t1.Start(); t1.Join(); Thread.Sleep(1000); ReaderWriterLockSlim rw = DataCache_Accessor.GetLoadingLock(parameters); Assert.IsTrue(rw.IsWriteLockHeld); Assert.IsNotNull(data); } My test is failing all the time and i am not able step through the method.. Can someone please put me in the right direction Thanks

    Read the article

  • How can I change a connection string, or other app settings, at test time in Visual Studio 2008?

    - by David
    I need to test a class library project in VS. This project, itself, does not have a web.config file, but the classes do on the web server to which it's deployed. I access these like this: ConfigurationManager.ConnectionStrings["stringname"].ConnectionString; Can I adjust these strings while running unit tests in VS? Should I have considered a different design method to avoid this problem?

    Read the article

  • Need a good website URL to test against

    - by Zombies
    I need a URL to just test basic http connectivity. It needs to be consistent and: Always be up Never change drastically due to IP or user agent. (IE: 301 Location redirect/ huge difference in content... minor would be tolerable) The URL itself has a consistent content-length. (IE: it doesn't vary from by 2kb at most, ever) A few examples, yet none match all 3 criteria: One example of always up: www.google.com (yet it 301 redirects based on IP location). Another good one is http://www.google.com/webhp?hl=en. but the problem there is that based on a given holiday, the content-length can really vary.

    Read the article

  • How to flush coverage data when my test cause app crash - For ios app

    - by Ypy
    I want to get the code coverage of my tests. So I set the settings, build an app with .gcno files and run it on simulator. It can get the coverage data successfully if there is no crash issue. But if the app crashed, I will get nothing. So how can I get the code coverage data when the app crash? In my thought, this is because it will not call __gcov_flush() method when app crash. I only add app does not run in background to my plist file, so __gcov_flush() is called only at the time I press Home button. Is there any way to call __gcov_flush() before the app crash?

    Read the article

  • Running unittest with typical test directory structure.

    - by Major Major
    The very common directory structure for even a simple Python module seems to be to separate the unit tests into their own test directory: new_project/ antigravity/ antigravity.py test/ test_antigravity.py setup.py etc. for example see this Python project howto. My question is simply What's the usual way of actually running the tests? I suspect this is obvious to everyone except me, but you can't just run python test_antigravity.py from the test directory as its import antigravity will fail as the module is not on the path. I know I could modify PYTHONPATH and other search path related tricks, but I can't believe that's the simplest way - it's fine if you're the developer but not realistic to expect your users to use if they just want to check the tests are passing. The other alternative is just to copy the test file into the other directory, but it seems a bit dumb and misses the point of having them in a separate directory to start with. So, if you had just downloaded the source to my new project how would you run the unit tests? I'd prefer an answer that would let me say to my users: "To run the unit tests do X."

    Read the article

  • Fluent NHibernate CheckProperty and Dates

    - by Chris C
    I setup a NUnit test as such: new PersistenceSpecification<MyTable>(_session) .CheckProperty(c => c.ActionDate, DateTime.Now); When I run the test via NUnit I get the following error: SomeNamespace.MapTest: System.ApplicationException : Expected '2/23/2010 11:08:38 AM' but got '2/23/2010 11:08:38 AM' for Property 'ActionDate' The ActionDate field is a datetime field in a SQL 2008 database. I use Auto Mapping and declare the ActionDate as a DateTime property in C#. If I change the test to use DateTime.Today the tests pass. My question is why is the test failing with DateTime.Now? Is NHibernate losing some precision when saving the date to the database and if so how do prevent the lose? Thank you.

    Read the article

  • Does anyone know what causes this error? VC++ with VisualAssert

    - by TerryJohnson
    Hi does anyone know what causes this error? In Visual Studio 2008 with Visual Assert Thanks 1>------ Build started: Project: ChessRound1, Configuration: Debug Win32 ------ 1>Compiling... 1>stdafx.cpp 1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\xlocnum(135) : error C2857: '#include' statement specified with the /Ycstdafx.h command-line option was not found in the source file 1>Build log was saved at "file://c:\Users\Admin1\Documents\Visual Studio 2008\Projects\ChessRound1\ChessRound1\Debug\BuildLog.htm" 1>ChessRound1 - 1 error(s), 0 warning(s) ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

    Read the article

  • Using Selenium 2's IWebDriver to interact with elements on the page

    - by Andreas Grech
    I'm using Selenium's IWebDriver to write Unit Tests in C#. Such is an example: IWebDriver defaultDriver = new InternetExplorerDriver(); var ddl = driver.FindElements(By.TagName("select")); The last line retrieves the select HTML element wrapped in a IWebElement. I need a way to simulate selection to a specific option in that select list but I can't figure out how to do it. Upon some research, I found examples where people are using the ISelenium DefaultSelenium class to accomplish the following, but I am not making use of this class because I'm doing everything with IWebDriver and INavigation (from defaultDriver.Navigate()). I also noticed that ISelenium DefaultSelenium contains a ton of other methods that aren't available in the concrete implementations of IWebDriver. So is there any way I can use IWebDriver and INavigation in conjunction with ISelenium DefaultSelenium ?

    Read the article

  • Perfom python unit tests via a web interface

    - by 47
    Is it possible to perform unittest tests via a web interface...and if so how? EDIT: For now I want the results...for the tests I want them to be automated...possibly every time I make a change to the code. Sorry I forgot to make this more clear

    Read the article

  • How to skip certain tests with Test::Unit

    - by Daniel Abrahamsson
    In one of my projects I need to collaborate with several backend systems. Some of them somewhat lacks in documentation, and partly therefore I have some test code that interact with some test servers just to see everything works as expected. However, accessing these servers is quite slow, and therefore I do not want to run these tests every time I run my test suite. My question is how to deal with a situation where you want to skip certain tests. Currently I use an environment variable 'BACKEND_TEST' and a conditional statement which checks if the variable is set for each test I would like to skip. But sometimes I would like to skip all tests in a test file without having to add an extra row to the beginning of each test. The tests which have to interact with the test servers are not many, as I use flexmock in other situations. However, you can't mock yourself away from reality. As you can see from this question's title, I'm using Test::Unit. Additionally, if it makes any difference, the project is a Rails project.

    Read the article

  • How to ignore a test within the JUnit test method itself

    - by Benju
    We have a number of integration tests that fail when our staging server goes down for weekly maintenance. When the staging server is down we send a specific response that I could detect in my integration tests. When I get this response instead of failing the tests I'm wondering if it is possible to skip/ignore that test even though it has started running. This would keep our test reports a bit cleaner. Does anybody have suggestions?

    Read the article

< Previous Page | 108 109 110 111 112 113 114 115 116 117 118 119  | Next Page >