Isomorphic,
We want to go the selenium way for testing the UI code. We want to be able to use selenium to maintain test suites which would be integrated into maven for code coverage and other purposes. I have read through the selenium documentation present in the smartgwt docs. Also read through the basics from Selenium website.
As per selenium docs, there are two approaches, the older RC way and the new WebDriver way. Which one would best support SmartGWT. Also I have read some of the threads where people were discussing that scLocator generated by smartgwt is not consistent and would require us to use unique ID's(by SetID()) for components to be able to locate them.
I followed the instruction given in the selenium document in smartgwt docs. I was able to simulate a test using selenium IDE which runs fine. But when I export the test to JUnit4 webdriver class, the resulting java class created has nothing but the first line which would open the url being tested and others as errors:
We havent used selenium before, can you point us in the right direction which would best suit our needs to be able to integrate selenium tests in to maven and generate code metrics etc.
Also any samples (could be of the showcase project you guys have) would be helpful.
Thanks.
We want to go the selenium way for testing the UI code. We want to be able to use selenium to maintain test suites which would be integrated into maven for code coverage and other purposes. I have read through the selenium documentation present in the smartgwt docs. Also read through the basics from Selenium website.
As per selenium docs, there are two approaches, the older RC way and the new WebDriver way. Which one would best support SmartGWT. Also I have read some of the threads where people were discussing that scLocator generated by smartgwt is not consistent and would require us to use unique ID's(by SetID()) for components to be able to locate them.
I followed the instruction given in the selenium document in smartgwt docs. I was able to simulate a test using selenium IDE which runs fine. But when I export the test to JUnit4 webdriver class, the resulting java class created has nothing but the first line which would open the url being tested and others as errors:
Code:
package com.example.tests; import java.util.regex.Pattern; import java.util.concurrent.TimeUnit; import org.junit.*; import static org.junit.Assert.*; import static org.hamcrest.CoreMatchers.*; import org.openqa.selenium.*; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.support.ui.Select; public class Seleniumtestcase { private WebDriver driver; private String baseUrl; private StringBuffer verificationErrors = new StringBuffer(); @Before public void setUp() throws Exception { driver = new FirefoxDriver(); baseUrl = "http://127.0.0.1:8888/"; driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); } @Test public void testSeleniumtestcase() throws Exception { driver.get(baseUrl + "/MarketIntelligence.html?gwt.codesvr=127.0.0.1:9997#OD"); // ERROR: Caught exception [Error: unknown strategy [sclocator] for locator [scLocator=//TabSet[ID="isc_Report_0"]/paneContainer/]] // ERROR: Caught exception [Error: unknown strategy [sclocator] for locator [scLocator=//DynamicForm[ID="isc_MarketCriteria_0"]/item[name=originType||title=Origin||value=Airport||index=0||Class=SelectItem]/[icon='picker']]] // ERROR: Caught exception [Error: unknown strategy [sclocator] for locator [scLocator=//DynamicForm[ID="isc_MarketCriteria_0"]/item[name=originType||title=Origin||value=Airport||index=0||Class=SelectItem]/pickList/body/row[originType=Domestic||5]/col[fieldName=originType||0]]] // ERROR: Caught exception [Error: unknown strategy [sclocator] for locator [scLocator=//DynamicForm[ID="isc_MarketCriteria_0"]/item[name=originType||title=Origin||value=Domestic||index=0||Class=SelectItem]/[icon='picker']]] // ERROR: Caught exception [Error: unknown strategy [sclocator] for locator [scLocator=//DynamicForm[ID="isc_MarketCriteria_0"]/item[name=originType||title=Origin||value=Domestic||index=0||Class=SelectItem]/pickList/body/row[originType=International||6]/col[fieldName=originType||0]]] // ERROR: Caught exception [Error: unknown strategy [sclocator] for locator [scLocator=//DynamicForm[ID="isc_MarketCriteria_0"]/item[name=destinationType||title=Destination||value=Airport||index=3||Class=SelectItem]/[icon='picker']]] // ERROR: Caught exception [Error: unknown strategy [sclocator] for locator [scLocator=//DynamicForm[ID="isc_MarketCriteria_0"]/item[name=destinationType||title=Destination||value=Airport||index=3||Class=SelectItem]/textbox]] // ERROR: Caught exception [Error: unknown strategy [sclocator] for locator [scLocator=//TabSet[ID="isc_Report_0"]/paneContainer/]] } @After public void tearDown() throws Exception { driver.quit(); String verificationErrorString = verificationErrors.toString(); if (!"".equals(verificationErrorString)) { fail(verificationErrorString); } } private boolean isElementPresent(By by) { try { driver.findElement(by); return true; } catch (NoSuchElementException e) { return false; } } }
We havent used selenium before, can you point us in the right direction which would best suit our needs to be able to integrate selenium tests in to maven and generate code metrics etc.
Also any samples (could be of the showcase project you guys have) would be helpful.
Thanks.
Comment