Skip to content

Instantly share code, notes, and snippets.

View sahajamit's full-sized avatar

Amit Rawat sahajamit

View GitHub Profile
@sahajamit
sahajamit / testng_retryanalyzer
Last active August 29, 2015 14:14
Sample code for testng retry analyzer to re-run the failed test cases using testng's IRetryAnalyzer listner
package com.testng.practise;
import org.testng.Assert;
import org.testng.IRetryAnalyzer;
import org.testng.ITestResult;
import org.testng.Reporter;
import org.testng.annotations.*;
public class RerunFailedTestCases implements IRetryAnalyzer{
private int retryCount = 0;
private int maxRetryCount = 1;
@sahajamit
sahajamit / AndroidScreenRecording
Created February 2, 2015 12:18
To record the Android screen using the native adb commands and then downloading it from the device sd card to the local machine
#Check if an argument was supplied
if [ -z "$1" ]
then
echo "No argument supplied, please provide video name"
else
# start recording
adb shell screenrecord --bit-rate 6000000 /sdcard/$1.mp4 &
# Get its PID
PID=$!
@sahajamit
sahajamit / TestNGAnnotationTransformer
Last active August 29, 2015 14:14
Testng annotation transformer to apply @test annotation at runtime . Here we are setting the timeout using it.
package com.testng.practise;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import org.testng.IAnnotationTransformer;
import org.testng.ITest;
import org.testng.annotations.ITestAnnotation;
import org.testng.annotations.Test;
import org.testng.IAnnotationTransformer;
@sahajamit
sahajamit / testngxml_with_listener
Last active August 29, 2015 14:14
Sample testng xml to pass the listener information to testng.
<?xml version="1.0"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="Phoenix.Equinox.Com Verification" verbose="1">
<listeners>
<listener class-name="com.testng.practise.SeleniumStarterListener"></listener>
</listeners>
<test name="Retry Test">
<classes>
<class name="com.testng.practise.Annotationtransformerexample"></class>
import org.testng.ISuite;
import org.testng.ISuiteListener;
public class SeleniumStarterListener implements ISuiteListener {
public void onStart(ISuite suite) {
}
public void onFinish(ISuite suite) {
}
package com.android.NativeBrowserAutomation;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.remote.MobileBrowserType;
import io.appium.java_client.remote.MobileCapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
import java.net.MalformedURLException;
import java.net.URL;
/**
import org.testng.ISuite;
import org.testng.ISuiteListener;
import org.testng.IExecutionListener;
public class TestNGExecutionListener implements IExecutionListener {
@Override
public void onExecutionStart() {
System.out.println("TestNG is staring the execution");
}
@Override
You can start Appium server from the job itself using PM2,
Please find the commands we are currently running
pm2 start /usr/local/lib/node_modules/appium/lib/server/main.js
pm2 logs
pm2 delete main
pm2 stop <id>
pm2 stop main
pm2 list
For Cloning:
git clone -b <Branch_Name>
To create and checkout
git checkout -b <Branch Name>
git branch <Branch Name>
git checkout <Branch Name>
/**
* TestRail API binding for Java (API v2, available since TestRail 3.0)
*
* Learn more:
*
* http://docs.gurock.com/testrail-api2/start
* http://docs.gurock.com/testrail-api2/accessing
*
* Copyright Gurock Software GmbH. See license.md for details.
*/