testing

Rails 2.3.2 unit test passes when run with normal ruby, fails when run with rake test:units

Hi folks, When creating a record in a unit test, I'm getting an 'ActiveRecord::RecordInvalid' when it's run with rake test:units. I don't get this error when I run the unit test manually with ruby ('ruby unit/blah_test.rb'). I've narrowed the issue down to a validation that exists in my model. It is an inclusion validation which is a...

C#: Using Conditional-attribute for tests

Are there any good way to use the Conditional-attribute in the context of testing? My thoughts were that if you can do this: [Conditional("Debug")] public void DebugMethod() { //... } Maybe you could have some use for: (?) [Conditional("Test")] public void TestableMethod() { //... } ...

How to test a program processing large amounts of data stored in an unpredictable format

What I have to do I'm trying to manipulate some rather large amounts of data stored in Excel files (one of the workbooks has as much as 150 spreadsheets). The result of these manipulations may yield approximately 800.000 rows in a database table. The problem Data stored in the spreadsheets has unpredictable format. The company that ge...

Testing grails taglib

Grails 1.1. My custom tag: class MyTagLib { static namespace 'ct' def textField = {attrs -> def bean = attrs.remove('bean') def field = attrs.remove('field') attrs.name = field out << render(template:"/templates/textField", model:[ required: !bean.constraints[field].nullable, display : bean["${bean.tr...

How can one check to see if a remote file exists using PHP?

The best I could find, an if fclose fopen type thing, makes the page load really slowly. Basically what I'm trying to do is the following: I have a list of websites, and I want to display their favicons next to them. However, if a site doesn't have one, I'd like to replace it with another image rather than display a broken image. Any ...

Is it worth testing the same version of IE on different versions of Windows?

I'm putting together some virtual machines to test different browsers and I'm wondering if there is any compelling reason to be able to test the same version of IE on different versions of Windows. (i.e. IE8 on XP and Vista) I'm mostly talking about testing CSS to make sure it "looks right" across browsers, but if there were major differ...

How to mock for testing in Haskell?

Suppose I am defining a Haskell function f (either pure or an action) and somewhere within f I call function g. For example: f = ... g someParms ... How do I replace function g with a mock version for unit testing? If I were working in Java, g would be a method on class SomeServiceImpl that implements interface SomeService. ...

iPhone OS Testing Best Practices

Not so long ago iPhone development was quite simple, only a few OS versions and even less devices. Now however, there are 2 major OS versions and 5 different devices to consider. As a company about to release several applications testing has been become more and more of an issue. What are the best ways to test all combinations, do I ...

Test cases for validating product license...?

Hi , I am having a product and its license is gets validated from server. Can any body tell me how many test scenarios i can prepare on this to validate license...? Your help is appreciated...? Thanks, sivaram. ...

Adding rspec test for library module doesn't seem to pickup Expectations and Matchers

I'm adding more rspec testing to my app and would like to test a ScoringMethods module, which is in /lib/scoring_methods.rb. So I added a /spec/lib directory and added scoring_methods_spec.rb there. I required spec_helper and set up the describe block as so: require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') descri...

Using doctest "result parser" within unit-tests in Python?

I recently faced a problem about combining unit tests and doctests in Python. I worked around this problem in other way, but I still have question about it. Python's doctest module parses docstrings in a module and run commands following ">>> " at the beginning of each line and compare the output of it and those in docstrings. I wonder...

How to test an API ?

In an interview, whether for developer positions or white-box qa positions, you are ofter asked to: create test cases for a piece of code / API categorize each test i.e. functional, stress, load, performance, security etc. prioritize (assuming low / medium / high priorities) I want to gather up ideas for such test cases. We can assum...

How to do black box testing?

Opposed to white-box / API testing, which is covered here There are many interviews, both for developers and qa, where you are asked to test smth out. A classic is to test the save dialog from notepad. Here is a list of tests I can come up with, categorized and prioritized: [functional, high] - dialog performs its use cases - comes ...

Why do test:units and test:functionals insist on running in development environment?

I'm trying to test some environment-specific settings (middleware to be specific, but it doesn't seem to matter), but I'm having trouble getting the tests to run in the correct environment. The symptoms: If I run ruby test/unit/my_test.rb, all is fine because the first thing it does is require test/test_helper.rb, which sets the enviro...

Script for Testing with Input files and Output Solutions

I have a set of *.in files and a set of *.soln files with matching files names. I would like to run my program with the *.in file as input and compare the output to the ones found in the *.soln files. What would be the best way to go about this? I can think of 3 options. Write some driver in Java to list files in the folder, run the pr...

Database consistency checking framework

I'm looking for a framework to utilize to integrate a number of database consistency checking rules into our system. This should basically be a automated test case runner for our database checks. Requirements: Easy to write new rules or checks Easy to run all rules, grouping of rule subsets would be a bonus Accurate and simple reporti...

XCode Test Automation For IPhone

Hi there, I would like to have my iphone test app to be tested automatically in an IPhone. The following are the steps I would like to have: 1. compile, link and code sign the iphone app (Xcodebuild) 2. upload the newly built app to iphone 3. run the uploaded app in iphone automatically 4. collect the result from the gdb console...

Writing tests for Django's admin actions

I'm using Django 1.1 beta and hoping to use admin actions. I have to write unit tests for those, but I don't get it how to write tests for them. For normal view handler functions, I can use Django's TestClient to simulate http request/response, but how should it be done with admin actions? ...

Context parameters in VSTS Web Tests

Hi, Can anyone help me with the following question? How can a context parameter be used in a parameterized request? I have created an extraction rule that populates a context parameter (say Param1). I also have parameterized a subsequesnt request and want to use this context parameter in that request. Eg. "{DetailArray:strUserID:xyz,int...

hudson build successful with unit test failures

this is related to another question I asked about trying to fail hudson on a single unit test failure. when I run maven on my build standalone, it fails due to unit test errors (running mvn clean install). but, when I run it in hudson, it says there was an error due to test failure, yet the build still is successful (and marked as unstab...