Dheepha
11 years agoContributor
Groovy script to call multiple java class/code in selenium
Hi,
I would like to know from groovy test script how do i call multiple java classes/codes.
I'm integrating SOAPUI with selenium via groovy and I achieved it just by placing the Selenium Standalone server in eviware/bin/ext folder.
1. I have written a code in java - selenium and executed using selenium Test NG in eclipse
2. Added the java code(converted into groovy) and placed in soapui and executed. It worked as expected.
3. Now I have written multiple java codes in eclipse and called all java classes in main java class in eclipse and executed that as well.
4. But how do i do the same step using groovy.
Following is the groovy snippet to login to a website:
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.Test;
WebDriver driver = new FirefoxDriver()
driver.get("http://....");
driver.findElement(By.name("username")).sendKeys("xxx");
driver.findElement(By.name("password")).sendKeys("yyy");
driver.findElement(By.name("go")).click();
driver.quit();
Now say eg: if i write the login script is Test1.java and Customer Search in Test2.java
I'm calling Tes1.java and Test2.java in MainTest.java using eclipse and it worked perfect
Similarly, how do i call multiple java codes in main groovy class.
Thanks,
Dheepha V
I would like to know from groovy test script how do i call multiple java classes/codes.
I'm integrating SOAPUI with selenium via groovy and I achieved it just by placing the Selenium Standalone server in eviware/bin/ext folder.
1. I have written a code in java - selenium and executed using selenium Test NG in eclipse
2. Added the java code(converted into groovy) and placed in soapui and executed. It worked as expected.
3. Now I have written multiple java codes in eclipse and called all java classes in main java class in eclipse and executed that as well.
4. But how do i do the same step using groovy.
Following is the groovy snippet to login to a website:
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.Test;
WebDriver driver = new FirefoxDriver()
driver.get("http://....");
driver.findElement(By.name("username")).sendKeys("xxx");
driver.findElement(By.name("password")).sendKeys("yyy");
driver.findElement(By.name("go")).click();
driver.quit();
Now say eg: if i write the login script is Test1.java and Customer Search in Test2.java
I'm calling Tes1.java and Test2.java in MainTest.java using eclipse and it worked perfect
Similarly, how do i call multiple java codes in main groovy class.
Thanks,
Dheepha V