testing

What is the difference between mock and mock_model in RSpec

I've recently came across different tutorials, where people use both mock and mock_model functions. In RSpec tutorial for controllers they use the mock_model function, but right in the documentation of RSpec, there is only mock function, but no mock_model I tried to run some tests myself, and I didn't find any real difference, since ev...

Profiling a cucumber test (ruby/rails)

Profiler/profiling related issue with Cucumber testing. One of our cucumber tests run fairly slow. In stead of guessing on where our application is spending time, I'd like to know programatically. How do I trigger a cucumber test with a profiler??? What did not work: $ URL=/projects/by/114951412 #URL to slow rails page $ script/...

testing objects using DAO

Continuing another but similar question about testing (see here). I'll use a similare example (pseudocode) class LinkDisplayer method constructor(LinkStorage) method displayLatestLinksByCategory(number_of_them) class LinkStorage method saveLink(Link) method retrieveLatestLinksByCategory(category, number_of_them) class ...

When exactly mock objects are to be used during unit testing rathern than using stubs?

In my experience anything that can be achieved using mock objects, could be achieved using stubs. Are there any scenarios, where stubs cannot be used and mock objects serves well. ...

Is unit testing a bad idea during beta/prototyping?

A new project we began introduced a lot of new technologies we weren't so familiar with, and an architecture that we don't have a lot of practice in. In other words, the interfaces and interactions between service classes etc of what we're building are fairly volatile, even more so due to internal and customer feedback. Though I've alway...

Session variables with Cucumber Stories

I am working on some Cucumber stories for a 'sign up' application which has a number of steps. Rather then writing a Huuuuuuuge story to cover all the steps at once, which would be bad, I'd rather work through each action in the controller like a regular user. My problem here is that I am storing the account ID which is created in the f...

What methods do you use to test for scalability in web applications?

Our testing system is pretty rudimentary; fire up a browser, see if it works. Recently we ran into problems, found by our client, with our application where the number of users created a slow-down in the application. The application is basically a huge Word document with people editing their own versions all at the same time. Part of the...

Software task/project planning books?

Hiya, I'm looking for a book that tells you how to split up a software (or anything; doesn't have to be software-specific) task or project into discrete chunks, and helps elucidate all the issues and nuances that aren't apparent when you just start programming. Should I get a book on use cases? If so, what? What I'm looking for is a b...

Has anyone used Steve Sanderson’s MvcIntegrationTestFramework?

I was looking into additional ways to test ASP.NET MVC applications and ran into Steve Sanderson’s MvcIntegrationTestFramework. The approach looks rather promising but I was wondering if anyone had any actual experience to share. ...

Does software testing work the same way across different languages?

If you want to learn about software testing, are the tools/technologies/skills the same across languages or do you need to learn different testing tools for each language? As you can probably tell I don't know a single thing about software testing. But I would like to learn about it. If anyone could recommend a good book that applie...

Disable testing in cmake

The tests of a project that I try to build fail to build (missing libraries). The tests themselves are not important, but prevents me from building and installing the essential files. So I want to do this as a quick-fix. How do I do to turn of the build of the tests in a cmake project? Should I edit the CMakeLists.txt file in the root o...

How can I use Perl's Test::Deep::cmp_deeply without increasing the test count?

It looks like Test::Deep was inspired by is_deeply. My question is how do I make cmp_deeply part of a test instead of a test on its own? Because my list of tests only states 8, but everytime I use cmp_deeply, it counts as a test, making my actual number of tests 11 (because I call cmp_deeply 3 times) when I only have 8 functions. I do n...

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...

Alternatives to userfly.com

During my master thesis I need to study how my users interact with my webapp. There are alternatives to userfly.com? I want just to know how I can do some usability testing without much hassle. Requests: must work under https cheap unobtrusive, if possible ...

DOCTEST==argv[0] as a convention?

In a bit of Python I'm writing (a command line and filter testing tool: claft) I wanted a simple way to invoke the built-in test suite (doctest) and I decided on the following: if 'DOCTEST' in os.environ and os.environ['DOCTEST']==sys.argv[0]: _runDocTests() sys.exit() Thus if the DOCTEST variable is set for some other program...

Is it possibile to use TDD with image processing algorithms?

Recently, I have worked in a project were TDD (Test Driven Development) was used. The project was a web application developed in Java and, although unit-testing web applications may not be trivial, it was possible using mocking (we have used the Mockito framework). Now I will start a project where I will use C++ to work with image proce...

How to test association extension logic in rails with minimal DB overhead.

I am a fan of using mocks and stubs everywhere I can to keep my specs running quickly. I'm kind of stumped as to how I might do this to test the find_special method in the following: has_many :foos do def find_special if proxy_owner.baz ... find stuff else ... find other stuff end end end ...

How do you get a customer to accept better practices and cross-platform debugging during development?

Our customer has a "No unnecessary code" policy. And the people they have assigned to my project thinks this includes: Dianostic code Cross platform compatibility code "Software" faultcodes. ("Software doesn't break therefore these are unneeded.") Class methods that aren't used for THIS application ("Customer Code Review Issue : Pleas...

Question regarding setting up Moq behaviour using Setup().

I am trying out moq and I have a question regarding to the Setup() method. I have the following interface and class: public interface IMyInterface { void Print(string name); } public class MyClass { private IMyInterface my; public MyClass(IMyInterface my) { this.my = my; } public void Print() { ...

How to test custom django-admin commands

I created custom django-admin commands But, I don't know how to test it in standard django tests ...