EzDevInfo.com

testing interview questions

Top testing frequently asked interview questions

Writing unit tests in Python: How do I start? [closed]

I completed my first proper project in Python and now my task is to write tests for it.

Since this is the first time I did a project, this is the first time I would be writing tests for it.

The question is, how do I start? I have absolutely no idea. Can anyone point me to some documentation/ tutorial/ link/ book that I can use to start with writing tests (and I guess unit testing in particular)

Any advice will be welcomed on this topic.


Source: (StackOverflow)

Getting Started with RSpec - Looking for tutorials [closed]

I am looking to get started building a project and want to use RSpec from day one. My Ruby background is limited; however, I do have a good understanding of MVC and the structure within Ruby.

In doing some research for books and tutorials, I've found no currently published books, and have found no tutorials that give a good "hello world" type write up. And the documentation on the RSpec site is sparse to say the least. Do any of you have links that you'd like to share of good tutorials of getting started with roR and RSpec?


Source: (StackOverflow)

Advertisements

How to unit test abstract classes: extend with stubs?

I was wondering how to unit test abstract classes, and classes that extend abstract classes.

Should I test the abstract class by extending it, stubbing out the abstract methods, and then test all the concrete methods? Then only test the methods I override, and test the abstract methods in the unit tests for objects that extend my abstract class?

Should I have an abstract test case that can be used to test the methods of the abstract class, and extend this class in my test case for objects that extend the abstract class?

Note that my abstract class has some concrete methods.


Source: (StackOverflow)

How do I simulate a low bandwidth, high latency environment?

I need to simulate a low bandwidth, high latency connection to a server in order to emulate the conditions of a VPN at a remote site. The bandwidth and latency should be tweakable so I can discover the best combination in order to run our software package.


Source: (StackOverflow)

Disadvantages of Test Driven Development? [closed]

What do I lose by adopting test driven design?

List only negatives; do not list benefits written in a negative form.


Source: (StackOverflow)

Unit tests vs Functional tests

What is the difference between unit tests and functional tests? Can a unit test also test a function?


Source: (StackOverflow)

Practicing BDD with python [closed]

Which are the most advanced frameworks and tools there are available for python for practicing Behavior Driven Development? Especially finding similar tools as rspec and mocha for ruby would be great.


Source: (StackOverflow)

What's the difference between a mock & stub?

I've read various articles about mocking vs stubing in testing, including Martin Fowler's Mocks Aren't Stubs, but still don't understand the difference. Everything I've found is too difficult or abstract.


Source: (StackOverflow)

How do you run a single test/spec file in RSpec?

I want to be able to run a single spec file's tests — for the one file I'm editing, for example. rake spec executes all the specs. My project is not a Rails project, so rake spec:doc doesn't work.

Don't know if this matters, but here is my directory structure.

./Rakefile
./lib
./lib/cushion.rb
./lib/cushion
./lib/cushion/doc.rb
./lib/cushion/db.rb
./spec
./spec/spec.opts
./spec/spec_helper.rb
./spec/db_spec.rb

Source: (StackOverflow)

Should I test private methods or only public ones? [closed]

I have read this post about how to test private methods. I usually do not test them, because I always thought it's faster to test only public methods that will be called from outside the object. Do you test private methods? Should I always test them?


Source: (StackOverflow)

Testing HTML email rendering [closed]

Are there any good tools to easily test how HTML email will look across different email clients? I prefer something with instant feed back rather than a submit and wait service like http://litmusapp.com Or at the very least a way to test the Outlook 2007/MS Word rendering?

I found this related question but it doesn't specifically address testing. What guidelines for HTML email design are there?


Source: (StackOverflow)

Setup RSpec to test a gem (not Rails)

It is pretty easy with the added generator of rspec-rails to setup RSpec for testing a Rails application. But how about adding RSpec for testing a gem in development? I am not using jeweler or such tools. I just used Bundler (bundle gem my_gem) to setup the structure for the new gem and edit the *.gemspec manually. I also added s.add_development_dependency "rspec", ">= 2.0.0" to gemspec and did a bundle install.

Is there some nice tutorial what to do next to get RSpec working?


Source: (StackOverflow)

How to emulate GPS location in the Android Emulator?

I want to get longitude and latitude in Android emulator for testing.

Can any one guide me how to achieve this?

How do I set the location of the emulator to a test position?


Source: (StackOverflow)

Rspec: "array.should == another_array" but without concern for order

I often want to compare arrays and make sure that they contain the same elements, in any order. Is there a concise way to do this in RSpec?

Here are methods that aren't acceptable:

#to_set

For example:

array.to_set.should == another_array.to_set

This fails when the arrays contain duplicate items.

#sort

For example:

array.sort.should == another_array.sort

This fails when the arrays elements don't implement #<=>


Source: (StackOverflow)

When should I use Debug.Assert()?

I've been a professional software engineer for about a year now, having graduated with a CS degree. I've known about assertions for a while in C++ and C, but had no idea they existed in C# and .NET at all until recently.

Our production code contains no asserts whatsoever and my question is this...

Should I begin using Asserts in our production code? And if so, When is its use most appropriate? Would it make more sense to do

Debug.Assert(val != null);

or

if ( val == null )
    throw new exception();

Source: (StackOverflow)