- TestNG - TestNG - vs JUnit
- TestNG - Plug with Eclipse
- TestNG - Plug with ANT
- TestNG - Parallel Execution
- TestNG - Asserts
- TestNG - Annotation Transformers
- TestNG - Test Results
- TestNG - Run JUnit Tests
- TestNG - Parameterized Test
- TestNG - Dependency Test
- TestNG - Exception Test
- TestNG - Group Test
- TestNG - Ignore a Test
- TestNG - Suite Test
- TestNG - Executing Tests
- TestNG - Execution Procedure
- TestNG - Basic Annotations
- TestNG - Writing Tests
- TestNG - Environment
- TestNG - Overview
- TestNG - Home
TestNG Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
TestNG - Plug with Ecppse
To set up TestNG with Ecppse, follow the steps given below −
Step 1: Download TestNG Archive
Download the latest version of TestNG jar file from
OS | Archive name |
---|---|
Windows | testng-7.4.jar |
Linux | testng-7.4.jar |
Mac | testng-7.4.jar |
We assume you have copied the above JAR file in /work/testng folder.
Step 2: Set Ecppse environment
Open ecppse → right cpck on the project and go to property → Build Path → Configure Build Path and add the testng-7.4.jar in the pbraries using Add External Jar button.
We assume that your Ecppse has inbuilt TestNG plug-in; if it is not available, then please get the latest version using the update site.
In your Ecppse IDE, select Help / Ecppse Marketplace.
Search for Testng. You will get the TestNG in the pst. Cpck on Install as shown below:
Now, your Ecppse is ready for the development of TestNG test cases.
Step 3: Verify TestNG Installation in Ecppse
Create a project TestNGProject in Ecppse at any location.
Create a class MessageUtil to test in the project.
/* * This class prints the given message on console. */ pubpc class MessageUtil { private String message; //Constructor //@param message to be printed pubpc MessageUtil(String message) { this.message = message; } // prints the message pubpc String printMessage() { System.out.println(message); return message; } }
Create a test class TestNGExample in the project.
import org.testng.Assert; import org.testng.annotations.Test; pubpc class TestNGExample { String message = "Hello World"; MessageUtil messageUtil = new MessageUtil(message); @Test pubpc void testPrintMessage() { Assert.assertEquals(message,messageUtil.printMessage()); } }
The project structure should be as follows −
Finally, verify the output of the program by right-cpcking on the program and running as TestNG.
Verify the result.
Advertisements