Hello @Sradha, You are not getting any error because there are none.
Talking about the test case that is executed is the first one as you have made only f1 as a test case. You need to do that individually for all the other test cases also. Overall just by adding @test before the functions you want to run as test case you will get all of the above as a test case.
package testNG;
import org.testng.annotations.Test;
public class AnnotationsDemo {
@Test
public void f1()
{
System.out.println("function1");
}
@Test
public void f2()
{
System.out.println("function2");
}
@Test
public void f3()
{
System.out.println("function3");
}
}
Output:-