Skip to content

Instantly share code, notes, and snippets.

@kodiyan
kodiyan / GherkinToJasonCore
Last active April 11, 2016 14:55
Gherkin To Json Converter_Core
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import gherkin.formatter.JSONFormatter;
import gherkin.formatter.JSONPrettyFormatter;
import gherkin.parser.Parser;
import gherkin.util.FixJava;
@kodiyan
kodiyan / GherkintoJsonMain
Last active August 29, 2015 13:57
GherkintoJsonMain
public class GToJRun {
private static String featurePath = "c:\\Json\\login.feature";
private static String jasonPath = "c:\\Json\\login.json";
// Set as pretty / ugly format //
static GtoJCore testG = new GtoJCore("pretty");
public static void main(String[] args) {
testG.gherkinTojson(featurePath, jasonPath);
@kodiyan
kodiyan / mockyRun
Created March 28, 2014 19:02
Calling Mocky Service
import java.io.IOException;
public class MockyRun {
private final static String USER_AGENT = "Mozilla/5.0";
static String url1 = "url";
static MockyCall callM = new MockyCall (USER_AGENT);
public static void main(String[] args) throws IOException {
callM.sendPost(url1);
@kodiyan
kodiyan / MockyCall
Last active August 29, 2015 13:57
Runnig and getting mocky response
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
public class MockyCall {
private final String USER_AGENT;
public MockyCall (String userAgent) {
@kodiyan
kodiyan / Call SOAP_XML
Created April 7, 2014 15:54
Call SOAP URL and send the Request XML and Get Response XML back
/* Call SOAP URL and send the Request XML and Get Response XML back */
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
@kodiyan
kodiyan / DB_iterate
Created April 8, 2014 14:06
Connect MSSQL with property file and Iterate Random value from DB
import java.util.Properties;
import java.util.Random;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
@kodiyan
kodiyan / imagetobyte
Last active August 29, 2015 14:02
Converting Picture to Byte from Local Folder and Printe in Console
package com.main;
import javax.imageio.ImageIO;
import org.apache.commons.io.IOUtils;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileInputStream;
public class ImageUtil {
@kodiyan
kodiyan / Run CukeJVM from Java
Created June 11, 2014 14:48
How to Run Cucmber JVM Run File from another Jav aClass
import org.junit.runner.JUnitCore;
import org.junit.runner.Result;
public static void main(String[] args) {
JUnitCore junit = new JUnitCore();
Result result = junit.run(CucmberJVMRun.class);
}
@kodiyan
kodiyan / BrowserVersionSelenium
Last active August 29, 2015 14:03
Get Browser and Version
package com.main;
import org.openqa.selenium.Capabilities;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.RemoteWebDriver;
public class BrowserVersion {
private static WebDriver browserDriver;