Skip to main content

Posts

Editable Email Notification configuration for Jenkins Matrix project

hi, I just show how I have configured and the mail notification i get. Steps: 1. Add Archive the artifacts under post-Build action 2. Provide the .xml path which contains the list of tests run with status and details. path should be relative path under workspace 3. Add Publish JUnit test result report under post-Build action 4. Provide the .xml path which contains the list of tests run with status and details, same as step 2 5. Add Editable Email Notification under post-Build action 6. Configure the fields      a.  Recipient List: List of Emails       b.  Content Type: HTML (text/html)       c.  Default Subject:  $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS!       d. ${JELLY_SCRIPT,template="html"} 7. Save My Cofiguration looks like Mail look like

Jenkins Matrix Jobs

For many similar different combination build setup. Example Diff OS v/s Diff platform Configuration Matrix CHROME IE Test Module1 Test Module2 Test Module3 Test Module4 Plugin required:  matrix-project Wiki:  https://wiki.jenkins-ci.org/display/JENKINS/Matrix+Project+Plugin Location to download plugin: http://updates.jenkins-ci.org/download/plugins/ Install Plugin: Jenkins>Manage jenkins> Manage Plugin> Advansed> Browse and install Result Look like: Configuration:

Right click and select using Selenium

Steps: 1. Find element/location where you need to right click 2. Create action and do context-click 3. Trigger keyboard event using Robot to select the menu option and enter Code: WebElement ele = driver.findElement(By.xpath(xpathExpression)); Actions act = new Actions(driver); act.moveToElement(ele).contextClick(); act.build().perform(); Robot robot = new Robot(); robot.keyPress(KeyEvent.VK_DOWN); robot.keyPress(KeyEvent.VK_DOWN); robot.keyPress(KeyEvent.VK_ENTER); ** Like if This helps ..

Invoke testng.xml from a batch file with code

Executing tests from a .bat file is familiar or useful while using GRID. There are couple of ways to execute this. 1| Copy any one of the below methods in text file 2| Edit the drive location 3| Save it as yourtext .bat 4| Now, double click on the batch file created. Note: Its better to execute from cmd prompt before try Method #1 cd   C:\ Workspace\projectname java -cp C:\Workspace\projectname\lib\*;C:\Workspace\projectname\bin org.testng.TestNG testng.xml Method #2 cd C:\ Workspace\projectname set ProjectPath=C:\Workspace\projectname echo %ProjectPath% set classpath=%ProjectPath%\bin;%ProjectPath%\lib\* echo %classpath% java org.testng.TestNG %ProjectPath%\testng.xml

Database connection and selenium with examples

This illustrates how to connect MySQL database with Selenium using Java bindings.  Make sure mysql-connector-java-5.x.x-bin.jar in your buildpath. Configure MySQL 1| Download an install  MySQL . 2| Create a database and table. e.g., create database one; create table pets (name VARCHAR(20), owner VARCHAR(20), species VARCHAR(20), sex CHAR(1), birth DATE, death DATE); 3| Follow up whatever queries intended 4| Now, try to connect the schema with java via selenium webdriver for retrieving the table values. private String dbvalue; private String dbUrl = "jdbc:mysql://localhost: 3306 / one "; //Here, one is the schema/db private String username="root"; private String password=" yourpassword "; private String dbClass = "com.mysql.jdbc.Driver"; @Test public void connectdb() throws Exception {    driver.get("www.xyz.com");        try { Class.forName(dbClass); Connection con = DriverManager.getConnection (dbUrl,user...

Zoom in Zoom out actions in selenium

Zoom in WebElement html = driver.findElement(By.tagName("html")); html.sendKeys(Keys.chord(Keys.CONTROL, Keys. ADD )); Zoom out WebElement html = driver.findElement(By.tagName("html")); html.sendKeys(Keys.chord(Keys.CONTROL, Keys. SUBTRACT )); Zoom 100% WebElement html = driver.findElement(By.tagName("html")); html.sendKeys(Keys.chord(Keys.CONTROL,  "0" )); Zoom Feature on MAC WebElement html = driver.findElement(By.tagName("html")); html.sendKeys(Keys.chord(Keys. COMMAND , Keys.ADD)); html.sendKeys(Keys.chord(Keys. COMMAND , Keys.SUBTRACT)); html.sendKeys(Keys.chord(Keys. COMMAND , Keys."0"));

Different locators in selenium with examples

Types of Element Locators : 1| Html id | id attribute 2| Html name | name attribute 3| XPATH 4| Class name 5| CSS Selector 6| Link Text 7| Tag Name XPATH XPath is a way to navigate in xml document and this can be used to identify elements in a wen page. You may have to use XPath when there is no name/id associated with element on page or only partial part of name/IDE is constant. Direct child - / Relative child - // id, class, names can also be used with XPath //input[@name='q'] //input[@id='q'] //input[@class='q'] e.g.,  By.xpath(“//input[@id=’myElementId’]”) CSS Selector CSS location strategy can be used with Selenium to locate elements, it works using cascade style sheet location methods.in which - Direct child is denoted with - (a space) Relative child  is denoted with - > id, class, names can also be used with CSS css=input[name='q'] css=input[id='q'] or input#q css=input[class='q'] or input.q...