Hey Michael, 2009/5/25 [email protected] <[email protected]>: > Hello. > Thanks for great library. I am trying to use unit tests (with cppunit) in > my application. But when I've included some Wt objects my tests crashed, > although main application works fine. As far as i understand according to > documentation of WApplication at least one object must be created so > WApplication::instance() is accessible. WApplication must be constructed > with WEnivronment argument which i haven't got. Is it simple way to produce > fake environment for using in unit tests (may be providing casual end-user > conditions eq Internet Explorer/Vista/Javascript on)?
That seems a reasonable request (perhaps we should have a WTestEnvironment class which specializes WEnvironment that you can use with setters for the various properties of WEnvironment). It is very possible other things will be missing, but all of these can be fixed. The reason for other problems is that WApplication assumes that it is managed by a WebSession object (which encapsulates the entire session, from before the application was created to after it is deleted), and an associated WebRenderer object which keeps track of rendering updates. At least the WebRenderer object should easily be stubbed away as it will not interfere with unit tests, but the WebSession object may be needed, if only for its Handler object which stores (indirectly) the thread local WApplication::instance(). If you like, you can have a go at it, in any case a very useful suggestion that makes it to our wishlist ! Regards, koen ------------------------------------------------------------------------------ Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT is a gathering of tech-side developers & brand creativity professionals. Meet the minds behind Google Creative Lab, Visual Complexity, Processing, & iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian Group, R/GA, & Big Spaceship. http://www.creativitycat.com _______________________________________________ witty-interest mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/witty-interest
