Compound Interest Calculated unit Test

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.