Confusion With Creating TestNG.XML

classic Classic list List threaded Threaded
18 messages Options
Reply | Threaded
Open this post in threaded view
|

Confusion With Creating TestNG.XML

youralok@gmail.com
Hi,

I have written my code in Java Language for selenium webdriver tests.

In my code, I have one public class and multiple methods. Each method is dependent on previous method, so I have dependency as well.
My each method is a test case as well.

However, I want to create an TestNG.XML file and document it so that I can run each test case (method) separately and get results accordingly.

I reviewed the documentation, but still confused.

Please help,
Kumar

--
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/-/wjV8pzq9aa0J.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.
Reply | Threaded
Open this post in threaded view
|

Re: Confusion With Creating TestNG.XML

Krishnan Mahadevan
AFAIK I don't think you can execute @Test annotated methods independently when they are depending upon some other @Test annotated method.

Have you tried using preserve-order tag and using it in conjunction with <include> tag? Would that help ?

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Suite" parallel="methods">
<test name="Test" preserve-order="true">
<classes>
<class name="testng.samples.DemoTest">
<methods>
<include name="f"></include>
<include name="foo"></include>
<include name="bar"></include>
</methods>
</class>

</classes>
</test> <!-- Test -->
</suite> <!-- Suite -->



Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"



On Mon, Sep 3, 2012 at 4:56 PM, Kumar <[hidden email]> wrote:
Hi,

I have written my code in Java Language for selenium webdriver tests.

In my code, I have one public class and multiple methods. Each method is dependent on previous method, so I have dependency as well.
My each method is a test case as well.

However, I want to create an TestNG.XML file and document it so that I can run each test case (method) separately and get results accordingly.

I reviewed the documentation, but still confused.

Please help,
Kumar

--
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/-/wjV8pzq9aa0J.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.
Reply | Threaded
Open this post in threaded view
|

Re: Confusion With Creating TestNG.XML

youralok@gmail.com
Thanks Krishnan, but my confusion is not with dependent methods.
I am able to run my tests without any problem when I have one public class and many methods in it.

But, I want to invoke the run in an .xml file and thus confused on how to start?
Can I create a new class for each method, remove dependency and then call them from through .xml file?

(If you can share a long test suite with multiple classes and methods might help me.)

Thanks,
Kumar.

On Mon, Sep 3, 2012 at 5:08 PM, Krishnan Mahadevan <[hidden email]> wrote:
AFAIK I don't think you can execute @Test annotated methods independently when they are depending upon some other @Test annotated method.

Have you tried using preserve-order tag and using it in conjunction with <include> tag? Would that help ?

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Suite" parallel="methods">
<test name="Test" preserve-order="true">
<classes>
<class name="testng.samples.DemoTest">
<methods>
<include name="f"></include>
<include name="foo"></include>
<include name="bar"></include>
</methods>
</class>

</classes>
</test> <!-- Test -->
</suite> <!-- Suite -->



Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"



On Mon, Sep 3, 2012 at 4:56 PM, Kumar <[hidden email]> wrote:
Hi,

I have written my code in Java Language for selenium webdriver tests.

In my code, I have one public class and multiple methods. Each method is dependent on previous method, so I have dependency as well.
My each method is a test case as well.

However, I want to create an TestNG.XML file and document it so that I can run each test case (method) separately and get results accordingly.

I reviewed the documentation, but still confused.

Please help,
Kumar

--
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/-/wjV8pzq9aa0J.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.
Reply | Threaded
Open this post in threaded view
|

Re: Confusion With Creating TestNG.XML

Krishnan Mahadevan
The approach is still the same. 

So if you have more than one test classes with each test class having 1 @Test annotated method, then you would basically list out each of them using the 

<class name=""> tag and then work with it.

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"



On Mon, Sep 3, 2012 at 5:13 PM, Alok Agarwal <[hidden email]> wrote:
Thanks Krishnan, but my confusion is not with dependent methods.
I am able to run my tests without any problem when I have one public class and many methods in it.

But, I want to invoke the run in an .xml file and thus confused on how to start?
Can I create a new class for each method, remove dependency and then call them from through .xml file?

(If you can share a long test suite with multiple classes and methods might help me.)

Thanks,
Kumar.

On Mon, Sep 3, 2012 at 5:08 PM, Krishnan Mahadevan <[hidden email]> wrote:
AFAIK I don't think you can execute @Test annotated methods independently when they are depending upon some other @Test annotated method.

Have you tried using preserve-order tag and using it in conjunction with <include> tag? Would that help ?

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Suite" parallel="methods">
<test name="Test" preserve-order="true">
<classes>
<class name="testng.samples.DemoTest">
<methods>
<include name="f"></include>
<include name="foo"></include>
<include name="bar"></include>
</methods>
</class>

</classes>
</test> <!-- Test -->
</suite> <!-- Suite -->



Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"



On Mon, Sep 3, 2012 at 4:56 PM, Kumar <[hidden email]> wrote:
Hi,

I have written my code in Java Language for selenium webdriver tests.

In my code, I have one public class and multiple methods. Each method is dependent on previous method, so I have dependency as well.
My each method is a test case as well.

However, I want to create an TestNG.XML file and document it so that I can run each test case (method) separately and get results accordingly.

I reviewed the documentation, but still confused.

Please help,
Kumar

--
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/-/wjV8pzq9aa0J.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.
Reply | Threaded
Open this post in threaded view
|

Re: Confusion With Creating TestNG.XML

youralok@gmail.com
Ok Krishnan, let me try that and get back to you if needed.

I just tried add public class and move method inside it (with @Test annotation) for a few methods and try to run it, but its doing nothing.
What could be the cause?

Thanks,
Kumar.

On Monday, September 3, 2012 5:15:07 PM UTC+5:30, Krishnan wrote:
The approach is still the same. 

So if you have more than one test classes with each test class having 1 @Test annotated method, then you would basically list out each of them using the 

<class name=""> tag and then work with it.

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"



On Mon, Sep 3, 2012 at 5:13 PM, Alok Agarwal <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="FZNzLzRT5KsJ">your...@...> wrote:
Thanks Krishnan, but my confusion is not with dependent methods.
I am able to run my tests without any problem when I have one public class and many methods in it.

But, I want to invoke the run in an .xml file and thus confused on how to start?
Can I create a new class for each method, remove dependency and then call them from through .xml file?

(If you can share a long test suite with multiple classes and methods might help me.)

Thanks,
Kumar.

On Mon, Sep 3, 2012 at 5:08 PM, Krishnan Mahadevan <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="FZNzLzRT5KsJ">krishnan.ma...@gmail.com> wrote:
AFAIK I don't think you can execute @Test annotated methods independently when they are depending upon some other @Test annotated method.

Have you tried using preserve-order tag and using it in conjunction with <include> tag? Would that help ?

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Suite" parallel="methods">
<test name="Test" preserve-order="true">
<classes>
<class name="testng.samples.DemoTest">
<methods>
<include name="f"></include>
<include name="foo"></include>
<include name="bar"></include>
</methods>
</class>

</classes>
</test> <!-- Test -->
</suite> <!-- Suite -->



Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"



On Mon, Sep 3, 2012 at 4:56 PM, Kumar <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="FZNzLzRT5KsJ">your...@...> wrote:
Hi,

I have written my code in Java Language for selenium webdriver tests.

In my code, I have one public class and multiple methods. Each method is dependent on previous method, so I have dependency as well.
My each method is a test case as well.

However, I want to create an TestNG.XML file and document it so that I can run each test case (method) separately and get results accordingly.

