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()

Thursday, July 9, 2015

Sunday, June 14, 2015

References

 <!--https://cdivilly.wordpress.com/2009/07/20/maven-jruby-and-rails-migrations/-->
                            <!--http://www.weblogism.com/item/344/call-rake-from-maven-->
                            <!--http://www.ning.com/code/2011/09/jruby-sinatra-web-service-as-an-executable-jar/-->

 <!--http://chris.chowie.net/2011/08/28/Sinatra-with-JRuby-on-Heroku/-->

Wednesday, May 20, 2015