unit-testing

setBackingStoreLocation

What is the base path of setBackingStoreLocation? I've setNoStorage to false. I see datastore-indexes-auto.xml being created in \WEB-INF\appengine-generated(not \war\WEB-INF\appengine-generated). I've tried providing an empty string, null, not setting it at all, and an absolute path, all with both a file name specified as well as wit...

Unittest web application in java?

What is the "best" (or a good way) to unittest java web applications, that is not using an existing framework such as struts, stripes or spring? Is using tools like httpunit or htmlunit good? Which is the best if so? Would really appreciate an answer since I will depend on it in this project, so finding out that my choice sucked half-wa...

Should Unit Tests be in their own project in a .Net Solution

Should I start a new project for my unit tests? That would mean that I would get two executables correct? Then I am worried about the namespace organization. Would I be able to put the unit test in the same namespaces as the classes that they are testing although they are part of a different project? This raises another question. I know...

Django models caching? How to disable in tests

First, the code of my tests.py def test_get_current(self): m = Member.objects.create(...) q = Question.objects.create(name="q1", text="q1", start_datetime=self.day_before, close_datetime=self.day_after, type=self.type) r = Response.objects.create(question=q, text='response') expected = q, None #self.assertEquals(exp...

Unit Testing Private Method in Resource Managing Class (C++)

I previously asked this question under another name but deleted it because I didn't explain it very well. Let's say I have a class which manages a file. Let's say that this class treats the file as having a specific file format, and contains methods to perform operations on this file: class Foo { std::wstring fileName_; public: ...

VS 2010 and MBUnit how to run just one test

I have Gallio/MbUnit installed and am using VS 2010 RC and I want to be able to run a single unit test or just all unit tests inside of a TestFixture and not all the tests in the entire project everytime I debug. How do you do this in VS 2010? ...

Ensure teardown runs in Test::Unit::TestCase?

I'm using Test::Unit::TestCase to write some unit tests. Currently, I have a setup function that moves and modifies some fixture files and folders on disk. (This is a necessary evil at the moment.) If a test crashes, the teardown method doesn't get called, leaving files and folders in the way. The next time I run a test, it complains...

Unit testing void methods/mocking object tell-tale signs

When unit testing a codebase, what are the tell-tale signs that I need to utilise mock objects? Would this be as simple as seeing a lot of calls to other objects in the codebase? Also, how would I unit test methods which don't return values? So if I a method is returning void but prints to a file, do I just check the file's contents? ...

Unit testing paperclip uploads with Rspec (Rails)

Total Rspec noob here. Writing my first tests tonight. I've got a model called Image. Using paperclip I attach a file called photo. Standard stuff. I've run the paperclip generator and everything works fine in production and test modes. Now I have a spec file called image.rb and it looks like this (it was created by ryanb's nif...

Testing python methods that call class methods

I have a very simple method: Class Team(models.Model): def sides(self): return SideNames.objects.filter(team=self) SideNames is another model defined in the same file as Team, Which when I try and test: self.assertEquals(len(t.sides()), 2) I get the following error: return SideNames.objects.filter(team=self) Att...

Is structured basis testing different from code/logic coverage testing

When people speak of structured basis testing, do they just mean code coverage or logic coverage testing, or is there another angle to it which covers more than just those principles? ...

Testing 'pluggable' function calls clashes for WordPress and unit testing

WordPress has a group of functions call pluggable functions; basically, they are designed to be overrided for new functionality, but there is a catch - if another plugin define that function first, some other plugin of a lower priority cannot...(or else there will be a fatal error). Hence it is common to have 'include guards' like this ...

Mock Runtime.getRuntime()?

Can anyone make any suggestions about how best to use EasyMock to expect a call to Runtime.getRuntime().exec(xxx)? I could move the call into a method in another class that implements an interface, but would rather not in an ideal world. interface RuntimeWrapper { ProcessWrapper execute(String command) throws IOException; } interf...

How we have unit testing philosophy ?

Hi stackoverflow family. It is doubtless that unit testing is of great importance in software development. But i think it is practice and philosophy which is test first. And majority of developers want to use this philosophy, but they can't perform it on their project because they aren't used to Test Driven Development. Now my qu...

Django unit testing for form edit

Someone has probably already developed a technique for relieving the tedium for the following idiomatic unit test: GET a url with form data already populated POST a revised form with one or more fields edited Check response (profit!) Step 2 is the most tedious, cycling through the form fields. Are there any time-saving hacks for tes...

unit test with mock objects

Please take a look at the following article about testing with mocks So there is an example of unit test with mock objects. As you can see, the test is written for GetPersonByID method. In the IPersonServices interface there is another method: List<Person> GetPersons(); Can anyone tell me how a Test method on this service should look ...

RegexValidator does not work for char?

Hello, Why the following test does not fail? [TestMethod()] public void tip_cicluTest() { MyBO target = new MyBO() { tip_ciclu = 'S' }; char expected = 'S'; char actual = target.tip_ciclu; Assert.AreEqual(expected, actual); ValidationResults vr = Validation.Validate<MyBO>(target,"vali...

Should DAOs (aka Repositories) be unit tested?

The parts of any repository/DAO implementation worth testing are the queries. To ensure that these queries are correct, you'd have to run it in the actual database. Given the above facts does it make sense to unit test DAOs/Respositories? If yes what are the best practices? ...

Which Unit Testing framework?

Hi! I wondered which Unit testing framework would be a good one to get really familiar with? I know this might be a question of opinion, but I thought I'd ask anyways. I know that I will need to do it someday, so I might as well learn to use it. I know that there is quite a few out there, but which one is effective for C# development?...

Assert.AreEqual question

Hello, I have a test method: [TestMethod()] public void test_chars() { MyBO target = new MyBO() { x = 'S' }; char[] expected = {'D','d','M','m','L','l'}; char actual = target.s; Assert.AreEqual(actual, expected); // ? } How can i check with Assert.AreEqual if target.x is in that char[] ...