@BeforeMethod
@Parameters({ "Environment", "userName", "Password" })
public static void main(String Environment, String userName, String Password) {
String service = "D:\\IE Driver\\3.6.0\\IEDriverServer_Win32_3.6.0\\IEDriverServer.exe";
System.setProperty("webdriver.ie.driver", service);
InternetExplorerDriver driver = new InternetExplorerDriver();
driver.get(Environment);
driver.findElement(By.id("username")).sendKeys(userName);
driver.findElement(By.id("password")).sendKeys(Password);
driver.findElement(By.id("submitButton")).click();
}
@Test(dataProvider = "returnTestcaseRow", dependsOnMethods = "Main" )
public static void maintrade(WebDriver driver, String flag, String TestCaseName...multiple columns are in testObjArray){
System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.Jdk14Logger");
EATradeCreation.CreationEATrade(driver,flag, TestCaseName...multiple columns in testObjArray);
// TODO Auto-generated catch block
e.printStackTrace();
}
}
/*
* @Test public static void callScreen(String TestCaseName) throws Exception
* { while(true) { EAScreenshot.captureScreenShot(TestCaseName);
* Thread.sleep(10000); }
*
*
* }
*/
@DataProvider(name = "returnTestcaseRow")
public Object[][] EOT_testcasedata() throws Exception {
Object[][] testObjArray;
testObjArray = EOTdata.getTableArray("D:\\Automation\\EAAUTO\\src\\testData\\EOT_TestData_Updated.xlsx");
return testObjArray;
--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to testng-users+unsubscribe@googlegroups.com.
To post to this group, send email to testng...@googlegroups.com.
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Kritika,
Not sure what you are trying to do again. Please help clarify your use case to start off with. It sounds like you are trying to put things together in a haphazard fashion.
So I am going to re-iterate.
Please help call out what is the use-case you are trying to solve.
That should clarify a lot of things!
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/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/
--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to testng-users...@googlegroups.com.
1) I have one test data excel sheet which will have test data corresponding to test case name
3) I want to make it environment independent ( SIT, UAT ), for that i want to prepate testng.xml and want to give URL/Credentials there as parameter so user will chnage URL/credentials only there not in code.
4) I want to take screenshot of each and everypage and want to store it in mainfolder (Named as todaysdatetimestamp) inside that folder , another folder named as test case name like TC001, TC002 etc. inside TC001 all the screenshots of execution
DATETIMESTAPFOLDER>> Testcasename folder>> screenhsots of particular testcase
You basically should be looking at coupling a Factory with a data provider to get this usecase done.
Here’s a sample
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.ITestContext;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Factory;
import org.testng.annotations.Test;
public class TestClassSample {
private String param1, param2;
private WebDriver driver;
@Factory(dataProvider = "dp")
public TestClassSample(String a, String b) {
this.param1 = a;
this.param2 = b;
}
@BeforeMethod
public void setup(ITestContext context) {
String environment = context.getCurrentXmlTest().getParameter("environment");
String username = context.getCurrentXmlTest().getParameter("username");
String password = context.getCurrentXmlTest().getParameter("password");
driver = new FirefoxDriver();
driver.get(environment);
}
@Test
public void testMethod() {
//Include logic here for the test that works with testData
System.err.println("Test data [" + param1 + ", " + param2 + "]");
}
@AfterMethod
public void cleanup() {
driver.quit();
}
@DataProvider(name = "dp")
public static Object[][] getData() {
return new Object[][]{
{"x", "y"},
{"b", "c"}
};
}
}
Here’s the suite xml :
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="sample_suite" parallel="false" verbose="2">
<test name="test_1" verbose="2">
<parameter name="environment" value="http://www.google.com"/>
<parameter name="username" value="user1"/>
<parameter name="password" value="pass1"/>
<classes>
<class name="com.rationaleemotions.googleforums.kritika.TestClassSample"/>
</classes>
</test>
<test name="test_2" verbose="2">
<parameter name="environment" value="http://www.facebook.com"/>
<parameter name="username" value="user2"/>
<parameter name="password" value="pass2"/>
<classes>
<class name="com.rationaleemotions.googleforums.kritika.TestClassSample"/>
</classes>
</test>
</suite>
PS : If you are not familiar with all these concepts, I would strongly recommend that you please spend time getting yourself familiarized with them, before building a framework using them.
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/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/
From: <testng...@googlegroups.com> on behalf of Kritika Gupta <kritika...@gmail.com>
Reply-To: <testng...@googlegroups.com>
Date: Monday, November 6, 2017 at 11:35 AM
To: testng-users <testng...@googlegroups.com>
--