functional-testing

Why are functional tests not enough? What do unit tests offer?

I just had a conversation with my lead developer who disagreed that unit tests are all that necessary or important. In his view, functional tests with a high enough code coverage should be enough since any inner refactorings (interface changes, etc.) will not lead to the tests being needed to be rewritten or looked over again. I tried e...

Functional test software/framework that covers Asp.Net Web Apps?

I recently began to use the NexusLight, a functional test automation framework. Are there more frameworks that does a similar job? Related question: http://stackoverflow.com/questions/91703/end-to-end-application-testing-from-a-users-standpoint ...

What is the right balance between unit vs. functional testing in a typical web application?

Unit tests are cheaper to write and maintain, but they don't cover all scenarios. What is the right balance between them? ...

Do you need to do unit and integration testing if you already do functional testing?

People at my company see unit testing as a lot of extra work, that offers fewer benefits than existing functional tests. Are unit and integration tests worth it? Note a large existing codebase that wasnt designed with testing in mind. ...

What kinds of unit tests pay off the most in business value?

My question assumes that folks already believe that unit tests of some sort are worthwhile and actually write them on their current projects. Let's also assume that unit tests for some parts of the code are not worth writing because they're testing trivial features. Examples are getters/setters, and/or things that a compiler/interpreter ...

Testing whole programs. best practices

I am currently developing a library and a set of programs using this library, in python. Unit testing dictates that I import each module from the library, and test the classes and routines within. No problem with that. I have a separate test directory containing all my tests and importing the library modules, which I run while developing...

WatiN test data reset/clean up

I'm wondering how people are currently resetting their data / cleaning up test remnants for their WatiN/Wartir tests? For example, lets say there's a test to add a user into the system and the username has to be unique. Obviously the first run without any users should work fine, but the second run will fail without manual intervention. ...

Ruby on Rails functional testing with the RESTful Authentication plugin

I started writing functional tests for my rails app today. I use the RESTful authentication plugin. I ran into a couple confusing things I hope someone can clarify for me. 1) I wrote a quick login function because most of the functions in my rails app require authentication. def login_as(user) @request.session[:user_id] = user ? u...

Confusion: leave out functional tests that cover same ground as unit tests?

I'm struggling to figure out what should be excluded from functional tests (in my case, using Rails, but I guess the framework's probably irrelevant). I'm under the impression that I shouldn't bother using functional tests for things that will be caught in unit tests -- such as checking that a field can't have too many characters, or th...

How to reduce the time spent on testing?

I just looked back through the project that nearly finished recently and found a very serious problem. I spent most of bank time on testing the code, reproducing the different situations "may" cause code errors. Do you have any idea or experience to share on how to reduce the time spent on testing, so that makes the development much mor...

How to Automate Testing of Medium Trust Code

I would like to write automated tests that run in medium trust and fail if they require full trust. I am writing a library where some functionality is only available in full trust scenarios and I want to verify that the code I wish to run in medium trust will work fine. If also want to know that if I change a class that requires full ...

How to manage test fixtures for end-to-end testing?

Having just set up a test framework for a new web application, I realized I missed one of the big questions: "How do I make tests independent from each other?" Years ago I have set up some complicated Ant scripting to do full cycles of deleting all database tables, creating the schema again, adding test data, starting the application, r...

Integrating Automated Web Testing Into Build Process

I'm looking for suggestions to improve the process of automating functional testing of a website. Here's what I've tried in the past. I used to have a test project using WATIN. You effectively write what look like "unit tests" and use WATIN to automate a browser to click around your site etc. Of course, you need a site to be running. S...

DRYer tests with associations in factory_girl

Can anyone suggest a better way to make a factory use a pre-built model instance for its association? For example, so that it would be possible below to define a child of the Message factory so that a call to Factory(:my_message) could substitute for Factory(:message,:sender=>@me) ? Sometimes the setup hash is more involved than in this...

Authlogic edit_password_reset_url in Functional / Integration Tests

I am trying to implement some tests to validate the behavior for Authlogic password resets as explained in http://www.binarylogic.com/2008/11/16/tutorial-reset-passwords-with-authlogic/ I am using Authlogic, Shoulda, Webrat and Factory Girl and here's my test: require 'test_helper' class PasswordResetTest < ActionController::Integrati...

How to automate functional/integration tests and database rollbacks

Hello! In contrast to my previous question, i'll try to give my requirements. I am trying to find some framework/methodology/"thing" that would fit the following: Ability to write an automated test, preferably written in Visual Studio, using C#. Test should drive a web browser and interact with SUT just like an user would. Test shoul...

Assert difference of number of children in relationship in Ruby on Rails

My controller is able to create a child book_loan. I am trying to test this behavior in a functional test but am having a hard time using the assert_difference method. I've tried a number of ways of passing the count of book_loans to assert_difference with no luck. test "should create loan" do @request.env['HTTP_REFERER'] = 'http:...

How to assert action returns correct text?

Is there a standard or best-practices way to test that an action in rails is returning the correct text? For example, I have a simple action that is used for doing ajax validation that does the following: def get_object_id if params[:id].blank? return render(:text => -1, :layout => false) end my_object = MyObject.find_by_id(...

Rails Functional Test of Arbitrary or Custom URLs

I have a RESTful resource in my Rails app called "Photo". I'm using Paperclip to serve different "styles" of my photos (for thumbnails and the like), and I'm using a custom route to RESTfully access those styles: map.connect "photos/:id/style/*style", :controller => "photos", :action => "show" That's working fine, but I want to write ...

(Rails) Assert_Select's Annoying Warnings

Does anyone know how to make assert_select not output all those nasty html warnings during a rake test? You know, like this stuff: .ignoring attempt to close body with div opened at byte 1036, line 5 closed at byte 5342, line 42 attributes at open: {"class"=>"inner02"} text around open: "</script>\r\t</head>\r\t<body class=\"inner02" te...