Myeclipse???JUnit???е??????
???????????? ???????[ 2015/6/1 14:30:24 ] ???????????????
????JUnit????????????
1 import org.junit.Test;
2 import java.math.BigDecimal;
3 import junit.framework.TestCase;
4 public class caculate_test extends TestCase {
5 private Caculator ca = new Caculator();
6 protected void setUp() throws Exception {
7 super.setUp();
8 }
9 @Test
10 public void test_Add() {
11 ca.setNum1(1);
12 ca.setNum2(2);
13 ca.Add();
14 assertEquals("3.0"?? ca.getResult());
15 ca.setNum1(2.4);
16 ca.setNum2(1.2);
17 ca.Add();
18 assertEquals("3.6"?? ca.getResult());
19 ca.setNum1(Double.MAX_VALUE);
20 ca.setNum2(2);
21 ca.Add();
22 assertEquals("ERROR"?? ca.getResult());
23 }
24 @Test
25 public void test_Sub() {
26 ca.setNum1(1);
27 ca.setNum2(2);
28 ca.Sub();
29 assertEquals("-1.0"?? ca.getResult());
30 ca.setNum1(2.4);
31 ca.setNum2(1.2);
32 ca.Sub();
33 assertEquals("1.2"?? ca.getResult());
34 ca.setNum1(-Double.MAX_VALUE);
35 ca.setNum2(2);
36 ca.Sub();
37 assertEquals("ERROR"?? ca.getResult());
38 }
39 @Test
40 public void test_Mul() {
41 ca.setNum1(1);
42 ca.setNum2(2);
43 ca.Mul();
44 assertEquals("2.0"?? ca.getResult());
45 ca.setNum1(2.4);
46 ca.setNum2(1.2);
47 ca.Mul();
48 assertEquals("2.88"?? ca.getResult());
49 ca.setNum1(1.3);
50 ca.setNum2(0);
51 ca.Mul();
52 assertEquals("0.0"?? ca.getResult());
53 ca.setNum1(Double.MAX_VALUE);
54 ca.setNum2(2);
55 ca.Mul();
56 assertEquals("ERROR"?? ca.getResult());
57 }
58 @Test
59 public void test_Div() {
60 ca.setNum1(1);
61 ca.setNum2(2);
62 ca.Div();
63 assertEquals("0.5"?? ca.getResult());
64 ca.setNum1(2.4);
65 ca.setNum2(1.2);
66 ca.Div();
67 assertEquals("2.0"?? ca.getResult());
68 ca.setNum1(1.3);
69 ca.setNum2(0);
70 ca.Div();
71 assertEquals("ERROR"?? ca.getResult());
72 }
73 }
????????????
????GitHub:https://github.com/TongWee/SoftwareTesting_Caculator/
???????????????????????漰???????????????????SPASVOС??(021-61079698-8054)?????????????????????????
??????
JUnit????????????Junit???????????Junit???????е??????Android?μ?Junit????Android?????Junit???е??????JUnit??д??????????????С??Junit??????????github?????JUnit???????????????????????JUnit3.8??Spring 4.0 JUnit????Controller??????????Junit????????Maven???Junit???е??????Linux??Junit????????????????????????Junit Test Suite?????????????Jenkins+Ant+Java+Junit+SVN??????SpringMVC????Junit????Android???????Junit??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11????????
?????????App Bug???????????????????????Jmeter?????????QC??????APP????????????????app?????е????????jenkins+testng+ant+webdriver??????????????JMeter????HTTP???????Selenium 2.0 WebDriver ??????