Login

Login
  • Register
  • VectorDesign blog

    Testing Automation and general Tech Geek stuff

    Java Doc tags

    Tag Description Syntax @author Adds the author of a class. @author name-text {@code} Displays text in code font without interpreting the text as HTML markup or nested javadoc tags. {@code text} {@docRoot} Represents the relative path to the generated document’s root directory from any generated page. {@docRoot} @deprecated Adds a comment indicating that this API […]

    extracting value from input field

    System.out.println(“attribute value”+driver.findElement(By.id(“someid”)).getAttribute(“value”)); JavascriptExecutor javascriptExecutor = (JavascriptExecutor) driver; System.out.println(“JavaScript”+javascriptExecutor.executeScript(“return arguments[0].value”, driver.findElement(By.id(“someid”))));

    check ORACLE Database version

    query your db SELECT * FROM V$VERSION; out put Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 – 64bit Production 0 PL/SQL Release 12.1.0.2.0 – Production 0 “CORE 12.1.0.2.0 Production” 0 TNS for Linux: Version 12.1.0.2.0 – Production 0 NLSRTL Version 12.1.0.2.0 – Production 0

    Increase File upload limit in MyPhpAdmin WAMP 3.1.3

     navigate to C:\wamp\alias ( or where you installed WAMP) open phpmyadmin.conf # To import big file you can increase values php_admin_value upload_max_filesize 128M php_admin_value post_max_size 128M php_admin_value max_execution_time 360 php_admin_value max_input_time 360 Edit the file to meet your needs, DON’T FORGET to extend the max execution time as well # To import big file you […]

    How to troubleshoot Side by Side errors using sxstrace

    C:\>SxsTrace Trace -logfile:SxsTrace.etl Tracing started. Trace will be saved to file SxsTrace.etl. Press Enter to stop tracing… To make it readable run   C:\>SxsTrace Parse -logfile:SxsTrace.etl -outfile:SxsTrace.txt Parsing log file SxsTrace.etl… Parsing finished! Output saved to file SxsTrace.txt.

    Set up Edge WebDriver

      Find your win10 release Win + R. Open up the run command with the Win + R key combo. locate the release in the pop up navigate to Microsoft WebDriver official page find the matching version download the web driver corresponding to your build set WebDriver in your path System.setProperty(“webdriver.edge.driver”, “{PathToDriver}/MicrosoftWebDriver.exe”); done    

    Read XLS using Java and Apache POI

    public static final String SAMPLE_XLSX_FILE_PATH = “./testData.xls”; Workbook workbook = WorkbookFactory.create(new File(SAMPLE_XLSX_FILE_PATH)); workbook.getSheetAt(0).getRow(0).getCell(1)

    WordPress Admin Log In Automation Test

    Using Selenium to test administrator functionality for wordpress

    Protected: Buddypress Template design

    There is no excerpt because this is a protected post.

    vimeoimoirt test

    Vimeo Javascript oEmbed Example Vimeo Javascript oEmbed Example Loading video…

    Useful development programms

    Create bootable USB drives the easy way    http://rufus.akeo.ie/ disk usage statistics  https://windirstat.net/ MySQL UI tool https://downloads.mysql.com/archives/workbench/

    JUnit Annotations Cheat Sheet

    @Before is executed before each test, @BeforeClass runs once before the entire test fixture. If your test class has ten tests, @Before code will be executed ten times, but @BeforeClass will be executed only once. In general, you use @BeforeClass when multiple tests need to share the same computationally expensive setup code. Establishing a database connection falls into this category. You can move […]

    Assersion vs IF ElSE Statement

    The main thing you should keep in mind is that the if-else statement should be used for program flow control and the assert keyword should only be used for testing purposes. You should never use asserts to actually perform any operation required for your application to work properly. According to Sun’s official Java documentation: “Each […]

    how to solve Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes during artisian migration

    Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes (SQL: alter table `users` add unique `users_email_unique`(`email`)) edit \app\Providers\AppServiceProvider.php from: namespace App\Providers; use Illuminate\Support\ServiceProvider; class AppServiceProvider extends ServiceProvider { /** * Bootstrap any application services. * * @return void */ public function boot() { // } /** * […]

    Laravel Windows Installation

    Install Composer Installation – Windows# Using the Installer# This is the easiest way to get Composer set up on your machine. Download and run Composer-Setup.exe. It will install the latest Composer version and set up your PATH so that you can just call composer from any directory in your command line. Open a command line […]

    Grading Selenium Tests

    Test One thing ATOMIC TESTING Each Test should be able to run Independently  ( autonomous) Anyone should understand the code Group Similar Tests together Centralized Setups and Tear Downs Use Page Objects

    Windows Hard Drive Space Usage Analyzer

    http://lifehacker.com/5915921/the-best-disk-space-analyzer-for-windows

    Linux Screen Cheat Sheet

    You can use Linux Screen to run tests  without maintaining an active shell session. To do that start Linux Screen by typing screen in the console  you can either close the session or hit Ctrl + a , d. To reattach to the screen. To Reconnect  type screen -r . if you have more than […]

    The Twelve Days of Testing

    On the first day of testing, the dev team gave to me A bug in the software code On the second day of testing, the dev team gave to me Two interfaces, and A bug in the software code On the third day of testing, the dev team gave to me Three test scripts Two […]

    switching between iframes WebDriver

    TestVariables.driver.switchTo().frame(TestVariables.driver.findElement(By.xpath(“//html/body/div[3]/div[1]/div/div[2]/div[2]/div/div/div[3]/form/div[6]/div/div/iframe”))); TestVariables.driver.switchTo().defaultContent();

    Installing apk on android Emulator using ADB

    locate your sdk installation folder (windows c:\Users\{user}\AppData\Local\Android\Sdk\platform-tools) locate adb.exe Open Terminal in that folder ( Shift + right click) open command window here type adb.exe – e install {path to apk}  

    Selenium Select from Dropdown

    new Select(driver.findElement(By.id(“DropDownId”))).selectByVisibleText(“Germany”);

    junit get test name

    import org.junit.Rule; public class NameRuleTest { @Rule public TestName name = new TestName(); @Test public void testA() { assertEquals(“testA”, name.getMethodName()); } @Test public void testB() { assertEquals(“testB”, name.getMethodName()); } }

    Firefox Plug ins for testing

    Selenium IDE (firefox)   Selenium IDE Chrome Nimbus Screen Capture and edit

    add image background support template

    Add the following in the function.php add_theme_support( ‘custom-background’, apply_filters( ‘runchums_custom_background_args’, array( ‘default-color’ => ‘f5f5f5’, ) ) );

    Selenium Grid

    Grid allows you to : scale by distributing tests on several machines ( parallel execution ) manage multiple environments from a central point, making it easy to run the tests against a vast combination of browsers / OS. Selenium Grid allows us to run multiple instances of WebDriver or Selenium Remote Control in parallel. It […]

    Jmeter User Define Variables

    WordPress theme files

    Manually upgrade Jenkins

    1. download the version of jenkins you want to use 2. Navigate to /usr/share/jenkins 3 Replace the war file   Restart the service

    Java Naming Conventions

    Identifier Type Rules for Naming Examples Packages The prefix of a unique package name is always written in all-lowercase ASCII letters and should be one of the top-level domain names, currently com, edu, gov, mil, net, org, or one of the English two-letter codes identifying countries as specified in ISO Standard 3166, 1981.Subsequent components of […]

    Starting Selenium hub and nodes

    starting hub java -jar selenium-server-standalone-2.44.0.jar -role hub Starting node java -jar selenium-server-standalone-2.44.0.jar -role node -hub http://localhost:4444/grid/register If you want to set a specific port java -jar selenium-server-standalone-2.44.0.jar -role hub -port 4441

    handle browser user authentication pop up

    One of the usual problems in testing is getting access to the test environment. Usually a test server is setup where a users authentication is required in order to access the application under test. In most  browsers (firefox,chrome, safari ect) this can be easily achieved by parsing the credentials in the url like so http://USERNAME:PASSWORD@www.testdomain.com […]

    JAVA ROBOTS

    This class is used to generate native system input events for the purposes of test automation, self-running demos, and other applications where control of the mouse and keyboard is needed. The primary purpose of Robot is to facilitate automated testing of Java platform implementations.   http://docs.oracle.com/javase/7/docs/api/java/awt/Robot.html

    Setting up Credentials for HtmlUnitDriver

    TestVariables.driver = new HtmlUnitDriver(true) { protected WebClient modifyWebClient(WebClient client) { // This class ships with HtmlUnit itself DefaultCredentialsProvider creds = new DefaultCredentialsProvider(); // Set some example credentials creds.addCredentials(“USERNAME”, “PASSWORD”); // And now add the provider to the webClient instance client.setCredentialsProvider(creds); return client; } };

    Starting Remote WebDrivers

      DesiredCapabilities capabilities = DesiredCapabilities.firefox(); capabilities.setCapability(“version”, “3.6”); capabilities.setCapability(“platform”, Platform.LINUX); WebDriver = driver = new RemoteWebDriver( new URL(“http://***.***.*.**:****/wd/hub”), capabilities); TestVariables.driver.get(“http://www.google.com”);  

    Get Driver Information

    Capabilities caps = ((RemoteWebDriver) driver).getCapabilities(); String browserName = caps.getBrowserName(); String browserVersion = caps.getVersion();

    Use common @before and @after Class

    create a public abstract class TestSetUps and include your annotations @Rule @Before @After   When you create a new test class extend it to the TestSetUps Class   You can over ride either using the @Override annotation     @Override @After public void tearDown() throws Exception { }

    install I3wm on linux mini installation

    install xinit {code} sudo apt-get install xinit {code}   sudo apt-get install i3

    Clean up trash from terminal

    find the path of the trash folder by typing sudo find / -type d -name *Trash* you should have an output /media/root/virtual_boxes/.Trash-0 /home/chester/.local/share/Trash   choose the trash folder you want to delete   sudo rm -rf /media/root/virtual_boxes/.Trash-0  

    Technologies used for Testing automation

    Selenium WebDriver / Grid   Simulates user interphase with the web application and distributes tests among a network Selenium IDE   Firefox Plug in that helps non coders to produce C# test scripts for test case expansion and maintenance Nunit Unit Testing environment used to run test scripts and report Oracle Virtual Box  system emulator

    Automation Testing Best Practices

    Use a locators file Name Junit test scripts with a common end name (e.x. EndUserTests.class) Use common @before and @after Class to run Tests Take Screenshot on fail

    Log in as root Ubuntu

    Root user is locked by default in ubuntu systems but if you want to access root rights enter in  shell sudo -i

    OpenVpn Ubuntu how to

    Install Open VPN {code} sudo apt-get install openvpn {code} Connect

    SVN over Terminal ubuntu

    SVN check out   svn checkout http://example.com/svn/somerepo {folder name}

    Run Commands on UserLog in

    add the command you want to run in ~/home/.profile sudo nano .profile To run a command in boot you need to create a .sh file with the command you want to run and add a reference in  /etc/rc.local Example sh /selenium/selenium_service.sh exit 0    

    Install Updates Ubuntu

    Update Packages and updates sudo apt-get update # Fetches the list of available updates sudo apt-get upgrade # Strictly upgrades the current packages sudo apt-get dist-upgrade # Installs updates (new ones)

    Java Robots and Selenium

    Still if you want to move the mouse pointer physically, you need to take different approach using Robot class Point coordinates = driver.findElement(By.id(“ctl00_portalmaster_txtUserName”)).getLocation(); Robot robot = new Robot(); robot.mouseMove(coordinates.getX(),coordinates.getY()+120); Webdriver provide document coordinates, where as Robot class is based on Screen coordinates, so I have added +120 to compensate the browser header. Screen Coordinates: These […]

    Install Google Chrome Terminal

    To add PPA in Ubuntu 14.04 / 13.10 / 13.04 / 12.10 / 12.04  run the following command in the terminal, type the password for the user when prompted.   wget -q -O – https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add – After installing the key, run the below command to add it to the repository. sudo […]

    Xvfb

    Install Xvfb – the X Virtual FrameBuffer This piece of software emulates the framebuffer using virtual memory which lets you run X-Server in machines with no display devices. This service is required to make browsers run normally by making them believe there is a display available. To install xvfb in ubuntu or Debian, run the […]

    Change Firefox Path in Selenium

    File pathToBinary = new File(“C:\\Program Files\\Mozilla Firefox15\\Firefox.exe”); FirefoxBinary ffBinary = new FirefoxBinary(pathToBinary); FirefoxProfile firefoxProfile = new FirefoxProfile(); FirefoxDriver _driver = new FirefoxDriver(ffBinary,firefoxProfile);