Test piles, test driver and test driver

The so-called test piles, that you are responsible for testing the module / method calls, so you need to imitate them to do a return value (false, but meet the design).

English is the pile stub; refers to a frame or special software modules to achieve a goal, mainly for the development and testing of a component that calls or rely on this module.

Stub: integration testing before programming to simulate some of the lower module under test modules with "double" module, to replace the interface module under test, the test module to accept or transfer data to, specifically for these tests, a "false" the module under test module called stub.

Test piles usually need to use a top-down integration


The so-called driving test (when using a bottom-up integration), that you are responsible for testing module / method is the middle, there is no main () entry, how to compile, how to start it? You need to write a method with a main () to call your module / method, this is the test drive.

Test drive contents belong to agile development test-driven development (TDD) is indicating to create test cases and software development testing (prior to the development of the code, first write test code)
public class ddd
{
// the Test Driver
public static void main (String [] args) {
ddd ddd new new D = ();
d.Add ();
}

//My module
public int Add() {
int output=this.Stub1() + this.Stub2();
System.out.print("My module: return value is "+output+"\n");
return output;
}

//Stub1
public int Stub1() {
int output=3;
System.out.print("Stub 1 : return value is "+output+"\n");
return output;

}

//Stub2
public int Stub2() {
int output=7;
System.out.print("Stub 2 : return value is "+output+"\n");
return output;
}
}

Guess you like

Origin www.cnblogs.com/lijunji/p/11443195.html