Wednesday, December 7, 2016

Download Previous versions of Chrome Browsers

 Chrome Browser Versions:  Here are the links to download the previous versions of Chrome Browsers

https://commondatastorage.googleapis.com/chromium-browser-continuous/index.html
https://omahaproxy.appspot.com/

Saturday, November 19, 2016

Create Your First Angular application with npm, bower, angularjs

This post assumes you have already installed nodejs, npm on your machines. To start with let us use the terminal/sublime text editor to create our app which shows our name on the webpage.

Follow the steps to create your simple page.
1. Launch the terminal and create a directory named <ajs> anywhere in your drive. I chose "/Users/Yuvaraj" location to create the <ajs> directory.

    /Users/Yuvaraj> mkdir ajs

2. Navigate to the ajs directory.
    /Users/Yuvaraj> cd ajs

3. Now interactively create a package.json file in ajs directory by running the following command,
    /Users/Yuvaraj/ajs>npm init
     we should see the following questions on running this command.
 
     This utility will walk you through creating a package.json file.

It only covers the most common items, and tries to guess sensible defaults.

See `npm help json` for definitive documentation on these fields
and exactly what they do.

Use `npm install <pkg> --save` afterwards to install a package and
save it as a dependency in the package.json file.

Press ^C at any time to quit.
name: (ajs) 
version: (1.0.0) 
description: 
entry point: (index.js) 
test command: 
git repository: 
keywords: 
author: 
license: (ISC) 
About to write to /Users/Yuvaraj/ajs/package.json:

{
  "name": "ajs",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC"
}

Is this ok? (yes)

4. After generating the package.json file. Let us install http-server, bower libraries using the npm and save these dependencies into the package.json by running the following command.
   /Users/Yuvaraj/ajs>npm install --save http-server
   /Users/Yuvaraj/ajs>npm install --save bower
  Observe that http-server, bower are automatically saved into package.json file in the dependencies section and a folder node_modules is created with the libraries installed.

5. Now create an app directory where we put all the application code.
     /Users/Yuvaraj/ajs>mkdir app

6. Initialise bower by running the following command.  Make sure we see bower.json after running the command in app directory.
     /Users/Yuvaraj/ajs/app>bower init

7. After initialising the bower, install the angular dependency and save to the bower.json.
    /Users/Yuvaraj/ajs/app>bower install --save angular
   
    We observe that a new folder bower_components gets created in app folder with angular dependency added.   

8. Now edit the package.json file by adding a start script into the script section.

     "scripts": {
  "start": "http-server ./app -a localhost -p 2222",
        "test": "echo \"Error: no test specified\" && exit 1"
      },

With this step we are done with the setup. Once the setup is completed we can start creating the angular modules and bind them with the html.

9. Now create a app.js file in the app folder and put the following content in it.
 
    angular.module('yuvi', [])
     .controller('TestController', function TestController(){
         this.name = "Yuvaraj";
    });
 
10. Create a index.html in app folder and put the following html in it.
   
      <html ng-app='yuvi'>
       <head>
          <script type="text/javascript" src="/bower_components/angular/angular.js"></script>
<!-- this refers the angular.js file reference added from the bower dependencies installed -->
          <script type="text/javascript" src="app.js"></script>   <!-- this refers the app.js file that we have just created -->
        </head>

        <body ng-controller='TestController as testCtrl'>
            <h1>{{testCtrl.name}}</h1>
        </body>
     </html>

11. Now we are done with writing our simple app which displays our name. Now let us start our application by running the start script configured in our package.json.
 In the terminal run npm start command where the package.json file is available.

   /Users/Yuvaraj/ajs>npm start
   we must a message saying the server is started on a specific port with the url to the application.
    http://localhost:2222.

 Simply launch the url <http://localhost:2222> in the browser. We see "Yuvaraj" displayed as a header.
 

  

Friday, October 21, 2016

Launch Selenium Grid on Amazon EC2

Here are the steps to launch your selenium grid on ec2 instance.

