unit-testing

Google App Engine Unittest: Difficulty with AssertEquals

I have a unit test for my GAE app: def test_getNeighborhoodKeys_twoCourses(self): cs1110, cs2110 = testutils.setUpSimpleCourses() foo = getFooResult() bar = getBarResult() self.assertEquals(foo, bar) # fails This is the failure: AssertionError: set([CS 1110: Untitled, CS 2110: Untitled]) != s...

GAEUnit: Trouble with long strings in assert statements?

I'm having an odd error where GAEUnit seems to be hung on assertion statements that have error strings that are too long. I'm running these tests on the GAE Dev server 1.3.3. This works just fine: self.assertEquals(2 + 2, 5, "[2, 3, 4]") # works However, if I defined a longer string, and try to print that out: jsonTest = '''[ ...

What is a good tool for unit testing javascript in a maven webapp / liftweb project?

I want to unit test the javascript I have embedded in the webapp portion of my liftweb project. Liftweb is a subset of the maven webapp archetype, so my question applies to that framework as well. By 'good', I mean that the tests can be integrated into the maven automated testing. I understand that different browsers support different...

Is it possible to debug code that is being unit tested in Visual Studio 2010?

I have some code that is failing tests, but I can't understand why. I made the error of making a big chunck of code without making tests first / making tests during the coding. Now it simply doesn't work and I'd like to know if it is possible to put break points or something in the code that is failing so I can check on what is happening...

Xml Dom library with unit tests

Googled for a Xml Dom open source library that ships with unit tests, but could not find any. Are there any dom libraries, java or .net that have unit tests? ...

Unit Testing & Bug Repo for Vb.Net 2005

Working on a company using the .Net Framework 2 (vb6 and vb.net 2005) and a very rudimentary sourceforge setup, I'm kindof at a loss when I was tasked to "...find a suitable Open Source Unit Testing & Bug Tracking system..." for the team. Those were my superior's exact words. I know about the Team Foundation Server's capabilities, but ...

How do I convince programmers in my team to do TDD?

I am aware of this question: http://stackoverflow.com/questions/428691/how-to-encourage-implementation-of-tdd In my team, we write a lot of unit tests. But, in general the programmers tend to write unit tests after wrting the code. So, we first finish the module functionality and then write tests. Our coverage is around 70% for most mod...

Why does my project not get rebuilt and references in my unit tests not get updated when targeting x86?

I have a Console App created in VS 2010 targeting .NET 4.0. According to Microsoft (Rick Byers) AnyCPU is no longer the default for Console Apps because, in the Microsoft way, they feel like it is a better idea to default to x86. Also, the option to change the platform to AnyCPU, or x64 for that matter, does not seem to be available. ...

How do you create a python package with a built in "test/main.py" main function?

Desired directory tree: Fibo |-- src | `-- Fibo.py `-- test `-- main.py What I want is to call python main.py after cd'ing into test and executing main.py will run all the unit tests for this package. Currently if I do: import Fibo def main(): Fibo.fib(100) if __name__ == "__main__": main() I get an error: "ImportE...

Testing event handling with mocks using nunit

I need to create some unit tests that confirm that instance of a class responds appropriately to an event raised by another object. Passing in a mock of the 'watched' object is easy enough, but as far as I can tell, mocks in nunit don't provide a means of having the mock raise an event. I'm considering using reflection to directly invok...

PHPUnit Stubbing Class methods declared as "final"

Hi, I'm writing a unit test for a class method that calls another class's method using a mock, only the method that needs to be called is declared as final, so PHPUnit is unable to mock it. Is there a different approach I can take? example: class to be mocked class Class_To_Mock { final public function needsToBeCalled($options) ...

NHibernate Generated values and Testing

I'm using NHibernate for data access. I'm working on writing some tests for my data access layer and have a scenario where I'm selecting records within a specific date range. In test, I generate test data by just selecting random dates within a range and then I try to select records with dates within a subset o that range. For instanc...

How do I use Rhino.Mocks to mock a ControllerContext

I am trying to use Rhino.Mocks to mock up a ControllerContext object to gain access to runtime objects like User, Request, Response, and Session in my controller unit tests. I've written the below method in an attempt to mock up a controller. private TestController CreateTestControllerAs(string userName) { var mock = MockRepository....

Unit Testing the Server Interface for a Silverlight-Facebook Application

I have a Silverlight 4 client running on a Facebook page hosted on Google App Engine. It's using gminifb to communicate with the Facebook API. The Silverlight client uses POST calls to the URIs for each method and passes the session information from Facebook with each call. The project's growing and it would be super-useful if I could s...

How can this SwingWorker code be made testable

Consider this code: public void actionPerformed(ActionEvent e) { setEnabled(false); new SwingWorker<File, Void>() { private String location = url.getText(); @Override protected File doInBackground() throws Exception { File file = new File("out.txt"); Writer writer = null; ...

JUnit Exception Testing

Edit: Not JUnit 4 available at this time. Hi there, I have a question about "smart" exception testing with JUnit. At this time, I do it like this: public void testGet() { SoundFileManager sfm = new SoundFileManager(); // Test adding a sound file and then getting it by id and name. try { SoundFile add...

[android] how to test Menu

Hello, I need to cover Menu functionality by unit tests, however I'm struggling to obtain Menu object. Following test case fails (mMenu is null): public void testMenu() { sendKeys(KeyEvent.KEYCODE_MENU); mMenu = (Menu) mActivity.findViewById(com.###.###.R.id.main_menu); assertNotNull(mMenu); } Please advice. Thank you....

Unit testing an MVC project with EF?

Hello! I am trying to start unit testing an MVC2 project, which uses the Entity Framework. When I run my "hello world" test, it fails saying this: The specified named connection is either not found in the configuration, not intended to be used with the EntityClient provider, or not valid. How can I pass the connection data (w...

MSTest exception: Unit Test Adapter threw exception: Type is not resolved for member...

In my project I write tests using Microsoft's unit testing framework. All of my tests pass when I run them from Visual Studio but when I run the tests from MSBuild all of the tests fail with the following erorr message: Unit Test Adapter threw exception: Type is not resolved for member SomeType,*SomeAssembly* Version=assemblyVers...

unit test for Java Swing application

Hi, I'm looking to Unit Test a Swing application and was wondeing what would eb the best(easiest) approach to achieve this objective with almost full line coverage. If it matters, I'm using Eclipse Galileo for developemnt. Thanks. ...