পৃষ্ঠাসমূহ

Search Your Article

CS

 

Welcome to GoogleDG – your one-stop destination for free learning resources, guides, and digital tools.

At GoogleDG, we believe that knowledge should be accessible to everyone. Our mission is to provide readers with valuable ebooks, tutorials, and tech-related content that makes learning easier, faster, and more enjoyable.

What We Offer:

  • 📘 Free & Helpful Ebooks – covering education, technology, self-development, and more.

  • 💻 Step-by-Step Tutorials – practical guides on digital tools, apps, and software.

  • 🌐 Tech Updates & Tips – simplified information to keep you informed in the fast-changing digital world.

  • 🎯 Learning Support – resources designed to support students, professionals, and lifelong learners.

    Latest world News 

     

Our Vision

To create a digital knowledge hub where anyone, from beginners to advanced learners, can find trustworthy resources and grow their skills.

Why Choose Us?

✔ Simple explanations of complex topics
✔ 100% free access to resources
✔ Regularly updated content
✔ A community that values knowledge sharing

We are continuously working to expand our content library and provide readers with the most useful and relevant digital learning materials.

📩 If you’d like to connect, share feedback, or suggest topics, feel free to reach us through the Contact page.

Pageviews

Tuesday, January 24, 2017

TestNG - Plug with Eclipse

To set up TestNG with Eclipse, follow the steps given below:

Step 1: Download TestNG Archive

Download the latest version of TestNG jar file from www.testng.org. http://www.testng.org

OSArchive name
Windowstestng-6.8.jar
Linuxtestng-6.8.jar
Mactestng-6.8.jar
We assume you have copied the above JAR file in C:\>TestNG folder.

Step 2: Set Eclipse environment

  • Open eclipse -> right click on the project and go to property > Build Path > Configure Build Path and add the testng-6.8.jar in the libraries using Add External Jar button.
Add testng-6.8.jar in liraries.
  • We assume that your Eclipse has inbuilt TestNG plug-in; if it is not available, then please get the latest version using the update site.
    • In your Eclipse IDE, select Help / Software updates / Find and Install.
    • Search for new features to install.
    • New remote site.
    • For Eclipse 3.4 and above, enter http://beust.com/eclipse.
    • For Eclipse 3.3 and below, enter http://beust.com/eclipse1.
    • Make sure the check box next to the URL is checked and click Next.
    • Eclipse will then guide you through the process.
Now, your Eclipse is ready for the development of TestNG test cases.

Step 3: Verify TestNG Installation in Eclipse

  • Create a project TestNGProject in Eclipse at any location.
  • Create a class MessageUtil to test in the project.
/*
* This class prints the given message on console.
*/

public class MessageUtil {

   private String message;

   //Constructor
   //@param message to be printed
   public MessageUtil(String message){
      this.message = message;
   }

   // prints the message
   public 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;

public class TestNGExample {
   String message = "Hello World"; 
   MessageUtil messageUtil = new MessageUtil(message);

   @Test
   public void testPrintMessage() {   
      Assert.assertEquals(message,messageUtil.printMessage());
   }
}
The project structure should be as follows:
Project Structure Finally, verify the output of the program by right clicking on the program and running as TestNG.
Verify the result.
TestNG result success.

No comments:

Post a Comment