Divya
Divya

Reputation: 11

TestNg xml showing no error- but while running it gives Total tests run: 0

I have created a class file to print a message. I also configured TestNG xml to execute the class. Below is the contents of the XML file:

<?xml version="1.0" encoding="UTF-8"?>

<suite name="Sample test Suite">
   <test name="Sample test">
    <classes>
      <class name="signIn.MainMenu" />
    </classes>
  </test>
</suite>

Here is my source code of MainMenu.java:

package signIn; 
public class MainMenu { 
    public static void main(String args[]){ 
        System.out.println("message"); 
    } 
}

Can someone help please?

Upvotes: 1

Views: 1085

Answers (1)

drkthng
drkthng

Reputation: 6939

You need to define a Test via annotations first,

so try this source instead:

import org.testng.annotations.Test;

public class MainMenu { 

    @Test
    public void test(){ 
       System.out.println("message"); 
    } 
}

and most important advice of all:

READ a tutorial on how to test with testNG!!

Upvotes: 2

Related Questions