This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @echo off &SETLOCAL ENABLEDELAYEDEXPANSION | |
| :: Functions for updating property files | |
| ECHO Args to script: %1 %2 %3 | |
| ::--------------------------------------------------- | |
| :: Create test file if it doesn't exist | |
| ::--------------------------------------------------- | |
| IF NOT EXIST test.properties ( | |
| ECHO Key1=Value1>test.properties | |
| ECHO #Key2=Value2>>test.properties |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.io.BufferedWriter; | |
| import java.io.File; | |
| import java.io.FileWriter; | |
| import java.io.IOException; | |
| import java.io.PrintWriter; | |
| import java.text.DecimalFormat; | |
| import java.text.NumberFormat; | |
| import java.util.Arrays; | |
| import java.util.Collection; | |
| import java.util.Comparator; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| LINUX: | |
| To run in IDE: | |
| - open terminal window and run | |
| ./jetty-server.sh | |
| - open terminal window and run | |
| ./selenium-server.sh | |
| - run stories in IDE | |
| WINDOWS: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <suite> | |
| <suiteName>Suite 1</suiteName> | |
| <sauceURL>http://username-string:access-key-string@ondemand.saucelabs.com:80/wd/hub</sauceURL> | |
| <tests> | |
| <test> | |
| <enabled type="java.lang.Boolean">true</enabled> | |
| <testname type="java.lang.String">Test 1</testname> | |
| <environment type="java.lang.String">portal1</environment> | |
| <testlocale type="java.lang.String">Grid</testlocale> | |
| <browser type="java.lang.String">Firefox</browser> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export DISPLAY=:0.0 | |
| xvfb-run --auto-servernum --server-num=0 java -jar selenium-server-standalone-2.32.0.jar > |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.io.BufferedReader; | |
| import java.io.FileInputStream; | |
| import java.io.IOException; | |
| import java.io.InputStreamReader; | |
| import java.io.Reader; | |
| import java.nio.charset.Charset; | |
| import java.util.concurrent.TimeUnit; | |
| import org.openqa.selenium.JavascriptExecutor; | |
| import org.openqa.selenium.WebDriver; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public boolean elementExists( By locator ) { | |
| WebElement foo = null; | |
| try { | |
| foo = this.getElementByLocator( locator, 10 ); | |
| } catch ( TimeoutException te) { | |
| System.out.println("There was a timeout looking for element: " + locator.toString() ); | |
| //Swallow exception: ExceptionUtils.getMessage(te); | |
| return false; | |
| } catch ( ElementNotVisibleException env ) { | |
| System.out.println("The element was found but is invisible: " + locator.toString() ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Example, JQuery in Selenium, by injection into driver: | |
| https://github.com/Nthalk/SeleniumJQuery/blob/master/example/com/anteambulo/SeleniumJQuery/example/Example.java | |
| HtmlUnitDriver drv = new HtmlUnitDriver(BrowserVersion.FIREFOX_3_6); | |
| drv.setJavascriptEnabled(true); | |
| try { | |
| jQueryFactory jq = new jQueryFactory(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import org.apache.commons.beanutils.ConvertUtils; | |
| import org.apache.commons.beanutils.Converter; | |
| import au.com.bytecode.opencsv.CSVReader; | |
| public class CsvDataProvider implements Iterator { | |
| /** | |
| * @testng.data-provider name="CsvDataProvider" | |
| * @param method the method the TestNg passes to you |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public List<char[]> bigram(String input) { | |
| ArrayList<char[]> bigram = new ArrayList<char[]>(); | |
| for (int i = 0; i < input.length() - 1; i++) { | |
| char[] chars = new char[2]; | |
| chars[0] = input.charAt(i); | |
| chars[1] = input.charAt(i+1); | |
| bigram.add(chars); | |
| } | |
| return bigram; | |
| } |