1. To launch the selenium grid on ec2, you must have an aws console account.
2. Create a t2.micro instance through ec2 service in the console.
3. Click on Security groups link in the ec2 management console.
4. Click on the default/security group currently assigned to your instance.
5. Add the following protocol rules to the inbound and outbound traffic.
   Type: All TCP
   Protocol: TCP
   Port Range: 4444 / 0 - 65535 (default value)
   Source: 0.0.0.0/0
6. Using the keypair generated while creating the instance, connect to the box.
7. Create a folder <selenium>.
8. run the following command to download the selenium server jar file.
   wget http://selenium-release.storage.googleapis.com/2.53/selenium-server-standalone-2.53.1.jar
9. Launch the grid using the following command
     java -jar selenium-server-standalone-2.53.1.jar.1 -role hub
10. Now, open your browser on your local machine and launch the grid url in the browser
      http://xxxxxxxxx:4444/grid/console

Next post will describe the steps to register the nodes to the grid....

Friday, September 16, 2016

How to Install Groovy Plugin in the Jenkins and write the groovy code in the console



Install the groovy plugin:

In order to install the groovy plugin in your jenkins server, first we download the the required (groovy) plugin from the plugin repository https://updates.jenkins-ci.org/download/plugins/groovy/.

The plugin extensions are hpi. Once the plugin is downloaded from the plugin repository, go to Manage Jenkins page and Manage Plugins page. Now goto Advanced tab, then chose the plugin file you have downloaded and click upload. This will install the groovy plugin on your jenkins server.

Write groovy code in the groovy script console.

 Refer the https://www.cloudbees.com/jenkins/juc-2015/presentations/JUC-2015-USEast-Groovy-With-Jenkins-McCollum.pdf

groovy Script vs System Groovy Script

The plain "Groovy Script" is run in a forked JVM, on the slave where the build is run. It's the basically the same as running the "groovy" command and pass in the script.

The system groovy script, OTOH, runs inside the Jenkins master's JVM. Thus it will have access to all the internal objects of Jenkins, so you can use this to alter the state of Jenkins

Where to store the script?

● Can put it in source and pull it from source
● Or you can put the script directly into the command box that is provided


Friday, March 25, 2016

Configure Protractor


Follow these steps to configure the protractor.

1. install npm from https://nodejs.org/download/release/npm/
2. install protractor using "npm install -g protractor"
3. install webdriver using webdriver-manager update.
4. start the selenium server using webdriver manager
     webdriver-manager start
5. Now protractor will accept the configuration file (protractor.conf.js).

   exports.config ={
         seleniumAddress: 'http://localhost:4444/wd/hub'
         jasmineNodeOpts:{
                  showColors: true,
                  defaultTimeoutInterval: 3000  

           }
     }

6. protractor can start the selenium server if we provide the path to the selenium server standalone jar. This will slow down the overall time it takes to run the tests due to protractor having to start the server as opposed to an instance already running:
seleniumServer: './node_module/protractor/selenium/selenium-server-standalone-2.42.0.jar'

https://github.com/angular/protractor/blob/master/docs/api.md

Sunday, January 31, 2016

SOAP mocking SOAPUI Groovy XML Parsing


Mocking is one of most regular tasks that testers need to do as part of their Job. Handling the mock using groovy bit challenging. Following is an example to parse the request xml and evaluate the xpath on the request xml.

Example:
import java.text.*
import groovy.lang.*
import java.util.*
import com.eviware.soapui.support.XmlHolder

def sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX")
def currentOrderId = new Date().getTime()
def holder = new XmlHolder(mockRequest.requestContent)
holder.namespaces['ns1'] = "http://xxxxxx/aaaaa/fffffffffffff/2.0/vvvvvvvv/4.0"
holder.namespaces['ns'] = "http://xxxxxx/aaaaa/ffffffffffffff/2.0/bbbbbbbb/4.0"
def nodeV2 =  holder.getDomNodes("//*")[3]
log.info nodeV2.getNodeName()
def hubId= nodeV2.attributes.getNamedItem("Hub").getNodeValue()

if(hubId.equals(400)){
context.setProperty("request1", hubId)
}


//def nodeV =  holder.getNodeValue("//ns1:OrderID")
//def nodeV =  holder.getDomNode("//ns1:OrderID")
//log.info nodeV.attributes.getNamedItem("id").getNodeValue()