Job 8 Unit Test exercise

Source: Internet
Author: User

[ must do 1] for the triangle given in Appendix 1 to determine the Java code, the use of equivalent class partitioning method to design test cases. List the design test cases in tabular form and write them to your blog.

Serial number Test input Test prophecy
1 3 3 3 Regular
2 3 4 5 Scalene
3 1 2 3 Illegal
4 3 3 4 Isoceles


Must do 2
] imitate Appendix 2 gives the Triangle Judge junit test Code, Design Unit test script, test [ must do 1] design of the test cases. Note the order in which the test cases appear in the test script is consistent with the order listed in the [ required title 1] table. Run the resulting test script, truncate the result graph, write to the blog, and commit the source code to your own github.

Test result diagram:

[ must do title 3] experience. Write down the knowledge you learned from this practice.

A: The JUnit test, I still do not use it, or the final question to ask students and slowly on the Internet to explore the results.

Note: Gitgub submissions always show errors and cannot be submitted. Began to think is the reason for the school network, and then changed to 4G is not, always in the last step error. The source program is first placed here:

Import static org.junit.assert.*;

Import Org.junit.Test;

public class Testtriangle {
@Test
public void TestIsTriangle1 () {
Triangle t = new Triangle (3,3,3);
Assertequals (T.gettype (t), "Regular");
}

@Test
public void TestIsTriangle2 () {

Triangle t = new Triangle (3,4,5);
Assertequals (T.gettype (t), "Scalene");
}

@Test
public void TestIsTriangle3 () {
Triangle t = new Triangle (n/a);
Assertequals (T.gettype (t), "illegal");
}
@Test
public void TestIsTriangle4 () {
Triangle t = new Triangle (3,3,4);
Assertequals (T.gettype (t), "isoceles");
}

}

Job 8 Unit Test exercise

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.