Showing posts with label Reporting Framework. Show all posts
Showing posts with label Reporting Framework. Show all posts

Thursday, June 25, 2015

Bitnami Jenkins Usage Steps

Jenkins, previously known as Hudson, is an open source continuous integration server. Built with Java, it provides over 400 plugins to support building and testing virtually any project. It supports SCM tools including CVS, Subversion, Git, Mercurial, Perforce and Clearcase, and can execute Apache Ant and Apache Maven based projects as well as arbitrary shell scripts and Windows batch commands. It also can monitor executions of remote tasks.
Please, take a look to the Quick Start Guide to know the basic use of this Stack.

How to start/stop the servers?

Graphical tool
The native installers include a graphical tool to manage the servers easily. You can find the "manager-windows.exe", "manager-osx" or "manager-linux" tool in your installation directory. Using this tool, you can Start, Stop or Restart the servers and check the log files. You can click on the icon to start it.
manager-servers.png

manager-osx.png










win_platform.png
On Windows: You can also start the Manager tool from shortcuts: Start -> Program Files -> Bitnami Stack -> Manager tool
Command line tool
If you prefer, you can use the "ctlscript.sh" utility from the command line. This script is in the installation directory.
linux_platform.png
On Virtual Machines and Cloud images:
$ sudo /opt/bitnami/ctlscript.sh start
A native installer on Linux:
$ cd ~/application-version
$ ./ctlscript.sh start
mac_platform.png

On OS X: You can start the Manager tool from the installation directory or you can use the "ctlscript.sh" utility from a Terminal.
host:~ user$ cd /Applications/application-version
host:~ user$ ./ctlscript.sh start

Where is JENKINS_HOME variable pointing to?

We define JENKINS_HOME in your installation directory in the apache-tomcat/conf/Catalina/localhost/jenkins.xml file. By default it is pointing to apps/jenkins/jenkins_home.
Notice that the installation directory is /opt/bitnami in the Bitnami virtual appliances and Bitnami Amazon Images.

How to start with Git and Jenkins?

Jenkins application is running as "tomcat" user so it is necessary to configure this user in case you want to access to a private repository. If you use a public repository is not necessary to configure the Tomcat user.
Configure Tomcat user to have access to the Git repository
Previous versions of Jenkins require to create the Tomcat user folder:
$ sudo mkdir /home/tomcat
$ sudo mkdir /home/tomcat/.ssh
Then copy the private key to access to the repository into the "/home/tomcat/.ssh" folder:
$ sudo cp /path/to/id_rsa /home/tomcat/.ssh
And change the permissions
$ sudo chown -R tomcat:tomcat /home/tomcat
It is also necessary to save the hostname of your repository into the "known_hosts" file:
$ sudo su tomcat -c "/opt/bitnami/git/bin/git ls-remote -h git@YOUR_REPOSITORY.git HEAD"
The authenticity of host 'ec2-xx-yy-zz.compute-1.amazonaws.com (xx.yy.zz)' can't be established. 
ECDSA key fingerprint is e5:xx:9d:yy:ff:89:55:47:aa:fd:b5:ee:0a:pp:6f:8d.
Are you sure you want to continue connecting (yes/no)? yes
Configure Git repository in Jenkins 
Before creating the first Job, it is necessary to configure the Git user and email that Jenkins will use to clone the repository. You can configure these options in "Manage Jenkins" -> "Configure System" -> "Git plugin" section
configuring-jenkins-git-2a.jpg
Then create a new Job in Jenkins and specify the Git repository.
create-job-jenkins-3.jpg
And run the Build. If everything was properly configured, Jenkins will checkout the code from the Git repository.

How to upgrade Jenkins?

If you want to upgrade Jenkins keeping your data, you just need to download the latest jenkins.war file, copy it in your apache-tomcat/webapps directory and restart Tomcat. It is recommended to create a backup of the previous jenkins.war file. You may want to revert to the previous version if you find any issues after upgrading.
Upgrading only Jenkins
On Linux and OSX you can execute the following steps to perform the above (notice that the installation directory is /opt/bitnami in the Bitnami virtual appliances and Bitnami Amazon Images):
 
$ cd
## Stop the server
$ ./ctlscript.sh stop
 
## Copy your previous .war file in case you need to restore it
$ cp apache-tomcat/webapps/jenkins.war apps/jenkins/jenkins.war.bak
 
## Remove jenkins all files to force Tomcat to deploy the new jenkins.war file
$ rm -r apache-tomcat/webapps/jenkins
$ rm -r apache-tomcat/webapps/jenkins.war
$ rm -r apache-tomcat/work/Catalina/localhost/jenkins
 
## Donwload the new version of jenkins
$ mv jenkins.war apache-tomcat/webapps/
 