I reviewed the documentation, but still confused.

Please help,
Kumar

--
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/-/wjV8pzq9aa0J.
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="FZNzLzRT5KsJ">testng...@....
To unsubscribe from this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="FZNzLzRT5KsJ">testng-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="FZNzLzRT5KsJ">testng...@....
To unsubscribe from this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="FZNzLzRT5KsJ">testng-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="FZNzLzRT5KsJ">testng...@....
To unsubscribe from this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="FZNzLzRT5KsJ">testng-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.

--
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/-/ffeI8RKm4qUJ.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.
Reply | Threaded
Open this post in threaded view
|

Re: Confusion With Creating TestNG.XML

Krishnan Mahadevan
You would need to show some code as well as your TestNG suite file for me or anyone else to comment further.

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"



On Mon, Sep 3, 2012 at 5:20 PM, Kumar <[hidden email]> wrote:
Ok Krishnan, let me try that and get back to you if needed.

I just tried add public class and move method inside it (with @Test annotation) for a few methods and try to run it, but its doing nothing.
What could be the cause?

Thanks,
Kumar.

On Monday, September 3, 2012 5:15:07 PM UTC+5:30, Krishnan wrote:
The approach is still the same. 

So if you have more than one test classes with each test class having 1 @Test annotated method, then you would basically list out each of them using the 

<class name=""> tag and then work with it.

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"



On Mon, Sep 3, 2012 at 5:13 PM, Alok Agarwal <[hidden email]> wrote:
Thanks Krishnan, but my confusion is not with dependent methods.
I am able to run my tests without any problem when I have one public class and many methods in it.

But, I want to invoke the run in an .xml file and thus confused on how to start?
Can I create a new class for each method, remove dependency and then call them from through .xml file?

(If you can share a long test suite with multiple classes and methods might help me.)

Thanks,
Kumar.

On Mon, Sep 3, 2012 at 5:08 PM, Krishnan Mahadevan <krishnan.ma...@gmail.com> wrote:
AFAIK I don't think you can execute @Test annotated methods independently when they are depending upon some other @Test annotated method.

Have you tried using preserve-order tag and using it in conjunction with <include> tag? Would that help ?

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Suite" parallel="methods">
<test name="Test" preserve-order="true">
<classes>
<class name="testng.samples.DemoTest">
<methods>
<include name="f"></include>
<include name="foo"></include>
<include name="bar"></include>
</methods>
</class>

</classes>
</test> <!-- Test -->
</suite> <!-- Suite -->



Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"



On Mon, Sep 3, 2012 at 4:56 PM, Kumar <[hidden email]> wrote:
Hi,

I have written my code in Java Language for selenium webdriver tests.

In my code, I have one public class and multiple methods. Each method is dependent on previous method, so I have dependency as well.
My each method is a test case as well.

However, I want to create an TestNG.XML file and document it so that I can run each test case (method) separately and get results accordingly.

I reviewed the documentation, but still confused.

Please help,
Kumar

--
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/-/wjV8pzq9aa0J.
To post to this group, send email to [hidden email].
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.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email].
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.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email].
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.

--
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/-/ffeI8RKm4qUJ.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.
Reply | Threaded
Open this post in threaded view
|

Re: Confusion With Creating TestNG.XML

youralok@gmail.com
Here is the java code that I have (Per your suggestion, I have removed method dependency as we can maintain the order in .XML file):

