unit-testing

Checking the identity of a new table for database unit tests

I have a suite of database unit tests that were created. In order to replicate all of the tests on any machine I deploy out to there are scripts to drop the database and recreate it. The test will work for all of the unit tests except for the first test. The reason the first test fails is that I am executing the "dbcc checkident" comma...

Unit Testing abstract classes and or interfaces

I'm trying to start using Unit Testing on my current project in Visual Studio 2010. My class structure, however, contains a number of interface and abstract class inheritance relationships. If two classes are derived from the same abstract class, or interface I'd like to be able to share the testing code between them. I'm not sure how t...

Possible to use unittest-like fixtures in py.test?

I really like py.test, but I am having lots of difficulty understanding how funcargs work. Is it possible to use a command line argument or an extension to enable the use of something that performs a similar role to unittest.TestCase.setUp and unittest.TestCase.tearDown? ...

How to print test details in Mstest command line

I'm running 100 tests using data driven concept. My data source is a xml. When I run my test project using Mstest.exe I don't get any details except "Loading .vsmdi...staring execution". And as my test cases takes 5 hrs to complete, till that time I need to wait whether its passed or fail. I have added some console.writeline in my test...

Entity Framework testing with IRepository - problem with lazy loading

I am refactoring an MVC project to make it testable. Currently the Controller uses the Entity Framework's context objects directly to ask for the required data. I started abstract this and it just doesn't work. Eventually I have an IService and an IRepository abstraction, but to describe the problem let's just look at the IRepository. Ma...

web site testcase sample format

hi , For web development , Can u send some sample test case xls report , Or is there any good open source plz refer , Is there any free automated testing for php web development , Thanks ...

Ways to improve this code

I am trying to write some test code for my java application using Scalatest. I figured, since Scala has so much more readable syntax it would result with more readable test code. So far, this is what I managed: package com.xyz import org.scalatest.FlatSpec import org.scalatest.matchers.ShouldMatchers import com.xyz.SecurityService ...

Any way to write a unit test framework in Scheme without either apply or macros?

I am wondering if there is a way to write a test framework (a very small one, just as an interesting example of Scheme code) that uses neither APPLY nor macros. I suppose not, since any test framework would need to at least get a list of arguments and apply procedures to them. ...

Visual Studio 2008: Unit-Test methods in generic classes are not detected properly

Hi all I have a bunch of repository classes which I want to unit-test using Visual Studio 2008. They implement the following interface: public interface IRepository<TEntity> where TEntity : IEntity { /// <summary> /// Get entity by ID /// </summary> /// <param name="id">The ID</param> /// <returns></returns> TEn...

Is it possible to run a grails single grails unit test class from NetBeans?

I've been unable to find a way to run a single grails test class (which extend GrailsUnitTestClass) from the command line. (I currently have a question out with a decent bounty, if you are interested.) I'd be even happier if I could do the same from within NetBeans, but I haven't been able to do that either. Any ideas? ...

MSTest.exe not able to load ADO.NET Data providers?

I'm having a really strange issue with MSTest. I have a test that is more of an integration test, and needs to connect to the database. It does this by getting the ADO.NET data provider factory through a call to: var factory = DbProviderFactories.GetFactory("Oracle.DataAccess.Client"); In my app.config file, I have: <system.data> ...

Are the tests that MsTest generates actual unit tests?

Visual Studio 2010 generated a bunch of unit tests for me which seems to be handy, but I question whether they are actual unit tests. For example, it generated a test it called SaveTest which executes the following code: User user = new User(); //I have to create a user user.Save(); //This saves the user to the database. //Assertions ...

How to test protected method with Spring dependency

I have the following interface and implementation classes:- public interface MyService { void method1(); } public interface MyServiceImpl implements MyService { public void method1() { // ... } /*protected*/ void method2() { // ... } } MyServiceImpl has some Spring wirings, in another word, both m...

BDD with Cucumber and rspec - when is this redundant?

A Rails/tool specific version of: How deep are your unit tests? Right now, I currently write: Cucumber features (integration tests) - these test against the HTML/JS that is returned by our app, but sometimes also tests other things, like calls to third-party services. RSpec controller tests (functional tests), originally only if the c...

Outputing text in UnitTests

When i run my unit tests, i would like to print out and read how long it takes to run a function. I tried using Console.WriteLine() Trace.WriteLine() but that didn't work. Anyone know the proper method i should be using? I have the following unit test [TestMethod()] public void ProductSerializationTest() { Stopwatch swSerializatio...

Do MSTest deployment items only work when present in the project test settings file?

I can't seem to grasp how MSTest deployment items are supposed to be configured. I have been able to get them working properly by modifying the project's test settings file, but this is less then ideal -- the deployment item configuration is separated from individual tests, and the file paths appear to be stored as absolute paths unless ...

How to turn off recording for an EasyMock object?

I am testing a servlet's doPost() method using EasyMock objects for the HttpServletRequest and HttpServletResponse arguments. Within the doPost() method I'm testing the request and response objects are used as arguments to a static method class for another class, and I want to disregard (i.e. not record as expected) any calls made on th...

How to re-run the same test with same data in MbUnit

Say, I have the following test: [Test] public void MyTest( [RandomNumbers( Count=100, Minimum=0, Maximum=1000 )] int number ) { ... } And at some point, during my regular build process, it has failed. I got an e-mail notification and set off to investigate. Now, when I open the test in Visual Studio and click ...

MbUnit's row attribute in Visual Studio 2010?

While reading an Asp.Net MVC code sample that used MbUnit as its testing framework, I saw that it was possible to run a single test against multiple input possibilities by using a Row attribute, like so: [Test] [Row("test@test_test.com")] [Row("sdfdf dsfsdf")] [Row("[email protected]")] public void Invalid_Emails_Should_Return_False(string inv...

Attempt to stub android Activity class using PowerMockito throws RuntimeException "Stub!"

I found this example where they used PowerMock and EasyMock to stub/mock the Menu and MenuItem classes for android. I have been trying to do something similar with PowerMock and Mockito with the Activity class. I understand that a lot of the methods are final and that in the Android.jar they all just throw RuntimeException("Stub!"). I...