Test module |
Test input |
Expected results |
Run results |
Deposit (I,N,P) |
(100000,0.75,100) |
√ |
√ |
Deposit (I,N,P) |
(100,250,100) |
Returns false |
Returns false |
Deposit (I,N,P) |
( -1,0.1,100) |
Returns false |
Returns false |
Deposit (I,N,P) |
(0,100,0) |
Returns false |
Returns false |
Test module |
Test input |
Expected results |
Run results |
Principal (I, N, f) |
(0.66,10,500000) |
√ |
√ |
Principal (I, N, f) |
(0,100,5000) |
Returns false |
Returns false |
Principal (I, N, f) |
(100,250,100) |
Returns false |
Returns false |
Principal (I, N, f) |
(500,-1,100) |
Returns false |
Returns false |
These are the two functions of the program can enter illegal number related tests, the other three functions are similar to the test method.
Some of the test code is as follows:
Public void test1 () { new fulijisuan_4 (); Assertequals (false, Fuli.deposit (500,-1,100));
Operation Result:
Because there is no way to find the JUNIT4 test data deviation, the data deviation can only be measured manually.
There is also a test can not enter the number of direct click on the "Calculate" button, the code is as follows:
@org. Junit.test publicvoid test1 () { new Fulijisuan _4 (); NULL ; Fuli.jbutton0mousemouseclicked (event);
Test Result: Pop-up Prompt window
This time, in order to write unit tests to change the previous code more, a deeper understanding of the code evolved into an application of the hardship.
Compound Interest Calculated unit Test