public class SmallTests {

public WebDriver loginpage = new FirefoxDriver();
public WebDriverWait waitforobjecttoload = new WebDriverWait(loginpage, 100);

public class Login
{
@Test
public Login() throws InterruptedException
{
*****
}

public class CreateSurvey
{
@Test

public CreateSurvey() throws InterruptedException
{
*****
}

public class ChangesInProperties
{
@Test
public ChangesInProperties() throws InterruptedException
{
*****
}

public class TextBlock
{
@Test
public TextBlock() throws InterruptedException
{
*****
}
}

Thanks,
Kumar.

On Monday, September 3, 2012 5:35:17 PM UTC+5:30, Krishnan wrote:
You would need to show some code as well as your TestNG suite file for me or anyone else to comment further.

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"



On Mon, Sep 3, 2012 at 5:20 PM, Kumar <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="YGBd0X1TZ6oJ">your...@...> wrote:
Ok Krishnan, let me try that and get back to you if needed.

I just tried add public class and move method inside it (with @Test annotation) for a few methods and try to run it, but its doing nothing.
What could be the cause?

Thanks,
Kumar.

On Monday, September 3, 2012 5:15:07 PM UTC+5:30, Krishnan wrote:
The approach is still the same. 

So if you have more than one test classes with each test class having 1 @Test annotated method, then you would basically list out each of them using the 

<class name=""> tag and then work with it.

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"



On Mon, Sep 3, 2012 at 5:13 PM, Alok Agarwal <[hidden email]> wrote:
Thanks Krishnan, but my confusion is not with dependent methods.
I am able to run my tests without any problem when I have one public class and many methods in it.

But, I want to invoke the run in an .xml file and thus confused on how to start?
Can I create a new class for each method, remove dependency and then call them from through .xml file?

(If you can share a long test suite with multiple classes and methods might help me.)

Thanks,
Kumar.

On Mon, Sep 3, 2012 at 5:08 PM, Krishnan Mahadevan <krishnan.ma...@gmail.com> wrote:
AFAIK I don't think you can execute @Test annotated methods independently when they are depending upon some other @Test annotated method.

Have you tried using preserve-order tag and using it in conjunction with <include> tag? Would that help ?

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Suite" parallel="methods">
<test name="Test" preserve-order="true">
<classes>
<class name="testng.samples.DemoTest">
<methods>
<include name="f"></include>
<include name="foo"></include>
<include name="bar"></include>
</methods>
</class>

</classes>
</test> <!-- Test -->
</suite> <!-- Suite -->



Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"



On Mon, Sep 3, 2012 at 4:56 PM, Kumar <[hidden email]> wrote:
Hi,

I have written my code in Java Language for selenium webdriver tests.

In my code, I have one public class and multiple methods. Each method is dependent on previous method, so I have dependency as well.
My each method is a test case as well.

However, I want to create an TestNG.XML file and document it so that I can run each test case (method) separately and get results accordingly.

I reviewed the documentation, but still confused.

Please help,
Kumar

--
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/-/wjV8pzq9aa0J.
To post to this group, send email to [hidden email].
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.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email].
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.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email].
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.

--
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/-/ffeI8RKm4qUJ.
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="YGBd0X1TZ6oJ">testng...@....
To unsubscribe from this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="YGBd0X1TZ6oJ">testng-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.

--
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/-/-outl5Jscd4J.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.
Reply | Threaded
Open this post in threaded view
|

Re: Confusion With Creating TestNG.XML

Krishnan Mahadevan
So what is the issue here ?

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"



On Mon, Sep 3, 2012 at 5:57 PM, Kumar <[hidden email]> wrote:
Here is the java code that I have (Per your suggestion, I have removed method dependency as we can maintain the order in .XML file):

public class SmallTests {

public WebDriver loginpage = new FirefoxDriver();
public WebDriverWait waitforobjecttoload = new WebDriverWait(loginpage, 100);

public class Login
{
@Test
public Login() throws InterruptedException
{
*****
}

public class CreateSurvey
{
@Test

public CreateSurvey() throws InterruptedException
{
*****
}

public class ChangesInProperties
{
@Test
public ChangesInProperties() throws InterruptedException
{
*****
}

public class TextBlock
{
@Test
public TextBlock() throws InterruptedException
{
*****
}
}

Thanks,
Kumar.

On Monday, September 3, 2012 5:35:17 PM UTC+5:30, Krishnan wrote:
You would need to show some code as well as your TestNG suite file for me or anyone else to comment further.

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"



On Mon, Sep 3, 2012 at 5:20 PM, Kumar <[hidden email]> wrote:
Ok Krishnan, let me try that and get back to you if needed.

I just tried add public class and move method inside it (with @Test annotation) for a few methods and try to run it, but its doing nothing.
What could be the cause?

Thanks,
Kumar.

On Monday, September 3, 2012 5:15:07 PM UTC+5:30, Krishnan wrote:
The approach is still the same. 

So if you have more than one test classes with each test class having 1 @Test annotated method, then you would basically list out each of them using the 

<class name=""> tag and then work with it.

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"



On Mon, Sep 3, 2012 at 5:13 PM, Alok Agarwal <[hidden email]> wrote:
Thanks Krishnan, but my confusion is not with dependent methods.
I am able to run my tests without any problem when I have one public class and many methods in it.

But, I want to invoke the run in an .xml file and thus confused on how to start?
Can I create a new class for each method, remove dependency and then call them from through .xml file?

(If you can share a long test suite with multiple classes and methods might help me.)

Thanks,
Kumar.

On Mon, Sep 3, 2012 at 5:08 PM, Krishnan Mahadevan <krishnan.ma...@gmail.com> wrote:
AFAIK I don't think you can execute @Test annotated methods independently when they are depending upon some other @Test annotated method.

Have you tried using preserve-order tag and using it in conjunction with <include> tag? Would that help ?

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Suite" parallel="methods">
<test name="Test" preserve-order="true">
<classes>
<class name="testng.samples.DemoTest">
<methods>
<include name="f"></include>
<include name="foo"></include>
<include name="bar"></include>
</methods>
</class>

</classes>
</test> <!-- Test -->
</suite> <!-- Suite -->



Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"



On Mon, Sep 3, 2012 at 4:56 PM, Kumar <[hidden email]> wrote:
Hi,

I have written my code in Java Language for selenium webdriver tests.

In my code, I have one public class and multiple methods. Each method is dependent on previous method, so I have dependency as well.
My each method is a test case as well.

However, I want to create an TestNG.XML file and document it so that I can run each test case (method) separately and get results accordingly.

I reviewed the documentation, but still confused.

Please help,
Kumar

--
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/-/wjV8pzq9aa0J.
To post to this group, send email to [hidden email].
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.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email].
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.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email].
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.

--
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/-/ffeI8RKm4qUJ.
To post to this group, send email to [hidden email].
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.

--
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/-/-outl5Jscd4J.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.
Reply | Threaded
Open this post in threaded view
|

Re: Confusion With Creating TestNG.XML

youralok@gmail.com
If you feel that is correct and fine, then its a good news for me.

I tried to run the same code using .XML file, but it is giving following error:
"Cannot find class in classpath: Login.SmallTests.SM_SmokeTest".

Here is my .XML code for two classes:

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

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">

<suite name="Survey Manager Smoke Test" >

<test name="Login To the Account">

<classes>

<class name="Login.SmallTests.SM_SmokeTest"/>

</classes>

</test>

<test name="Create Survey">

<classes>

<class name="CreateSurvey.SmallTests.SM_SmokeTest"/>

</classes>

</test>

</suite> 


Thanks,
Kumar.

On Monday, September 3, 2012 5:58:11 PM UTC+5:30, Krishnan wrote:
So what is the issue here ?

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"



On Mon, Sep 3, 2012 at 5:57 PM, Kumar <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="LIQC1W9dIQcJ">your...@...> wrote:
Here is the java code that I have (Per your suggestion, I have removed method dependency as we can maintain the order in .XML file):

public class SmallTests {

public WebDriver loginpage = new FirefoxDriver();
public WebDriverWait waitforobjecttoload = new WebDriverWait(loginpage, 100);

public class Login
{
@Test
public Login() throws InterruptedException
{
*****
}

public class CreateSurvey
{
@Test

public CreateSurvey() throws InterruptedException
{
*****
}

public class ChangesInProperties
{
@Test
public ChangesInProperties() throws InterruptedException
{
*****
}

public class TextBlock
{
@Test
public TextBlock() throws InterruptedException
{
*****
}
}

Thanks,
Kumar.

On Monday, September 3, 2012 5:35:17 PM UTC+5:30, Krishnan wrote:
You would need to show some code as well as your TestNG suite file for me or anyone else to comment further.

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"



On Mon, Sep 3, 2012 at 5:20 PM, Kumar <[hidden email]> wrote:
Ok Krishnan, let me try that and get back to you if needed.

I just tried add public class and move method inside it (with @Test annotation) for a few methods and try to run it, but its doing nothing.
What could be the cause?

Thanks,
Kumar.

On Monday, September 3, 2012 5:15:07 PM UTC+5:30, Krishnan wrote:
The approach is still the same. 

So if you have more than one test classes with each test class having 1 @Test annotated method, then you would basically list out each of them using the 

<class name=""> tag and then work with it.

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"



On Mon, Sep 3, 2012 at 5:13 PM, Alok Agarwal <[hidden email]> wrote:
Thanks Krishnan, but my confusion is not with dependent methods.
I am able to run my tests without any problem when I have one public class and many methods in it.

But, I want to invoke the run in an .xml file and thus confused on how to start?
Can I create a new class for each method, remove dependency and then call them from through .xml file?

(If you can share a long test suite with multiple classes and methods might help me.)

Thanks,
Kumar.

On Mon, Sep 3, 2012 at 5:08 PM, Krishnan Mahadevan <krishnan.ma...@gmail.com> wrote:
AFAIK I don't think you can execute @Test annotated methods independently when they are depending upon some other @Test annotated method.

Have you tried using preserve-order tag and using it in conjunction with <include> tag? Would that help ?

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Suite" parallel="methods">
<test name="Test" preserve-order="true">
<classes>
<class name="testng.samples.DemoTest">
<methods>
<include name="f"></include>
<include name="foo"></include>
<include name="bar"></include>
</methods>
</class>

</classes>
</test> <!-- Test -->
</suite> <!-- Suite -->



Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"



On Mon, Sep 3, 2012 at 4:56 PM, Kumar <[hidden email]> wrote:
Hi,

I have written my code in Java Language for selenium webdriver tests.

In my code, I have one public class and multiple methods. Each method is dependent on previous method, so I have dependency as well.
My each method is a test case as well.

However, I want to create an TestNG.XML file and document it so that I can run each test case (method) separately and get results accordingly.

I reviewed the documentation, but still confused.

Please help,
Kumar

--
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/-/wjV8pzq9aa0J.
To post to this group, send email to [hidden email].
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.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email].
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.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email].
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.

--
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/-/ffeI8RKm4qUJ.
To post to this group, send email to [hidden email].
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.

--
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/-/-outl5Jscd4J.
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="LIQC1W9dIQcJ">testng...@....
To unsubscribe from this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="LIQC1W9dIQcJ">testng-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.

--
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/-/9ZcMzEPaoREJ.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.
Reply | Threaded
Open this post in threaded view
|

Re: Confusion With Creating TestNG.XML

Krishnan Mahadevan
You would need to give the fully qualified package path of "SmallTests" in your suite file.
The easiest way of doing this is to right click your class, and choose "Copy qualified name" if you were using eclipse.

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"



On Mon, Sep 3, 2012 at 6:01 PM, Kumar <[hidden email]> wrote:
If you feel that is correct and fine, then its a good news for me.

I tried to run the same code using .XML file, but it is giving following error:
"Cannot find class in classpath: Login.SmallTests.SM_SmokeTest".

Here is my .XML code for two classes:

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

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">

<suite name="Survey Manager Smoke Test" >

<test name="Login To the Account">

<classes>

<class name="Login.SmallTests.SM_SmokeTest"/>

</classes>

</test>

<test name="Create Survey">

<classes>

<class name="CreateSurvey.SmallTests.SM_SmokeTest"/>

</classes>

</test>

</suite> 


Thanks,
Kumar.

On Monday, September 3, 2012 5:58:11 PM UTC+5:30, Krishnan wrote:
So what is the issue here ?

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"



On Mon, Sep 3, 2012 at 5:57 PM, Kumar <[hidden email]> wrote:
Here is the java code that I have (Per your suggestion, I have removed method dependency as we can maintain the order in .XML file):

public class SmallTests {

public WebDriver loginpage = new FirefoxDriver();
public WebDriverWait waitforobjecttoload = new WebDriverWait(loginpage, 100);

public class Login
{
@Test
public Login() throws InterruptedException
{
*****
}

public class CreateSurvey
{
@Test

public CreateSurvey() throws InterruptedException
{
*****
}

public class ChangesInProperties
{
@Test
public ChangesInProperties() throws InterruptedException
{
*****
}

public class TextBlock
{
@Test
public TextBlock() throws InterruptedException
{
*****
}
}

Thanks,
Kumar.

On Monday, September 3, 2012 5:35:17 PM UTC+5:30, Krishnan wrote:
You would need to show some code as well as your TestNG suite file for me or anyone else to comment further.

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"



On Mon, Sep 3, 2012 at 5:20 PM, Kumar <[hidden email]> wrote:
Ok Krishnan, let me try that and get back to you if needed.

I just tried add public class and move method inside it (with @Test annotation) for a few methods and try to run it, but its doing nothing.
What could be the cause?

Thanks,
Kumar.

On Monday, September 3, 2012 5:15:07 PM UTC+5:30, Krishnan wrote:
The approach is still the same. 

So if you have more than one test classes with each test class having 1 @Test annotated method, then you would basically list out each of them using the 

<class name=""> tag and then work with it.

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"



On Mon, Sep 3, 2012 at 5:13 PM, Alok Agarwal <[hidden email]> wrote:
Thanks Krishnan, but my confusion is not with dependent methods.
I am able to run my tests without any problem when I have one public class and many methods in it.

But, I want to invoke the run in an .xml file and thus confused on how to start?
Can I create a new class for each method, remove dependency and then call them from through .xml file?

(If you can share a long test suite with multiple classes and methods might help me.)

Thanks,
Kumar.

On Mon, Sep 3, 2012 at 5:08 PM, Krishnan Mahadevan <krishnan.ma...@gmail.com> wrote:
AFAIK I don't think you can execute @Test annotated methods independently when they are depending upon some other @Test annotated method.

Have you tried using preserve-order tag and using it in conjunction with <include> tag? Would that help ?

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Suite" parallel="methods">
<test name="Test" preserve-order="true">
<classes>
<class name="testng.samples.DemoTest">
<methods>
<include name="f"></include>
<include name="foo"></include>
<include name="bar"></include>
</methods>
</class>

</classes>
</test> <!-- Test -->
</suite> <!-- Suite -->



Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"



On Mon, Sep 3, 2012 at 4:56 PM, Kumar <[hidden email]> wrote:
Hi,

I have written my code in Java Language for selenium webdriver tests.

In my code, I have one public class and multiple methods. Each method is dependent on previous method, so I have dependency as well.
My each method is a test case as well.

However, I want to create an TestNG.XML file and document it so that I can run each test case (method) separately and get results accordingly.

I reviewed the documentation, but still confused.

Please help,
Kumar

--
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/-/wjV8pzq9aa0J.
To post to this group, send email to [hidden email].
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.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email].
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.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email].
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.

--
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/-/ffeI8RKm4qUJ.
To post to this group, send email to [hidden email].
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.

--
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/-/-outl5Jscd4J.
To post to this group, send email to [hidden email].
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.

--
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/-/9ZcMzEPaoREJ.

To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.
Reply | Threaded
Open this post in threaded view
|

Re: Confusion With Creating TestNG.XML

youralok@gmail.com
Still same issue; here is the new xml code:
(First class name is "Login" and next class name is "CreateSurvey")

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Survey Manager Smoke Test" >
<test name="Login To the Account">
<classes>
<class name="Login/SurveyManager/src/SM_SmokeTest/SmallTests.java"/>
</classes>
</test>
<test name="Create Survey">
<classes>
<class name="CreateSurvey/SurveyManager/src/SM_SmokeTest/SmallTests.java"/>
</classes>
</test>
</suite> 

Thanks,
Kumar.


On Monday, September 3, 2012 6:03:08 PM UTC+5:30, Krishnan wrote:
You would need to give the fully qualified package path of "SmallTests" in your suite file.
The easiest way of doing this is to right click your class, and choose "Copy qualified name" if you were using eclipse.

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"



On Mon, Sep 3, 2012 at 6:01 PM, Kumar <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="ZzGbwC6eBNQJ">your...@...> wrote:
If you feel that is correct and fine, then its a good news for me.

I tried to run the same code using .XML file, but it is giving following error:
"Cannot find class in classpath: Login.SmallTests.SM_SmokeTest".

Here is my .XML code for two classes:

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

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">

<suite name="Survey Manager Smoke Test" >

<test name="Login To the Account">

<classes>

<class name="Login.SmallTests.SM_SmokeTest"/>

</classes>

</test>

<test name="Create Survey">

<classes>

<class name="CreateSurvey.SmallTests.SM_SmokeTest"/>

</classes>

</test>

</suite> 


Thanks,
Kumar.

On Monday, September 3, 2012 5:58:11 PM UTC+5:30, Krishnan wrote:
So what is the issue here ?

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"



On Mon, Sep 3, 2012 at 5:57 PM, Kumar <[hidden email]> wrote:
Here is the java code that I have (Per your suggestion, I have removed method dependency as we can maintain the order in .XML file):

public class SmallTests {

public WebDriver loginpage = new FirefoxDriver();
public WebDriverWait waitforobjecttoload = new WebDriverWait(loginpage, 100);

public class Login
{
@Test
public Login() throws InterruptedException
{
*****
}

public class CreateSurvey
{
@Test

public CreateSurvey() throws InterruptedException
{
*****
}

public class ChangesInProperties
{
@Test
public ChangesInProperties() throws InterruptedException
{
*****
}

public class TextBlock
{
@Test
public TextBlock() throws InterruptedException
{
*****
}
}

Thanks,
Kumar.

On Monday, September 3, 2012 5:35:17 PM UTC+5:30, Krishnan wrote:
You would need to show some code as well as your TestNG suite file for me or anyone else to comment further.

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"



On Mon, Sep 3, 2012 at 5:20 PM, Kumar <[hidden email]> wrote:
Ok Krishnan, let me try that and get back to you if needed.

I just tried add public class and move method inside it (with @Test annotation) for a few methods and try to run it, but its doing nothing.
What could be the cause?

Thanks,
Kumar.

On Monday, September 3, 2012 5:15:07 PM UTC+5:30, Krishnan wrote:
The approach is still the same. 

So if you have more than one test classes with each test class having 1 @Test annotated method, then you would basically list out each of them using the 

<class name=""> tag and then work with it.

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"



On Mon, Sep 3, 2012 at 5:13 PM, Alok Agarwal <[hidden email]> wrote:
Thanks Krishnan, but my confusion is not with dependent methods.
I am able to run my tests without any problem when I have one public class and many methods in it.

But, I want to invoke the run in an .xml file and thus confused on how to start?
Can I create a new class for each method, remove dependency and then call them from through .xml file?

(If you can share a long test suite with multiple classes and methods might help me.)

Thanks,
Kumar.

On Mon, Sep 3, 2012 at 5:08 PM, Krishnan Mahadevan <krishnan.ma...@gmail.com> wrote:
AFAIK I don't think you can execute @Test annotated methods independently when they are depending upon some other @Test annotated method.

Have you tried using preserve-order tag and using it in conjunction with <include> tag? Would that help ?

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Suite" parallel="methods">
<test name="Test" preserve-order="true">
<classes>
<class name="testng.samples.DemoTest">
<methods>
<include name="f"></include>
<include name="foo"></include>
<include name="bar"></include>
</methods>
</class>

</classes>
</test> <!-- Test -->
</suite> <!-- Suite -->



Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"



On Mon, Sep 3, 2012 at 4:56 PM, Kumar <[hidden email]> wrote:
Hi,

I have written my code in Java Language for selenium webdriver tests.

In my code, I have one public class and multiple methods. Each method is dependent on previous method, so I have dependency as well.
My each method is a test case as well.

However, I want to create an TestNG.XML file and document it so that I can run each test case (method) separately and get results accordingly.

I reviewed the documentation, but still confused.

Please help,
Kumar

--
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/-/wjV8pzq9aa0J.
To post to this group, send email to [hidden email].
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.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email].
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.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email].
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.

--
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/-/ffeI8RKm4qUJ.
To post to this group, send email to [hidden email].
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.

--
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/-/-outl5Jscd4J.
To post to this group, send email to [hidden email].
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.

--
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/-/9ZcMzEPaoREJ.

To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="ZzGbwC6eBNQJ">testng...@....
To unsubscribe from this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="ZzGbwC6eBNQJ">testng-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.

--
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/-/qs7ysQUIvhIJ.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.
Reply | Threaded
Open this post in threaded view
|

Re: Confusion With Creating TestNG.XML

Krishnan Mahadevan
Please change :

<class name="Login/SurveyManager/src/SM_SmokeTest/SmallTests.java"/>

to

the package name that you declared in your .java class.

So suppose your SmallTests.java looks like below :

package com.tests.myTests;

public class SmallTests{

}

then you would refer to it as <class name="com.tests.myTests.SmallTests"/>


Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"



On Mon, Sep 3, 2012 at 6:08 PM, Kumar <[hidden email]> wrote:
Still same issue; here is the new xml code:
(First class name is "Login" and next class name is "CreateSurvey")

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Survey Manager Smoke Test" >
<test name="Login To the Account">
<classes>
<class name="Login/SurveyManager/src/SM_SmokeTest/SmallTests.java"/>
</classes>
</test>
<test name="Create Survey">
<classes>
<class name="CreateSurvey/SurveyManager/src/SM_SmokeTest/SmallTests.java"/>
</classes>
</test>
</suite> 

Thanks,
Kumar.


On Monday, September 3, 2012 6:03:08 PM UTC+5:30, Krishnan wrote:
You would need to give the fully qualified package path of "SmallTests" in your suite file.
The easiest way of doing this is to right click your class, and choose "Copy qualified name" if you were using eclipse.

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"



On Mon, Sep 3, 2012 at 6:01 PM, Kumar <[hidden email]> wrote:
If you feel that is correct and fine, then its a good news for me.

I tried to run the same code using .XML file, but it is giving following error:
"Cannot find class in classpath: Login.SmallTests.SM_SmokeTest".

Here is my .XML code for two classes:

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

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">

<suite name="Survey Manager Smoke Test" >

<test name="Login To the Account">

<classes>

<class name="Login.SmallTests.SM_SmokeTest"/>

</classes>

</test>

<test name="Create Survey">

<classes>

<class name="CreateSurvey.SmallTests.SM_SmokeTest"/>

</classes>

</test>

</suite> 


Thanks,
Kumar.

On Monday, September 3, 2012 5:58:11 PM UTC+5:30, Krishnan wrote:
So what is the issue here ?

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"



On Mon, Sep 3, 2012 at 5:57 PM, Kumar <[hidden email]> wrote:
Here is the java code that I have (Per your suggestion, I have removed method dependency as we can maintain the order in .XML file):

public class SmallTests {

public WebDriver loginpage = new FirefoxDriver();
public WebDriverWait waitforobjecttoload = new WebDriverWait(loginpage, 100);

public class Login
{
@Test
public Login() throws InterruptedException
{
*****
}

public class CreateSurvey
{
@Test

public CreateSurvey() throws InterruptedException
{
*****
}

public class ChangesInProperties
{
@Test
public ChangesInProperties() throws InterruptedException
{
*****
}

public class TextBlock
{
@Test
public TextBlock() throws InterruptedException
{
*****
}
}

Thanks,
Kumar.

On Monday, September 3, 2012 5:35:17 PM UTC+5:30, Krishnan wrote:
You would need to show some code as well as your TestNG suite file for me or anyone else to comment further.

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"



On Mon, Sep 3, 2012 at 5:20 PM, Kumar <[hidden email]> wrote:
Ok Krishnan, let me try that and get back to you if needed.

I just tried add public class and move method inside it (with @Test annotation) for a few methods and try to run it, but its doing nothing.
What could be the cause?

Thanks,
Kumar.

On Monday, September 3, 2012 5:15:07 PM UTC+5:30, Krishnan wrote:
The approach is still the same. 

So if you have more than one test classes with each test class having 1 @Test annotated method, then you would basically list out each of them using the 

<class name=""> tag and then work with it.

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"



On Mon, Sep 3, 2012 at 5:13 PM, Alok Agarwal <[hidden email]> wrote:
Thanks Krishnan, but my confusion is not with dependent methods.
I am able to run my tests without any problem when I have one public class and many methods in it.

But, I want to invoke the run in an .xml file and thus confused on how to start?
Can I create a new class for each method, remove dependency and then call them from through .xml file?

(If you can share a long test suite with multiple classes and methods might help me.)

Thanks,
Kumar.

On Mon, Sep 3, 2012 at 5:08 PM, Krishnan Mahadevan <krishnan.ma...@gmail.com> wrote:
AFAIK I don't think you can execute @Test annotated methods independently when they are depending upon some other @Test annotated method.

Have you tried using preserve-order tag and using it in conjunction with <include> tag? Would that help ?

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Suite" parallel="methods">
<test name="Test" preserve-order="true">
<classes>
<class name="testng.samples.DemoTest">
<methods>
<include name="f"></include>
<include name="foo"></include>
<include name="bar"></include>
</methods>
</class>

</classes>
</test> <!-- Test -->
</suite> <!-- Suite -->



Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"



On Mon, Sep 3, 2012 at 4:56 PM, Kumar <[hidden email]> wrote:
Hi,

I have written my code in Java Language for selenium webdriver tests.

In my code, I have one public class and multiple methods. Each method is dependent on previous method, so I have dependency as well.
My each method is a test case as well.

However, I want to create an TestNG.XML file and document it so that I can run each test case (method) separately and get results accordingly.

I reviewed the documentation, but still confused.

Please help,
Kumar

--
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/-/wjV8pzq9aa0J.
To post to this group, send email to [hidden email].
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.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email].
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.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email].
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.

--
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/-/ffeI8RKm4qUJ.
To post to this group, send email to [hidden email].
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.

--
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/-/-outl5Jscd4J.
To post to this group, send email to [hidden email].
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.

--
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/-/9ZcMzEPaoREJ.

To post to this group, send email to [hidden email].
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.

--
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/-/qs7ysQUIvhIJ.

To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.
Reply | Threaded
Open this post in threaded view
|

Re: Confusion With Creating TestNG.XML

youralok@gmail.com
Thanks Krishnan, it seems to have worked if I use the outermost public class in the path. <class name="SM_SmokeTest.SmallTests"/>.

But as shown earlier my program pattern, I have inner classes (one each for a method/test case). How do I run for inner classes?
I tried with <class name="SM_SmokeTest.SmallTests.Login"/>, but it didnt work.

I want to run each inner class separately and get its result appropriately in TestNG.

See below:

public class SmallTests {

public WebDriver loginpage = new FirefoxDriver();
public WebDriverWait waitforobjecttoload = new WebDriverWait(loginpage, 100);

public class Login
{
@Test
public Login() throws InterruptedException
{
*****
}

public class CreateSurvey
{
@Test

public CreateSurvey() throws InterruptedException
{
*****
}

public class ChangesInProperties
{
@Test
public ChangesInProperties() throws InterruptedException
{
*****
}

public class TextBlock
{
@Test
public TextBlock() throws InterruptedException
{
*****
}
}

Thanks,
Kumar

On Monday, September 3, 2012 6:11:01 PM UTC+5:30, Krishnan wrote:
Please change :

<class name="Login/SurveyManager/src/SM_SmokeTest/SmallTests.java"/>

to

the package name that you declared in your .java class.

So suppose your SmallTests.java looks like below :

package com.tests.myTests;

public class SmallTests{

}

then you would refer to it as <class name="com.tests.myTests.SmallTests"/>


Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"



On Mon, Sep 3, 2012 at 6:08 PM, Kumar <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="AdfYwiGkNo8J">your...@...> wrote:
Still same issue; here is the new xml code:
(First class name is "Login" and next class name is "CreateSurvey")

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Survey Manager Smoke Test" >
<test name="Login To the Account">
<classes>
<class name="Login/SurveyManager/src/SM_SmokeTest/SmallTests.java"/>
</classes>
</test>
<test name="Create Survey">
<classes>
<class name="CreateSurvey/SurveyManager/src/SM_SmokeTest/SmallTests.java"/>
</classes>
</test>
</suite> 

Thanks,
Kumar.


On Monday, September 3, 2012 6:03:08 PM UTC+5:30, Krishnan wrote:
You would need to give the fully qualified package path of "SmallTests" in your suite file.
The easiest way of doing this is to right click your class, and choose "Copy qualified name" if you were using eclipse.

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"



On Mon, Sep 3, 2012 at 6:01 PM, Kumar <[hidden email]> wrote:
If you feel that is correct and fine, then its a good news for me.

I tried to run the same code using .XML file, but it is giving following error:
"Cannot find class in classpath: Login.SmallTests.SM_SmokeTest".

Here is my .XML code for two classes:

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

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">

<suite name="Survey Manager Smoke Test" >

<test name="Login To the Account">

<classes>

<class name="Login.SmallTests.SM_SmokeTest"/>

</classes>

</test>

<test name="Create Survey">

<classes>

<class name="CreateSurvey.SmallTests.SM_SmokeTest"/>

</classes>

</test>

</suite> 


Thanks,
Kumar.

On Monday, September 3, 2012 5:58:11 PM UTC+5:30, Krishnan wrote:
So what is the issue here ?

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"



On Mon, Sep 3, 2012 at 5:57 PM, Kumar <[hidden email]> wrote:
Here is the java code that I have (Per your suggestion, I have removed method dependency as we can maintain the order in .XML file):

public class SmallTests {

public WebDriver loginpage = new FirefoxDriver();
public WebDriverWait waitforobjecttoload = new WebDriverWait(loginpage, 100);

public class Login
{
@Test
public Login() throws InterruptedException
{
*****
}

public class CreateSurvey
{
@Test

public CreateSurvey() throws InterruptedException
{
*****
}

public class ChangesInProperties
{
@Test
public ChangesInProperties() throws InterruptedException
{
*****
}

public class TextBlock
{
@Test
public TextBlock() throws InterruptedException
{
*****
}
}

Thanks,
Kumar.

On Monday, September 3, 2012 5:35:17 PM UTC+5:30, Krishnan wrote:
You would need to show some code as well as your TestNG suite file for me or anyone else to comment further.

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"



On Mon, Sep 3, 2012 at 5:20 PM, Kumar <[hidden email]> wrote:
Ok Krishnan, let me try that and get back to you if needed.

I just tried add public class and move method inside it (with @Test annotation) for a few methods and try to run it, but its doing nothing.
What could be the cause?

Thanks,
Kumar.

On Monday, September 3, 2012 5:15:07 PM UTC+5:30, Krishnan wrote:
The approach is still the same. 

So if you have more than one test classes with each test class having 1 @Test annotated method, then you would basically list out each of them using the 

<class name=""> tag and then work with it.

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"



On Mon, Sep 3, 2012 at 5:13 PM, Alok Agarwal <[hidden email]> wrote:
Thanks Krishnan, but my confusion is not with dependent methods.
I am able to run my tests without any problem when I have one public class and many methods in it.

But, I want to invoke the run in an .xml file and thus confused on how to start?
Can I create a new class for each method, remove dependency and then call them from through .xml file?

(If you can share a long test suite with multiple classes and methods might help me.)

Thanks,
Kumar.

On Mon, Sep 3, 2012 at 5:08 PM, Krishnan Mahadevan <krishnan.ma...@gmail.com> wrote:
AFAIK I don't think you can execute @Test annotated methods independently when they are depending upon some other @Test annotated method.

Have you tried using preserve-order tag and using it in conjunction with <include> tag? Would that help ?

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Suite" parallel="methods">
<test name="Test" preserve-order="true">
<classes>
<class name="testng.samples.DemoTest">
<methods>
<include name="f"></include>
<include name="foo"></include>
<include name="bar"></include>
</methods>
</class>

</classes>
</test> <!-- Test -->
</suite> <!-- Suite -->



Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"



On Mon, Sep 3, 2012 at 4:56 PM, Kumar <[hidden email]> wrote:
Hi,

I have written my code in Java Language for selenium webdriver tests.

In my code, I have one public class and multiple methods. Each method is dependent on previous method, so I have dependency as well.
My each method is a test case as well.

However, I want to create an TestNG.XML file and document it so that I can run each test case (method) separately and get results accordingly.

I reviewed the documentation, but still confused.

Please help,
Kumar

--
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/-/wjV8pzq9aa0J.
To post to this group, send email to [hidden email].
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.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email].
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.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email].
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.

--
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/-/ffeI8RKm4qUJ.
To post to this group, send email to [hidden email].
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.

--
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/-/-outl5Jscd4J.
To post to this group, send email to [hidden email].
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.

--
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/-/9ZcMzEPaoREJ.

To post to this group, send email to [hidden email].
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.

--
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/-/qs7ysQUIvhIJ.

To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="AdfYwiGkNo8J">testng...@....
To unsubscribe from this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="AdfYwiGkNo8J">testng-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.

--
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/-/P9su5MaJ0TMJ.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.
Reply | Threaded
Open this post in threaded view
|

Re: Confusion With Creating TestNG.XML

Abraham Lin
If I remember correctly, TestNG (and pretty much any other XML-based configuration engine) expects a binary name, so you'd specify the inner class as "SM_SmokeTest.SmallTests$Login".

-Abraham


On Mon, Sep 3, 2012 at 9:12 AM, Kumar <[hidden email]> wrote:
Thanks Krishnan, it seems to have worked if I use the outermost public class in the path. <class name="SM_SmokeTest.SmallTests"/>.

But as shown earlier my program pattern, I have inner classes (one each for a method/test case). How do I run for inner classes?
I tried with <class name="SM_SmokeTest.SmallTests.Login"/>, but it didnt work.

I want to run each inner class separately and get its result appropriately in TestNG.

See below:

public class SmallTests {

public WebDriver loginpage = new FirefoxDriver();
public WebDriverWait waitforobjecttoload = new WebDriverWait(loginpage, 100);

public class Login
{
@Test
public Login() throws InterruptedException
{
*****
}

public class CreateSurvey
{
@Test

public CreateSurvey() throws InterruptedException
{
*****
}

public class ChangesInProperties
{
@Test
public ChangesInProperties() throws InterruptedException
{
*****
}

public class TextBlock
{
@Test
public TextBlock() throws InterruptedException
{
*****
}
}

Thanks,
Kumar


On Monday, September 3, 2012 6:11:01 PM UTC+5:30, Krishnan wrote:
Please change :

<class name="Login/SurveyManager/src/SM_SmokeTest/SmallTests.java"/>

to

the package name that you declared in your .java class.

So suppose your SmallTests.java looks like below :

package com.tests.myTests;

public class SmallTests{

}

then you would refer to it as <class name="com.tests.myTests.SmallTests"/>


Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"



On Mon, Sep 3, 2012 at 6:08 PM, Kumar <[hidden email]> wrote:
Still same issue; here is the new xml code:
(First class name is "Login" and next class name is "CreateSurvey")

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Survey Manager Smoke Test" >
<test name="Login To the Account">
<classes>
<class name="Login/SurveyManager/src/SM_SmokeTest/SmallTests.java"/>
</classes>
</test>
<test name="Create Survey">
<classes>
<class name="CreateSurvey/SurveyManager/src/SM_SmokeTest/SmallTests.java"/>
</classes>
</test>
</suite> 

Thanks,
Kumar.


On Monday, September 3, 2012 6:03:08 PM UTC+5:30, Krishnan wrote:
You would need to give the fully qualified package path of "SmallTests" in your suite file.
The easiest way of doing this is to right click your class, and choose "Copy qualified name" if you were using eclipse.

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"



On Mon, Sep 3, 2012 at 6:01 PM, Kumar <[hidden email]> wrote:
If you feel that is correct and fine, then its a good news for me.

I tried to run the same code using .XML file, but it is giving following error:
"Cannot find class in classpath: Login.SmallTests.SM_SmokeTest".

Here is my .XML code for two classes:

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

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">

<suite name="Survey Manager Smoke Test" >

<test name="Login To the Account">

<classes>

<class name="Login.SmallTests.SM_SmokeTest"/>

</classes>

</test>

<test name="Create Survey">

<classes>

<class name="CreateSurvey.SmallTests.SM_SmokeTest"/>

</classes>

</test>

</suite> 


Thanks,
Kumar.

On Monday, September 3, 2012 5:58:11 PM UTC+5:30, Krishnan wrote:
So what is the issue here ?

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"



On Mon, Sep 3, 2012 at 5:57 PM, Kumar <[hidden email]> wrote:
Here is the java code that I have (Per your suggestion, I have removed method dependency as we can maintain the order in .XML file):

public class SmallTests {

public WebDriver loginpage = new FirefoxDriver();
public WebDriverWait waitforobjecttoload = new WebDriverWait(loginpage, 100);

public class Login
{
@Test
public Login() throws InterruptedException
{
*****
}

public class CreateSurvey
{
@Test

public CreateSurvey() throws InterruptedException
{
*****
}

public class ChangesInProperties
{
@Test
public ChangesInProperties() throws InterruptedException
{
*****
}

public class TextBlock
{
@Test
public TextBlock() throws InterruptedException
{
*****
}
}

Thanks,
Kumar.

On Monday, September 3, 2012 5:35:17 PM UTC+5:30, Krishnan wrote:
You would need to show some code as well as your TestNG suite file for me or anyone else to comment further.

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"



On Mon, Sep 3, 2012 at 5:20 PM, Kumar <[hidden email]> wrote:
Ok Krishnan, let me try that and get back to you if needed.

I just tried add public class and move method inside it (with @Test annotation) for a few methods and try to run it, but its doing nothing.
What could be the cause?

Thanks,
Kumar.

On Monday, September 3, 2012 5:15:07 PM UTC+5:30, Krishnan wrote:
The approach is still the same. 

So if you have more than one test classes with each test class having 1 @Test annotated method, then you would basically list out each of them using the 

<class name=""> tag and then work with it.

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"



On Mon, Sep 3, 2012 at 5:13 PM, Alok Agarwal <[hidden email]> wrote:
Thanks Krishnan, but my confusion is not with dependent methods.
I am able to run my tests without any problem when I have one public class and many methods in it.

But, I want to invoke the run in an .xml file and thus confused on how to start?
Can I create a new class for each method, remove dependency and then call them from through .xml file?

(If you can share a long test suite with multiple classes and methods might help me.)

Thanks,
Kumar.

On Mon, Sep 3, 2012 at 5:08 PM, Krishnan Mahadevan <krishnan.ma...@gmail.com> wrote:
AFAIK I don't think you can execute @Test annotated methods independently when they are depending upon some other @Test annotated method.

Have you tried using preserve-order tag and using it in conjunction with <include> tag? Would that help ?

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Suite" parallel="methods">
<test name="Test" preserve-order="true">
<classes>
<class name="testng.samples.DemoTest">
<methods>
<include name="f"></include>
<include name="foo"></include>
<include name="bar"></include>
</methods>
</class>

</classes>
</test> <!-- Test -->
</suite> <!-- Suite -->



Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"



On Mon, Sep 3, 2012 at 4:56 PM, Kumar <[hidden email]> wrote:
Hi,

I have written my code in Java Language for selenium webdriver tests.

In my code, I have one public class and multiple methods. Each method is dependent on previous method, so I have dependency as well.
My each method is a test case as well.

However, I want to create an TestNG.XML file and document it so that I can run each test case (method) separately and get results accordingly.

I reviewed the documentation, but still confused.

Please help,
Kumar

--
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/-/wjV8pzq9aa0J.
To post to this group, send email to [hidden email].
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.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email].
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.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email].
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.

--
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/-/ffeI8RKm4qUJ.
To post to this group, send email to [hidden email].
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.

--
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/-/-outl5Jscd4J.
To post to this group, send email to [hidden email].
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.

--
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/-/9ZcMzEPaoREJ.

To post to this group, send email to [hidden email].
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.

--
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/-/qs7ysQUIvhIJ.

To post to this group, send email to [hidden email].
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.

--
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/-/P9su5MaJ0TMJ.

To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.
Reply | Threaded
Open this post in threaded view
|

Re: Confusion With Creating TestNG.XML

youralok@gmail.com
In reply to this post by youralok@gmail.com
I created a different classes instead of having inner classes.
Now, in the test suite, when I try to run the classes in a sequential manner in same window, it opens a new window after successfully running first class.
How can I make sure that it doesn't happen.

Basically, it need to login to the account (first class) and perform more tasks (further classes) in the same window instead of opening a new window for each class.

Thanks,
Kumar.

On Monday, September 3, 2012 4:56:22 PM UTC+5:30, Kumar wrote:
Hi,

I have written my code in Java Language for selenium webdriver tests.

In my code, I have one public class and multiple methods. Each method is dependent on previous method, so I have dependency as well.
My each method is a test case as well.

However, I want to create an TestNG.XML file and document it so that I can run each test case (method) separately and get results accordingly.

I reviewed the documentation, but still confused.

Please help,
Kumar

--
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/-/ytN1wa41hJYJ.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.
Reply | Threaded
Open this post in threaded view
|

Re: Confusion With Creating TestNG.XML

youralok@gmail.com
Any help on this please?

On Mon, Sep 3, 2012 at 7:36 PM, Kumar <[hidden email]> wrote:
I created a different classes instead of having inner classes.
Now, in the test suite, when I try to run the classes in a sequential manner in same window, it opens a new window after successfully running first class.
How can I make sure that it doesn't happen.

Basically, it need to login to the account (first class) and perform more tasks (further classes) in the same window instead of opening a new window for each class.

Thanks,
Kumar.


On Monday, September 3, 2012 4:56:22 PM UTC+5:30, Kumar wrote:
Hi,

I have written my code in Java Language for selenium webdriver tests.

In my code, I have one public class and multiple methods. Each method is dependent on previous method, so I have dependency as well.
My each method is a test case as well.

However, I want to create an TestNG.XML file and document it so that I can run each test case (method) separately and get results accordingly.

I reviewed the documentation, but still confused.

Please help,
Kumar

--
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/-/ytN1wa41hJYJ.

To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.
Reply | Threaded
Open this post in threaded view
|

Re: Confusion With Creating TestNG.XML

Yevhen Bilevych
Kumar,

Strictly saying, your question is not related to TestNG. It's stuff of Selenium, which is third-party. I'd recommend you to read documentation on Selenium Webdriver. There, you could find method WebDriver.quit(), which does what you need.

Thanks,
Yevhen 

Sent from my BlackBerry® PlayBook™
www.blackberry.com


From: "Alok Agarwal" <[hidden email]>
To: "[hidden email]" <[hidden email]>
Sent: September 3, 2012 8:11 PM
Subject: Re: [testng-users] Re: Confusion With Creating TestNG.XML

Any help on this please?

On Mon, Sep 3, 2012 at 7:36 PM, Kumar <[hidden email]> wrote:
I created a different classes instead of having inner classes.
Now, in the test suite, when I try to run the classes in a sequential manner in same window, it opens a new window after successfully running first class.
How can I make sure that it doesn't happen.

Basically, it need to login to the account (first class) and perform more tasks (further classes) in the same window instead of opening a new window for each class.

Thanks,
Kumar.


On Monday, September 3, 2012 4:56:22 PM UTC+5:30, Kumar wrote:
Hi,

I have written my code in Java Language for selenium webdriver tests.

In my code, I have one public class and multiple methods. Each method is dependent on previous method, so I have dependency as well.
My each method is a test case as well.

However, I want to create an TestNG.XML file and document it so that I can run each test case (method) separately and get results accordingly.

I reviewed the documentation, but still confused.

Please help,
Kumar

--
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/-/ytN1wa41hJYJ.

To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.
Reply | Threaded
Open this post in threaded view
|

Re: Confusion With Creating TestNG.XML

Krishnan Mahadevan
I will have to second Yevhen on that. Until now your query was related to TestNG. But your test openig up multiple instances of browser for each test is NOT TestNG related. Please post this on the selenium-users forum. 

That being said your test seems to create a FirefoxDriver instance for each test class which probably is the reason. 

There are multiple ways of dealing with this. 

1. Having a common base class, instantiating it in a BeforeSuite/BeforeTest. 
2.  Creating the Webdriver instance in a singleton and then just using it in all your tests.  
3.  Creating the webdriver in a separate class via listener invocation and using it. 

Its upto you on how you want to use it. To begin with I suggest that you please spend sometime playing around with TestNG and use ordinary ovjects and see how things can be shared/re-used in your tests. 

On Tuesday, September 4, 2012, Yevhen Bilevych wrote:
Kumar,

Strictly saying, your question is not related to TestNG. It's stuff of Selenium, which is third-party. I'd recommend you to read documentation on Selenium Webdriver. There, you could find method WebDriver.quit(), which does what you need.

Thanks,
Yevhen 

Sent from my BlackBerry® PlayBook™
www.blackberry.com


From: "Alok Agarwal" <<a href="javascript:_e({}, &#39;cvml&#39;, &#39;youralok@gmail.com&#39;);" target="_blank">youralok@...>
To: "<a href="javascript:_e({}, &#39;cvml&#39;, &#39;testng-users@googlegroups.com&#39;);" target="_blank">testng-users@..." <<a href="javascript:_e({}, &#39;cvml&#39;, &#39;testng-users@googlegroups.com&#39;);" target="_blank">testng-users@...>
Sent: September 3, 2012 8:11 PM
Subject: Re: [testng-users] Re: Confusion With Creating TestNG.XML

Any help on this please?

On Mon, Sep 3, 2012 at 7:36 PM, Kumar <<a href="javascript:_e({}, &#39;cvml&#39;, &#39;youralok@gmail.com&#39;);" target="_blank">youralok@...> wrote:
I created a different classes instead of having inner classes.
Now, in the test suite, when I try to run the classes in a sequential manner in same window, it opens a new window after successfully running first class.
How can I make sure that it doesn't happen.

Basically, it need to login to the account (first class) and perform more tasks (further classes) in the same window instead of opening a new window for each class.

Thanks,
Kumar.


On Monday, September 3, 2012 4:56:22 PM UTC+5:30, Kumar wrote:
Hi,

I have written my code in Java Language for selenium webdriver tests.

In my code, I have one public class and multiple methods. Each method is dependent on previous method, so I have dependency as well.
My each method is a test case as well.

However, I want to create an TestNG.XML file and document it so that I can run each test case (method) separately and get results accordingly.

I reviewed the documentation, but still confused.

Please help,
Kumar

--
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/-/ytN1wa41hJYJ.

To post to this group, send email to <a href="javascript:_e({}, &#39;cvml&#39;, &#39;testng-users@googlegroups.com&#39;);" target="_blank">testng-users@....
To unsubscribe from this group, send email to <a href="javascript:_e({}, &#39;cvml&#39;, &#39;testng-users%2Bunsubscribe@googlegroups.com&#39;);" target="_blank">testng-users+unsubscribe@....
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to <a href="javascript:_e({}, &#39;cvml&#39;, &#39;testng-users@googlegroups.com&#39;);" target="_blank">testng-users@....
To unsubscribe from this group, send email to <a href="javascript:_e({}, &#39;cvml&#39;, &#39;testng-users%2Bunsubscribe@googlegroups.com&#39;);" target="_blank">testng-users+unsubscribe@....
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to <a href="javascript:_e({}, &#39;cvml&#39;, &#39;testng-users@googlegroups.com&#39;);" target="_blank">testng-users@....
To unsubscribe from this group, send email to <a href="javascript:_e({}, &#39;cvml&#39;, &#39;testng-users%2Bunsubscribe@googlegroups.com&#39;);" target="_blank">testng-users+unsubscribe@....
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.


--
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/

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.