Questions tagged [stub]

A replacement implementation for objects, methods, or functions in order to remove external dependencies, or the object at the client end of an RPC or RMI invocation.

A replacement implementation for object, method, or function. The typical types of stubs are:

  • Testing stubs that remove external dependencies. They are typically used during unit and component testing. If you're trying to write a unit test and need to replace a simple call to a database, external libraries (e.g., file I/O) or other system API, stubbing might be perfectly suited for your needs.
  • RPC (CORBA, RMI, web service) stubs forward the call to remote service where it is handled; the answer, if any, is returned to the calling side. They implement the same interface that is implemented by the servicing object on remote side (may also implement additional interfaces).
  • Dummy stubs are empty placeholders for objects, methods or functions that are supposed to be completed later. They allow the current code to compile so that other, already finished parts could be tested. Such stubs are used when implementing a very large libraries following some already specified API.

A mock is somewhat similar to the testing stub but is not considered stub as it is a special purpose object capable of registering that has been called on it. It does not take other actions (a generally unfavoured partial mock does forwards execution of some methods to underlying object).

1108 questions
0
votes
3 answers

Java RMI, cant find stub class , java.rmi.ServerException: RemoteException occurred in server thread;

I am trying to run my rmi program. However it cant seem to find my stub class. I do the command 'start rmiregistry' which starts successfully. then after doing : java -classpath . -Djava.security.policy=AllSecurity.policy RMIAuctionManagerImpl I…
ukbaz
  • 519
  • 2
  • 14
  • 30
0
votes
1 answer

Writing a chainable dsl for stubs

In some tests I'm writing I need to create a lot of stubs that are pretty similar. I'm using Mocha. user.stubs(:hq?).returns(false) user.stubs(:has_role?).with("admin").returns(true) And so on. It's a combinatorial thing that's very repetitive and…
Hopwise
  • 293
  • 2
  • 11
0
votes
1 answer

Can I execute my unit test methods with stubs/shims commands in VS 2012 Professional?, those created in VS 2012 ultimate though

I created my unit test methods with stubs/shims in VS 2012 ultimate. Can I execute my test methods with stubs/shims commands in VS 2012 Professional?
Jaish Mathews
  • 766
  • 1
  • 9
  • 25
0
votes
1 answer

JDeveloper - how to generate stub class

I'm new in Java and JDeveloper. I have to maintain two applications- first is for the public part of a website, second is for administrative part of a website. Both projects use same database. I have added in a table contacts two new fields. In…
user1408669
  • 83
  • 1
  • 11
0
votes
1 answer

Stub associations

I have method and spec. class Event def self.renew_subscription(user) subscription = user.subscription result = subscription.renew user.pay(subscription.plan.price_in_cents) if result result end end let!(:user) { create…
ck3g
  • 5,829
  • 3
  • 32
  • 52
0
votes
1 answer

Stub Controller in Play 2.0

I am trying folow the example from Mock Objects in Play[2.0] but unfortunately I am not having success. I have a UsersController that uses a UserModel. trait UserModel extends ModelCompanion[User, ObjectId] { // ... } Next, the abstract…
Rafael Afonso
  • 595
  • 1
  • 10
  • 28
0
votes
1 answer

Stub, Should_Receive, and Before Blocks in RSpec Functional Tests

The code samples below show a refactor from the chapter on controller specs in The RSpec Book: require 'spec_helper' describe MessagesController do describe "POST create" do it "creates a new message" do message =…
whiny_nil
  • 83
  • 2
  • 7
0
votes
1 answer

Trying to pass method group as parameter

Using Microsoft fakes i have the following method signature in my stub object: public void GetAllOf1ExpressionOfFuncOfT0M0Int32Int32(FakesDelegates.Func>, int, int, IList> stub); which is the stub method for…
Ori Price
  • 3,593
  • 2
  • 22
  • 37
0
votes
0 answers

Test behavior in vs2012 unit test framework

Below is my test: [TestMethod] public void GetSubscribers() { stubSubscriptionMng.GetModelSubscribersInt32String = (mgr, i) => new List() { modelStub }; var dispatcher =…
Ori Price
  • 3,593
  • 2
  • 22
  • 37
0
votes
1 answer

when stub Time in rspec integration tests, any way to print actual time?

When running some long integration test sequences, we stub Time to have controllable relative timing of certain events, However, in the some test suite logs, we'd like to print actual elapsed time for certain parts of the test. (As one example, we…
jpw
  • 18,697
  • 25
  • 111
  • 187
0
votes
1 answer

default rails nested controller rspec testing

So, I have a controller nested within 2 others here's an example route products/123/conditions/321/inventories/121 and the controllers are nested like this as well, so I'm trying to figure out what to stub out in my…
dansch
  • 6,059
  • 4
  • 43
  • 59
0
votes
1 answer

Detecting Eclipse (CDT) environment in macro

I'm compiling for an embedded target and my compiler understands some non-standard macros. I want to define some "stub" macros for the benefit of eclipse (so that it doesn't pester me with spurious warnings). I want something like: #ifdef…
aaaidan
  • 7,093
  • 8
  • 66
  • 102
0
votes
1 answer

rspec stubbing complex chained methods with rspec

I have the following chained data: Data::Universal.find("501c2599dc1c82704e000037").data.last.foo => [#
JZ.
  • 21,147
  • 32
  • 115
  • 192
0
votes
1 answer

Unable to sendViaPost - on Axis2 client stub

I am working on an Axis 2 (1.6.1) java client generated with wsdl2java. It seems to be working fine but from time to time I get the following error : 14:38:04,855 INFO [HTTPSender] Unable to sendViaPost to url[...] java.net.SocketException:…
dan radu
  • 21
  • 1
  • 2
0
votes
1 answer

stub generation failed with java.net.unknownhostexception

Iam trying to generate stub files using java sunwireless tool kit. Iam able to open the link in chrome Iam getting this error how to resolve it
user1203673
  • 1,015
  • 7
  • 15