Contributions
Groovy Script - Junit+selenium
Hi all, I using Junit framework in the groovy script to run my selenium test. before starting the test in selenium, i have to use some details from my xml response (previous test step of my test suite is xml request). Below is my code for the reference:- import junit.framework.*; import com.thoughtworks.selenium.*; import junit.textui.TestRunner; import java.util.*; import com.eviware.soapui.support.*; public class Temp extends TestCase { private Selenium selenium; public Temp(String name) { super(name); } public void setUp() { //some code selenium = new DefaultSelenium( "localhost",4444, "*firefox","www.google.com"); selenium.start(); selenium.setSpeed("2000"); } public static TestSuite suite() { return new TestSuite(Temp.class); } public String GetEmailID() { try { def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context); //Extract data from the SOAP request def HolderResquest = groovyUtils.getXmlHolder( "InsertArticle#Request" ); String sUserName = HolderResquest["//web:InsertArticle/web:Request/User/Name"] ; SoapUI.log.error (sUserName) ; return sUserName; } catch (Exception e) { SoapUI.log.error (e); } } public void test1() { try { String New; SoapUI.log.error ("test Started") ; selenium.open("/"); selenium.windowFocus(); selenium.windowMaximize(); selenium.click("link=search"); selenium.waitForPageToLoad("30000"); New = GetEmailID(); selenium.waitForPageToLoad("30000"); assertTrue(selenium.isElementPresent("ctl00_ctl00_decoratedArea_loginStatus_linkLogout")); } catch (Exception e) { SoapUI.log.error( "TestCase [" + e ); } } public void tearDown() { // some code //selenium.stop(); } } Temp test = new Temp("test1"); TestRunner a = new TestRunner(); TestResult result = a.run(test.suite()); Please have look into the GetEmailID function, this function is not returning the value. Thank you very much for your time Kind regards Vijay15 years agoPlace ReadyAPI QuestionsReadyAPI Questions2.9KViews0likes0CommentsRe: write junit test in groovy script...
Hi, I want to use selenium test integrated to SOAP UI test, can you suggest me some ideas. My requirement is as below 1) do some changes in the web serivce 2) open a browser and check for the corresponding changes in the website for the step 1 i can easily automate with SOAP UI, wheres to check the step 2 which opens the browser and do some testing using selenium can u help me some examples (selenium tests in groovy) Thank you Regards Vijay1.9KViews0likes0Comments