Log in if you have an account.
Otherwise, register for an account.
For more details, please visit the How This Site Works page.
I have a case where in the Login class I want to know which type of browser I am using. What is the mobile server address. What is the version of browser and other settings defined in twist.Properties
I am using the default system web browser instantiated by the twist. Twist version is 2.4.0.12621
Please let me know how to implement this or procedure for the same.
Thanks,
Sarita.

The idea of this post is to demonstrate WebServices testing from Twist. While some of our customers have already been using Twist for services testing, this post will hopefully show you easy enough steps to test your WebServices while still leveraging the authoring, maintenance aspects of Twist. In this example, we will test a simple temperature converter service exposed at http://www.w3schools.com/webservices/tempconvert.asmx, which provides simple celsius to fahrenheit degrees conversion.
Pre-requisite:
1. Creating the project
2. Generating the building stubs, skeletons, and data types from WSDL.
What we want is a simple and usable enough java interface for accessing the remote WebService. something like:
converterService.celsiusToFahrenheit("32")
A fair amount of boilerplate code must be written to access the Service. Thankfully, we can automate all that code generation. We will generate the bindings necessary for client side testing of the service using wsdl2java utility shipped with CXF. To do this:
If you look within the package contents classes, you will find an interface annotated with @WebService (org.tempuri.TempConvertSoap). This interface has 2 basic methods that represent the operations supported by the WebService. This is the remote interface we are going to use in our Test fixtures.
Another class (org.tempuri.TempConvert) will be generated annotated with @WebServiceClient. This is the class that will return the remote interface. Methods annotated with @WebEndpoint will return you a remote interface. (in this case, we have used TempConvert.getTempConvertSoap() method)
NOTE: If you would want to customize the JAX-WS implementations created by wsdl2java, it can be done by using a customization binding file. Please refer here for more information.
3. Adding CXF Library references to your project
4. Creating the remote interface instance
<bean id="tempConvertorFactory" class="org.example.ConverterServiceFactory"
init-method="start" destroy-method="stop" lazy-init="true">
<property name="wsdlLocation" value="classpath:tempconvert.asmx.wsdl"/>
</bean>
<bean id="converterService" factory-bean="tempConvertorFactory" factory-method="getConverterServicePort"
lazy-init="true" scope="singleton">
</bean>
5. Creating a scenario and generating test fixture
Temperature Converter:
- verify that "100" degrees in centigrade is same as "212" degrees fahrenheit
6. Injecting the service interface to the fixture
public class TemperatureConverter {
@Autowired
private TempConvertSoap converterService;
....
}
7. Calling a remote service operation.
public void verifyThatDegreesInCentigradeIsSameAsDegreesFahrenheit(Double celsius, Double fahrenheit) throws Exception {
assertEquals(fahrenheit, Double.valueOf(converterService.celsiusToFahrenheit(celsius.toString())));
}
8. Execute the scenario
Additional support from Eclipse WTP

To seasoned Twisters this may be obvious, but here's one example how to use a simple java class as a bean to set/get values across scenarios.
For example, say you are testing a web application and do some search, store values of search, and assert/do-something later on in another fixture/step.
1. Create a Java class. For example, below is a simple class which has a key-value map, and provides simple apis for storing/retrieving values. In this example, the class is created in package "com.orgname.test" under the Twist test project's "src" directory.
package com.orgname.test;
import java.util.HashMap;
import java.util.Map;
public class AppDataPlaceHolder {
private Map<String, Object> values = new HashMap<String, Object>();
public void setValue(String key, Object value) {
values.put(key, value);
}
public Object getValue(String key) {
return values.get(key);
}
}
2. Now define this class as a bean in "applicationContext-suite.xml" for your Twist test project. This will cause the bean to be instantiated when any test execution is requested for.
<bean id="appData" class="com.orgname.test.AppDataPlaceHolder"/>
3. In a test fixture, where you may want to store some application state across scenarios/steps, you may inject the above "ApplicationValues" object through the constructor. For example, if you have a fixture called "Search Amazon", then modify the constructor like below. Note, the example shows for a Twist Project with WebDriver as selected driver, but the pattern is same for any driver that you might have chosen.
.....
.....
import com.orgname.test.AppDataPlaceHolder;
public class SearchAmazon {
...
private AppDataPlaceHolder appData;
public SearchAmazon(WebDriver browser, AppDataPlaceHolder appData) {
this.browser = browser;
this.appData = appData;
}
.....
}
4. Now from any step implemented in the "Search Amazon" fixture you may store values onto the "AppDataPlaceHolder". For example, if you want to store the best-buy book for the author, you may do something as below
public class SearchAmazon {
.....
...
private AppDataPlaceHolder appData;
public SearchAmazon(WebDriver browser, AppDataPlaceHolder appData) {
this.browser = browser;
this.appData = appData;
}
.....
public void searchForAuthor(String authorName) {
//code to search for author
appData.setValue(authorName, browser.findElement(By.className("best_buy")).getText());
}
}
5. Now from another fixture you can access the previously stored values. (You just have to inject the "AppDataPlaceHolder" through the constructor like above):
public void verifyAuthorBestBuy(String authorName, String bookName) {
Object bestBuy = appData.getValue(authorName);
.....
}
I've set up a table-driven scenario. At the end of my data-driven step, it loops back to the beginning of my first scenario context to start the next table row. How do I get it just to loop from the end of the scenario step to the beginning of the scenario step and not keep trying to log in again?

When using twist in source control, you can ignore/exclude the following files in the workspace:
We have been trying to get Twist to work with our SmartGWT user interfaces. We were never able to get anything working with Sahi.
Recently our search has led us to how SmartGWT initially suggests doing automated unit testing. In the SmartGWT download there is a Selenium directory that provides a couple of extensions that can be used to lookup SmartGWT ids. I can get this working with SeleniumIDE and I can record my tests from there.
The problem is that I do not know how to add the file needed to be "seen" by the Selenium running in Twist.
There are plenty of articles for how to do it in Selenium RC, but I don't know how to do it here.
Here is an article for how this is done in RC:
http://seleniumhq.org/docs/08_user_extensions.html
We really like your product and the approach to testing, but we really need some help on this issue (being able to access SmartGWT ids) if we are going to be able to continue to use Twist.