unit-testing

IDE stopping at thrown AssertionException, rather than failing the test. (MSTestExtensions culprit?)

I am using NUnit asserts within a MSTest project like as follows (NOTE: This shouldn't matter see comments to Dave Falkner's answer): using Microsoft.VisualStudio.TestTools.UnitTesting; using MSTestExtensions; using Assert = NUnit.Framework.Assert; using Is = NUnit.Framework.Is; This has worked great in my unit tests, but in my integr...

Is there a repository of pre-built JUnit tests for common Java Interfaces?

I'm teaching a data structures class this semester and we build gobs of JUnit tests given component interfaces. We then use setUp to plug in a specific concrete implementation. In most cases we are implementing java.util interfaces. Is there a common set of rigorous JUnit tests for common Java components, or some sort of framework tha...

Is there a version of JUnit assertThat which uses the Hamcrest 'describeMismatch' functionality?

In every version of JUnit I have tried (up to 4.8.1), a failing assertThat will display an error message that looks like: expected: [describeTo] got: [String representation of object] In other words, it will display the toString() of the object instead of the mismatch description from the Matcher. If I use the assertThat from org.hamc...

Unit testing for an event using Reactive Extensions

I'm using Reactive Extensions for .NET (Rx) to expose events as IObservable<T>. I want to create an unit test where I assert that a particular event is fired. Here is a simplified version of the class I want to test: public sealed class ClassUnderTest : IDisposable { Subject<Unit> subject = new Subject<Unit>(); public IObservable<...

why python nose unittest teardown fixture failed

Hi, I'm using nose test framework. When running a test module, the teardown function defined in it failed. the error raised says the fixture is locked by another process. here is my test module, test_my_module.py: ... ... def teardown(): if os.path.exists(test_output_dir): shutil.rmtree(test_output_dir) ... ... @with_s...

How to run unit tests (MSTest) in parallel ?

I am looking for ways to run test suites in parallel. I am aware of .testrunconfig setting. This allows you to multiplex on the number of CPUs. I want to run 1000 tests in parallel. This makes sense because I am testing a web service, so 90% of the time spent in a test is waiting for the service to respond. Any ideeas on how to p...

Selenium wait for download?

I'm trying to test the happy-path for a piece of code which takes a long time to respond, and then begins writing a file to the response output stream, which prompts a download dialog in browsers. The problem is that this process has failed in the past, throwing an exception after this long amount of work. Is there a way in selenium to ...

Non-void test methods in JUnit 4

I would like a JUnit 4 test class to implement the same interface as the class its testing. This way, as the interface changes (and it will, we're in early development), the compiler guarantees that corresponding methods are added to the test class. For example: public interface Service { public String getFoo(); public String getB...

How to indicate that a PHPUnit test is expected to fail?

Is it possible to mark a test as "expected to fail" with PHPUnit? This would be useful when performing TDD, and you want to distinguish between genuinely failed tests, and tests that happen to fail because the associated code hasn't been written yet. ...

C# Repository using Generics

I have the following repository that I use for unit testing: public class MyTestRepository<T> { private List<T> entities = new List<T>(); public IQueryable<T> Entities { get { return entities.AsQueryable(); } } public T New() { //return what here??? } public void Create(T entity) { ...

Testing Javascript with Google Website Optimizer?

Can I test Javascript code in GWO? For example, how would I test: $('#first_name_field').watermark('First name'); Ideally the person who tests different content doesn't have to enter lots of javascript, only the text they want to change... like "First name" above. ...

Transpose a File in unix

I have file something like this 1111,K1 2222,L2 3333,LT50 4444,K2 1111,LT50 5555,IA 6666,NA 1111,NA 2222,LT10 Output that is need 1111,K1,LT50,NA 2222,L2,LT10 3333,LT50 4444,K2 5555,IA 6666,NA 1 st Column number may repeat anytime but output that i need is sort and uniq ...

Validating content of the attributes to not be the same

Hey everybody, I am trying to write a unit testing for a User model in Ruby on Rails. I am using authlogic and need to check that the first_name and last_name of the user model attributes are not the same when the user is registering. This is my user model: class User < ActiveRecord::Base acts_as_authentic do |c| c.login_field= ...

How-to organize integration tests and unit tests

Is it ok to have integration tests and unit tests in one assembly (project) ? Or rather have them separate ? ...

What are the settings in Create New Test Wizard of VS2010?

Please explain the meaning of the marked red section in the screenshot below. All helps are very much appreciated! ...

skip maven tests console output, but not all tests entirely

Hi, does anybody know how could I skip the console output generated by maven (surefire) tests? I want to execute the tests and see how many of them passed and failed but skip the console output of the execution of these tests. thank you! ...

Good literature on unit testing?

Where can I find good literature on unit testing? Book titles and links are welcome. ...

How to lay out my integration tests

I have a rather large set of integration tests developed in C#/NUnit. Currently it is one test fixture, one class. In [TestFixtureSetUp] I create a database from a script and populate it with test data, also from a script. My tests do not modify data, so they can run in any order or in parallel. My problem is that I have too many tests...

SingleLaunchActivityTestCase cannot launch activity on test

Hi all, I'm new in android testing. All I've used in the testing is only the ActivityInstrumentationTestCase2 (AITC2) which is explained in the Hello, Testing tutorial. I've made a test class using AITC2 and it runs well. But once I changed the base test class to SingleLaunchActivityTestCase (SLATC) I got RuntimeException specifying "U...

Why would an assert on a unit test with HostType("Moles") pass when run individually, but fail when run with a group of tests?

I recently got aboard the Pex & Moles bandwagon in order to test some logic with many elements that are static, non-virtual, sealed, etc. Recently, I've begun to see behavior I can't explain from a few of the tests. A couple of the methods for an interface I stubbed out return void, so I set the stubs to delegates that update boolean v...