I want to cleanup the database after every test case without rolling back the transaction. I have tried DBUnit's DatabaseOperation.DELETE_ALL, but it does not work if a deletion violates a foreign key constraint. I know that I can disable foreign key checks, but that would also disable the checks for the tests (which I want to prevent).
...
I'm working on a variation of this stack overflow answer that provides reliable cleanup of tests. How do you write unit tests for NUnit addins?
Examining how NUnit self tests, I have determined:
You can write tests, that pass, that verify correct behavior of NUnit for failing tests.
You write unit tests against test fixtures in a s...
Hi,
I'm trying to unit test a service method that takes as parameters a date and the params LinkedHashMap from the controller. The setup is as follows:
def save = {CustomCommandObject erc ->
...
if (erc.conditionProperty != null) {
def result = myService.ServiceMethod(someDate, params)
...
}
....
redirect(co...
I'm considering running unit tests for my Visual Studio 2010 projects on our build server at build time. The problem is that when I'm working locally, I want to test against DEV, when building for QA, I want the tests to run against QA, when building/promoting for UAT/PROD... you get the picture.
I think VS 2010 might have support for...
All,
Recently I developed a code that supposedly is a thread-safe class. Now the reason I have said 'supposedly' is because even after using the sync'ed blocks, immutable data structures and concurrent classes, I was not able to test the code for some cases because of the thread scheduling environment of JVM. i.e. I only had test cases ...
My aysnc test calls a controller that depends on some values to be present in session, also my controller has [Authorize] attribute on it. So when i run the test, it kicks me to the login page.
What are the best usage patterns in scenarios like this?
Thanks,
-Binu
...
I'm using a third-party library which needs urlfetch from google.appengine.api. It is imported into the executing tests using this line:
from google.appengine.api import urlfetch
The google_appengine directory is on my PYTHONPATH, and if I execute my unit tests directly from Eclipse, I see no errors. However, if I use nosetests, I se...
I created a Visual C++ test project which contains printf statements. Unfortunately, I can't find a method to view the output of this. It isn't included in the output window. Any suggestions?
...
How do you execute nosetest from pycharm to run all unit tests?
I know that pycharm supports python's unittest and py.test and that they will properly support nosetests in pycharm 1.1 but I was wondering if there was a work around.
...
I googled and found the below helpful references. Currently I want to run all from the command-line (for easy of execution & quickness) in cases:
A specific test (ie. a test written by a method marked [TestMethod()])
All tests in a class
All impacted tests of the current TFS pending change of mine.
All tests
All tests except the ones m...
Does anyone know of any free (critical point I'm afraid) code coverage tools for Visual Studio 2010 Professional edition. I know there are commercial offerings such as NCover and DotCover, but due to budget considerations these can't be considered. For similar reasons, upgrading to versions of VS that come with code coverage built in al...
When I run 'rake test' I get this error:
1) Error:
test_the_truth(DetailsThankYouTest):
ActiveRecord::StatementInvalid: SQLite3::SQLException: no such table: details: DELETE FROM "details" WHERE 1=1
The application runs fine but I cannot write any simple test. How can I disable Rails test to use the table?
...
having
public ActionResult Create(CategoryViewModel viewModel)
{
if (!ModelState.IsValid)
{
return View(viewModel);
}
Category category = new Category();
category.Parent = daoTemplate.FindByID<Category>(viewModel.ParentId);
category.CopyFrom(viewModel);
daoTemplate....
Recently I saw an application recording important data on disk without forcing fsync.
I used to write various applications without testing. I lost a few blog posts by the lack of a WHERE clause in the UPDATE.
Are there any statistics about the data loss by programmers mistakes ?
What are the issues that could cause loss of data you s...
I'm moving my java project from Netbeans to Eclipse. I'm new to Eclipse and I can't figure out how to create or run unit tests. In Netbeans I could just right click a source file to generate test stubs. And to run tests I just chose a "Run Tests" menu option.
How do I do this in Eclipse?
...
Question: I am testing functions in a package that I am developing and would like to know if you can suggest some general guidelines for how to do this. The functions include a large range of statistical modeling, transformations, subsetting, and plotting. Is there a 'standard' or some sufficient test?
An Example: the test that prompted...
Hi Guys,
Came across the following MS Unit Test:
[TestMethod]
public void PersonRepository_AddressCountForSinglePerson_IsNotEqualToZero()
{
// Arrange.
Person person;
// Act.
person = personRepository.FindSingle(1);
// Assert.
Assert.AreNotEqual<int>(person.Addresses.Count, 0);
}
I have never seen the use of gene...
I want to verify that 2 datatables contains same data (for unit testing), but unfortunately, Assert.AreEqual does not work, it seems that each datatable contains unique metadata that makes their references not equal.
How can I do this?
...
Hi,
does anybody know a possibility to show the Unit-Test results of a grails project in the "Test Result"-Window of the netbeans IDE? The test results are saved in the project folder as JUnit XML Files.
...
I have a line in my test that currently looks like:
Mockito.verify(mockMyObject).myMethod(Mockito.contains("apple"));
I would like to modify it to check if the parameter contains both "apple" and "banana". How would I go about this?
...