unit-testing

run unit tests and coverage in certain python structure

Hi, I have some funny noob problem. I try to run unit tests from commandline: H:\PRO\pyEstimator>python src\test\python\test_power_estimator.py Traceback (most recent call last): File "src\test\python\test_power_estimator.py", line 2, in <module> import src.main.python.power_estimator as power ImportError: No module named src.ma...

one-to-many JPA annotations won't delete orphans

Hello good people. I 'm trying to build a user and a contact management project. i have a lot of classes so will limit it to what are in concern here. i have a userAccount, userProfile, and group here is the UserAccount Mapping @Id @GeneratedValue @Column(name="USER_ACCOUNT_ID") private Long ID; ...... @Column(name="EMAIL", length=10...

iphone unit tests setup problem

I'm going through the tutorial for setting up logic tests - http://developer.apple.com/iphone/library/documentation/Xcode/Conceptual/iphone%5Fdevelopment/135-Unit%5FTesting%5FApplications/unit%5Ftesting%5Fapplications.html When I attempt to build and run, I get this error : "exited abnormally with code 133 (it may have crashed)." My un...

Best .Net Framework based open source projects for learning different practices and patterns of unit testing

Are there any .net based open source project which uses unit testing techniques to its best? I am looking for an open source project where the complete code base is covered with unit tests which are well written and from which we can learn new techniques and practices of doing proper unit testing. ...

How to prove my stakeholder and manager my software works?

What do software engineers encounter after another stressfull release? Well, the first thing we encounter in our group are the bugs we have released out in the open. The biggest problem that we as software engineers encounter after a stressfull release is spaghetti-code, also called the big ball of mud. The time and money to chase ...

Ordering by created_at in unit tests with generated data in rails

I have a bit of code that basically displays the last x (variable, but let's say x is 20 here) updates made in a given table. In one of the unit tests for it, I have this snippet: EditedItem.push_to_queue(hiddennow) #create some new entries and save them 20.times{ EditedItem.push_to_queue(random_item) } Queue.get_entries.each{|entry| a...

How can I test a .class file was created?

I want to unit test my code which will have to create a .java file compile it and then the corresponding .class file should be created. How can I create the test to see if the ".class" file is created? I have added test already for its existence, now I'm trying to test the file is a valid class file. I tried try { Class.forNam...

Large unit test data

Recently I wrote a suite of unit tests that relied on a large set of test data. The set contained twelve elements and while this does not sound like a lot it was when used with the tests. Each element required several properties to be set with unique vales. The issue was using this method was that the factory method that created this s...

Problems unit testing setInterval function in Javascript

Hi all: I am having difficulties testing window.setInterval function in my Javascript file. Below is the scenario... basically I have a setInterval function in a function which I want to test: var dummy = false; // global variable not set anywhere else var INTERVAL_TIME = 20; // global variable not set anywhere else function myFunctio...

Unit Testing CodeIgniter with Simpletest - very few tests

Hello all! On our development team, we decided to give Unit Testing a try. We use Simpletest. However, it's been a tough road. After a week, I only have created 1 unit test that tests a certain helper file. That's it. The rest (controllers, models, views, libraries) don't have unit tests yet. And I plan to not test a majority of them. Vi...

Assert that two java beans are equivalent

This question is close, but still not what I want. I'd like to assert in a generic way that two bean objects are equivalent. In case they are not, I'd like a detailed error message explaining the difference instead of a boolean "equal" or "not equal". ...

Applying one test to two separate classes

I have two different classes that share a common interface. Although the functionality is the same they work very differently internally. So naturally I want to test them both. The best example I can come up with; I serialize something to a file, one class serialize it to plaintext, the other to xml. The data (should) look th...

"plist" doesn't load from iPhone unit-test class

I'm trying to unit-test code for loading and querying data from plist file. I'm loading data with code: NSString *path = [[NSBundle mainBundle] pathForResource:@"availableshops" ofType:@"plist"]; NSArray *arrayOfShops = [[NSArray alloc] initWithContentsOfFile:path]; When testing app in simulator and on the device everything work. BUT ...

TDD vs. Unit testing

My company is fairly new to unit testing our code. I've been reading about TDD and unit testing for some time and am convinced of their value. I've attempted to convince our team that TDD is worth the effort of learning and changing our mindsets on how we program but it is a struggle. Which brings me to my question(s). There are many...

Embedded jetty ServletTester serving single static file

I'm unit testing with jetty and I want to serve not only my servlet under test but a static page as well. The static page is needed by my application. I'm initializing jetty like this tester = new ServletTester(); tester.setContextPath("/context"); tester.addServlet(MyServlet.class, "/servlet/*"); tester.start(); What I need now, is s...

Faking web requests in Rails test without Fakeweb

I'm using the Handsoap gem with Httpclient gem as the driver in a Rails app. How can I prevent network calls from Handsaop/Httpclient gems in test cases? FakeWeb doesn't support Httpclient. ...

Best practice approach for automated testing

Hi All, This is a very strange request for advice for which I truly feel there is no real answer. In my project I have archiving routines on various objects that have been consumed for logical calculations, I archive these items for the sake of audit trail and to check up on calculation errors or prove correctiveness at a later stage. I...

Testrun preprocessor statement

Is there a way to set a constant depending on whether unit tests are run? The problem with the unit test framework is de way it deals with dependencies; it will copy files but it does not seem to respect the directory structure. As a solution, I'm checking whether the DEBUG constant is set when looking for files to load but this raises p...

Unit testing database-dependent Window services

We have a set of services in .NET 3.5\C# and WCF. The NUnit tests need the services to be running and listening for requests. The services need an updated SQL database to be ready for connection. Currently the [SetUp] section of the unit test does two tasks: Execute the latest SQL scripts to build the database. Utilize a System.Diagn...

scala specs don't exit when testing actors

I'm trying to test some actors using scala specs. I run the test in IDEA or Maven (as junit) and it does not exit. Looking at the code, my test finished, but some internal threads (scheduler) are hanging around. How can I make the test finish? ...