-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathTestCalc.java
More file actions
48 lines (43 loc) · 1.08 KB
/
TestCalc.java
File metadata and controls
48 lines (43 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import org.testng.Assert;
import org.testng.annotations.Test;
// here i am doing testing of my functionality
// TestSuite
// TestCase
public class TestCalc {
@Test
public void testAddTwoIntegers(){
int firstNO = 10;
int secondNo = 20;
int expectedResult = 30;
Calc obj = new Calc();
int result = obj.add(firstNO, secondNo);
Assert.assertEquals(result, expectedResult);
}
@Test(priority=1)
public void testAddTwoStrings(){
String firstNO = "10";
String secondNo = "20";
int expectedResult = 30;
Calc obj = new Calc();
int result = obj.add(firstNO, secondNo);
Assert.assertEquals(result, expectedResult);
}
@Test(enabled=false)
public void testAddTwoNegative(){
int firstNO = -10;
int secondNo = -20;
int expectedResult = 0;
Calc obj = new Calc();
int result = obj.add(firstNO, secondNo);
Assert.assertEquals(result, expectedResult);
}
@Test(timeOut=1)
public void testAddTwoIntegersUnder10sec(){
int firstNO = 10;
int secondNo = 20;
int expectedResult = 30;
Calc obj = new Calc();
int result = obj.add(firstNO, secondNo);
Assert.assertEquals(result, expectedResult);
}
}