Help Needed!

38 views
Skip to first unread message

Ade Tester

unread,
Jul 9, 2015, 12:34:27 PM7/9/15
to testng...@googlegroups.com
Hi guys

By default a new class will have only one @Test method. How do I Add two more@Test  methods by myself and put my code accordingly in methods?

Does anyone here know?

Todd Bradley

unread,
Jul 9, 2015, 2:07:04 PM7/9/15
to testng...@googlegroups.com
Did you try creating two or more methods all annotated with @Test in the same class? What happened when you ran the test?




---
Sent from Boxer | http://getboxer.com

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to testng-users...@googlegroups.com.
To post to this group, send email to testng...@googlegroups.com.
Visit this group at http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.

Mohanraj Ramalingam

unread,
Jul 9, 2015, 3:54:08 PM7/9/15
to testng...@googlegroups.com
Hi Ade, You can use the below format to include more test in a single class.


public class Test1 {
  @Test(groups = { "functest""checkintest" })
  public void testMethod1() {
  }
 
  @Test(groups = {"functest""checkintest"} )
  public void testMethod2() {
  }
 
  @Test(groups = { "functest" })
  public void testMethod3() {
  }
}
--
Mohanraj Ramalingam

Ade Tester

unread,
Sep 24, 2015, 11:59:31 AM9/24/15
to testng-users
Hi Guys, What is wrong with the code below?  I tried creating two or more methods all annotated with @Test in the same class but kept getting the squiggly error lines on the second on the method "void" and the method name "Search". 
Highlighting void gives the message :void[] is an invalid type. Highlighting Search gives the message: Illegal modifier for parameter Search; only final is permitted.

What am I doing wrong?

I see multiple @Tests on various documents but when I trying writing mine I get error. Could someone please advise?

 @Test
 public void Homepage() {
 
WebDriver driver = new FirefoxDriver();

 
 
@Test
public void Search() {

Shawn McCarthy

unread,
Sep 24, 2015, 1:56:42 PM9/24/15
to testng-users
You are missing a } for the first and second test method. Try :
Reply all
Reply to author
Forward
0 new messages