0% found this document useful (0 votes)
89 views4 pages

Exclude

The document contains 4 sections that define Java classes for arithmetic operations (addition, multiplication, subtraction) and a testng.xml file. The classes contain test methods that perform basic arithmetic operations (addition, multiplication, subtraction) on variables and print the results. The testng.xml file defines a test that excludes specific test methods from running, including addition method 2 and 3, multiplication method 1, and all subtraction methods.

Uploaded by

Shiva Sankar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
89 views4 pages

Exclude

The document contains 4 sections that define Java classes for arithmetic operations (addition, multiplication, subtraction) and a testng.xml file. The classes contain test methods that perform basic arithmetic operations (addition, multiplication, subtraction) on variables and print the results. The testng.xml file defines a test that excludes specific test methods from running, including addition method 2 and 3, multiplication method 1, and all subtraction methods.

Uploaded by

Shiva Sankar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 4

1)addition:

package arithmeticOperation;

import org.testng.Assert;
import org.testng.annotations.Test;

public class Addition {

// Write Hard Assertion (assertEquals) for each method and try to pass the
execution.

@Test
public void addMeth_1(){

int a = 0;
int b = 0;
int c = a+b;
Assert.assertEquals(c,0);
System.out.println("Successfully Executed Add Method-1 & The Value
is :"+ c);
}

@Test
public void addMeth_2(){

int a = 0;
int b = 0;
int c = a+b;
Assert.assertEquals(c,0);
System.out.println("Successfully Executed Add Method-2 & The Value
is :"+ c);
}

@Test
public void addMeth_3(){

int a = 0;
int b = 0;
int c = a+b;
Assert.assertEquals(c,0);

System.out.println("Successfully Executed Add Method-3 & The Value


is :"+ c);
}
}

2)Multiplication:
package arithmeticOperation;

import org.testng.annotations.Test;

public class Multiplication {

@Test
public void multMeth_1(){
int a = 0;
int b = 0;
int c = a*b;

System.out.println("Successfully Executed Multiplication Method-1 & The


Value is :"+ c);
}

@Test
public void multMeth_2(){

int a = 0;
int b = 0;
int c = a*b;

System.out.println("Successfully Executed Multiplication Method-2 & The


Value is :"+ c);
}

@Test
public void multMeth_3(){

int a = 0;
int b = 0;
int c = a*b;

System.out.println("Successfully Executed Multiplication Method-3 & The


Value is :"+ c);
}
}

3)Subtraction:
package arithmeticOperation;

import org.testng.annotations.Test;

public class Subtraction {

@Test
public void subMeth_1(){

int a = 0;
int b = 0;
int c = a-b;

System.out.println("Successfully Executed Subtraction Method-1 & The


Value is :"+ c);
}

@Test
public void subMeth_2(){

int a = 0;
int b = 0;
int c = a-b;
System.out.println("Successfully Executed Subtraction Method-2 & The
Value is :"+ c);
}

@Test
public void subMeth_3(){

int a = 0;
int b = 0;
int c = a-b;

System.out.println("Successfully Executed Subtraction Method-3 & The


Value is :"+ c);
}

@Test
public void Sub_Method(){

int a = 0;
int b = 0;
int c = a-b;

System.out.println("Successfully Executed Sub_Method & The Value is :"+ c);


}
}

4)testing.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Loan">

<!-- Write the testng.xml for all the Exclude Test Tags as mentioned -->

<test name="ExcludeTest" >


<classes>
<class name="arithmeticOperation.Addition">
<methods>
<include name="addMeth_2" />
<include name="addMeth_3" />
<exclude name="addEmployeeTestCase" />
</methods>
</class>
<class name="arithmeticOperation.Multiplication">
<methods>
<exclude name="multMeth_1" />
</methods>
</class>
<class name="arithmeticOperation.Subtraction">
<methods>
<exclude name="subMeth.*" />
</methods>
</class>
</classes>
</test>

</suite>

You might also like