Tests Vs Methods in TestNG

33 views
Skip to first unread message

Kumar

unread,
Aug 9, 2012, 10:50:44 AM8/9/12
to testng...@googlegroups.com
Hi,

Please see the attached screenshot and it shows methods passed instead of tests.

Why?

Do I need to ensure it shows tests passed or its okay?

Thanks,
Kumar
TestNG_TestsVsMethods.png

吴亭

unread,
Aug 9, 2012, 10:54:57 AM8/9/12
to testng...@googlegroups.com
Tests means how many <test> tags you have in your xml files.

Br
Tim

2012/8/9 Kumar <your...@gmail.com>

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/testng-users/-/j8YVpLz_EmAJ.
To post to this group, send email to testng...@googlegroups.com.
To unsubscribe from this group, send email to testng-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.

Kumar

unread,
Aug 9, 2012, 10:57:25 AM8/9/12
to testng...@googlegroups.com
Tim, 

I agree.

I have more than one @test annotations in my code, but still it shows only one test, but correct number of methods.

I have a method immediately after the @test annotation.

Thanks,
Kumar.

Kumar

unread,
Aug 9, 2012, 10:58:26 AM8/9/12
to testng...@googlegroups.com
By the way, I am not using any xml file here.

What is the purpose of using xml files here?
How efficient can I make my automation test with it?

Thanks,
Kumar

吴亭

unread,
Aug 9, 2012, 11:00:16 AM8/9/12
to testng...@googlegroups.com
Hi Kumar,

Actually, you can use xml files to compose your suite like this:

<suite name="xx">

<listeners>
<listener class-name="a.b.c.xxx"></listener>
</listeners>

<test name="yy">
<classes>
<class name="a.b.c.GGGG"></class>
</classes>
</test>
<test name="yfy">
<classes>
<class name="a.b.c.GGGG"></class>
</classes>
</test>
</suite>

If you do not define this and run your code using testng eclipse plugin, it will help you generate a default xml file in your tmp folder.

Br,
Tim
2012/8/9 Kumar <your...@gmail.com>
To view this discussion on the web visit https://groups.google.com/d/msg/testng-users/-/3omKddYZWL0J.

Krishnan Mahadevan

unread,
Aug 9, 2012, 12:02:03 PM8/9/12
to testng...@googlegroups.com
Kumar,
I think you need to spend sometime reading the documentation on the testng site. Most of your questions would be answered on your own once you read the documentation. 

When you right click your class and run it as run as TestNG test, what TestNG does is, it adds up your @Test annotated test methods into a <test> tag which again gets wrapped up into a <suite>. 

In short a test suite <suite> contains of one or more <test> tests. Every <test> contains one or more @Test annotated test methods. 


--
Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
Reply all
Reply to author
Forward
0 new messages