## Start the server
$ ./ctlscript.sh start
On Windows you can stop the servers from the Start Menu entry or using the graphical tool that you can find in your installation directory. Using the file explorer go to where you installed the Bitnami Jenkins Stack. Copy the jenkins.war file from the apache-tomcat/webapps directory to apps/jenkins. Download the latest jenkins.war file and copy it in apache-tomcat/webapps. Now just start the server from the Start Menu or using the graphical tool.
Upgrading all the components
Alternatively to the process above, you can download a new Bitnami Jenkins Stack. You can install it to a different location (remember to stop the previous install so there are no port conflicts) and point it to your previous JENKINS_HOME path by editing the file  apache-tomcat/conf/Catalina/localhost/jenkins.xml.
If you are using a Bitnami virtual appliance or AMI you can start a new image with the latest jenkins version and move the content of /opt/bitnami/apps/jenkins/jenkins_home in your current installation to the new installation. Then restart the server.

How to enable SSL in Jenkins?

You can configure Apache Tomcat to enable SSL connections for accessing to the application using the HTTPS protocol. It is necessary to specify the Apache SSL certificate. If you do not have the cert you can create following these steps in the section below.
Check that you have the certificate file at "/installdir/apache-tomcat/conf/ssl/tomcat.cert.pem" and the certificate key file at "/installdir/apache-tomcat/conf/ssl/tomcat.key.pem".
To enable SSL you should uncomment the following line in the /installdir/apache-tomcat/conf/server.xml file:
8443
" protocol="HTTP/1.1" SSLEnabled="true" maxThreads="150" minSpareThreads="25" maxSpareThreads="75" enableLookups="false" disableUploadTimeout="true" acceptCount="100" scheme="https" secure="true" clientAuth="false" sslProtocol="TLS" keystoreFile="conf/myKeystore" keystorePass="your_password" SSLCertificateFile="installdir/apache-tomcat/conf/ssl/tomcat.cert.pem" SSLCertificateKeyFile="installdir/apache-tomcat/conf/ssl/tomcat.key.pem"/>
Then restart the Apache server and try to access at "https://localhost:8443".

How to create a SSL certificate for Jenkins?

You can find a detailed guide in the official Apache Tomcat documentation at http://tomcat.apache.org/tomcat-6.0-doc/ssl-howto.html

Sunday, March 29, 2015

Jenkins as the Test Reporting Framework

Very few and matured companies are able to invest on the development of the Test Reporting Frameworks. At Komli we realised the benefits & value it offers.Instead of buying some commercial tools we went with the approach of extending Jenkins for the same. This talk is about our experience regarding the same.
Test Reporting Framework are the ultimate utilities reached by very few companies in the world likes of Google & Facebook. It require significant investment in terms money and resources. To optimize on both we tried the approach of extending Jenkins for the same purpose.
We like to share our experiences with respect to this journey. We will talk about different challenges we faced in doing so and how we solved them.
We strongly believe that other startup can use our experience and get benefit from this immensely.

WHY TEST REPORTING FRAMEWORK?

  1. To help with informed decision, whether to go ahead with production deployment of the build
  2. To analyze whether sufficient testing being done
  • What are code changes?
  • What are the corresponding automation changes w.r.t test-cases added/deleted/modified
  • What is the test automation run trend w.r.t trend on Release basis

REPORTING FRAMEWORK REQUIREMENTS

  • Web based Tool
  • Cost Effective
  • Easy to maintain
  • Integration with Test Case Execution Frameworks

SOME OF PAID TEST REPORTING FRAMEWORKS AVAILABLE
  • TestRail
  • Xqual
  • Test Collab

SOLUTION TO THE ABOVE PROBLEMS :- JENKINS

  • Continuous Integration server that allows to run multiple automation suites at the same time.
  • Supports SVN, Git and about any other SCM tools you can think of via plugins

WHY JENKINS

  • Web based
  • No additional cost, we are already dependent on it as Test-Case Execution Framework
  • Well supported
  • Highly customizable

JENKINS ON THE RELEASE BASIS








COMMON JENKINS TERMS

  • Project
  • Builds

NEW TERMS INTRODUCED

  • Benchmark Project
  • Benchmark Builds 

BENCHMARK PROJECT

  • The project in Jenkins where we maintain the automation results on the basis of releases done to production.


BENCHMARK BUILD

  • Build which has best results
  • The one whose final status we want to maintain in the benchmark project

WHAT IS ALREADY AVAILABLE IN JENKINS

  • Show automation run trend
  • Integration with SCM tool show code diffs


CHALLENGES

  1. Integration : Want everything in the single screen (single project in Jenkins)
  2. Benchmark Build : We don't know priori that given build is the best build to run
  • Don't want to waste resources and time to execute automation run again once we have decided on the build to deploy on production.
  • Intermittent Failures : Want to maintain their status as Passed for a given release
  • If we have taken the approach of copying results from one project to other project (benchmark project).

OUR APPROACH

  • Git Plugin for Code Diff
  • Custom Java Script for Test-Cases diff
  • Custom Java Script for overriding intermittent failure status
  • CopyArtifact Plugin to migrate results
  • Custom Groovy Script for re-generating the TestNG result trends

INTERMITTENT FAILURES


 

PARAMETERS TO COPY BENCHMARK BUILD






Slideshare Link for Presentation at RootConf


My Profile

My photo
can be reached at 09916017317