Posts Tagged ‘jenkins’

concordion vs. jbehave

Thursday, March 3rd, 2011

Play for concordion around two days, let me start what it could be in the end from user point view

Result so far

For test case part, I use the concordion + selenium webdriver, probably need Page Object as well, and configured with maven.

imageIn the Jenkins CI server, after I installed concordion presenter plugin, it will provide the link to final report

I need some hack here to show the overview report, and it could looks below

image

Then click the related story, you will see more detail test case result.

image

Should be good enough, since automatic web testing should not cover all testing, and don’t forget selenium powerful feature is to for cross-browser and cross-operation testing, see http://code.google.com/p/selenium/wiki/ContinuousIntegrationSystem

jBehave vs. Concordion

imageConcordion is just one tool in BDD area, and also my colleague touched another one: jbehave which is also java based (http://jbehave.org/)

Let’s quickly give you some difference

JBehave

more stable tool with lots of mature needs features around it like excellent reports (http://jbehave.org/reference/examples/reports-3.1/) and maven, selenium webdriver with lots of working flow (http://jbehave.org/reference/stable/developing-stories.html)

Write spec in java codes and follow Given..When..Then BDD spec

Concordion

It is a young (could be good) tool, with less mature community, no overview reports compare to jbehave, it needs some hack script, which is my favorite.

It has good extension like snapshot/log. http://concordion.org/Extensions.html

Write spec inside html (no tool support yet) and fixture is written in java language

No follow “Given..When..Then” since author think it is useless to straight follow it, see http://concordion.org/Technique.html for explanation.

I didn’t look into ruby tool, it is more to dig into it.

Now we have lots of topics for next codekata ;-)

Summary

Though auto web testing is a old area, but how to run it efficiency is always challenge, and BDD is slightly new for us, and it needs time to used it, since it needs extra competence for testers, it may impacts the resource planning for line.

Automated acceptance testing (BDD) with concordion

Tuesday, March 1st, 2011

image Firstly, I have to say, though I heard BDD (Behaviour-driven development) for long time, this is my first time to look into little deeper to see whether there is value or good things we can learn from it.

background in this area

I will not to focus on BDD, more thinking about the automatic acceptance testing framework and I try to put it into ALM (application lifecycle management) thinking on how to connect the requirement to test case and backforth in easy way, see right.

FitNesse is one of popular framework in this area, but it seems Cucumber, JBehave, Corcordion is also nice to use, as always, I googled for a while.

And finally I want to give Corcordion a try, since it seems it is more clean.

Getting started with Concordion

Concordion is an opensource tool for writing automated accpetance tests in java, and follow the guideline http://concordion.org/Tutorial.html, and soon you will get the result.

image

Concordion is quite similar with FitNesse, it use html/junit instead of wiki page, it can avoid setting up extra FitNesse server (though it is simple).

How it can be used

You need to understand this general architecture for those kind of framework, and I encourage to take a look Concordion’s Hints & Tips

image

Probably we need to develop some python scripts around it to organize the test case in product level.

Others

Since the testing result is html based, it is easy for reading and there is jenkins plugin : concordion presenter plugin for it as well.

And it is opensource, all the source codes and even websites are available in google code.

Summary

Concordion is a interesting testing framework to enhance the connection from requirement to test case implementation, it is not the normally way we focused, hope it can bring some fresh area here.

Let me know if you have experience on this (like FitNesse), please contact me.

Associate CI build information in redmine issue by using redmine REST API

Thursday, February 24th, 2011

Last time, I mentioned that there is a nice feature in JIRA plugin, which can associate the build information back to issue management system, and I spend one day for redmine to show how it could work, I really enjoy the coding work, here is the detail what I have done so far

There are several major technical issues to solve

  1. Update redmine issues with Redmine interface when I got build information in jenkins
  2. Improve redmine plugin to add more configuration and embed one job in post-build
  3. combile 1+2, when build is finished, I need to trigger the update to redmine

Redmine REST API

The good thing for most of nice web application is it provides good API, redmine is no exception, it has REST interface , before you use it, need some setting in your redmine system.

Enable the REST Web service and later you can find the key to access, and key is much better (cool) than normal user/password

image image

Since it uses REST API, it is much easier for developer to contribute the native library, here is the Rest API with Java which works toward redmine 1.1.0+, and it is very easy to get it started according to the example.

Where to put the build information in issue

I notce there is no field to attach the build information, so I raise the feature request #7692 into redmine forum, hopefully they can fix it, currently I can append the build information into “Description” area

image

Add configuration in redmine plugin

Now comes to the jenkins put, follow the old way to add one field to put the Redmine REST Access key.

image

And also I need to put one checkbox for whether push the build information back to redmine. (follow the JIRA plugin’s statement ;-) , and learn a little about how to add it in this section, by http://blog.sacaluta.com/2009/04/hudson-plugin-2-adding-post-build.html, and now it looks below

 image

Maven support for redmine java API

It is time to combine them together, unfortunately the redmine java API doesn’t have maven support yet, see the task 2 in the google code and I need to figure it out by myself, not so difficult, but still cost me one hour at least

  1. install the jar file locally (mvn install:install-file)
  2. put it into one webserver (easily migrate it later)
  3. add one proxy in nexus to check the jars under that web server
  4. add other dependency into pom.xml

Now it is possible to deal with redmine issue in jenkins, I hard code the issue id, and when the build is finished, it can push it to the description as I wanted, Great !!

I can’t spend more time to make it work completely (find issue in the build’s change set), any volunteer ?

Summary

When I am coding, i feel I have full of motivation and full of fun inside ;-) , unfortunately it is very difficult for me to focus on this in my daily work, haha.

back to some learnings.

  • redmine is a nice product on integration, which we can learn from technology as well like REST interface with key.
  • there is some value to associate the build information with issue, it can improve the transability, hopefully I can find people or myself to finish it.

ALM – Dancing with web app in CI using selenium

Thursday, February 17th, 2011

Selenium LogoIn previous blog, we have a running web application live system after CI, now it is the time to verify it. And in the open source industry, selenium is de-fact tool for it.

see http://seleniumhq.org/

Start with Selenium-IDE

_images/chapt3_img05_IDE_open.pngSelenium-IDE is actually firefox plugin to develop selenium test cases, if you download by non-firefox application, you could open it with firefox, which can install it inside.

As a quick start, click “Record button” and open your testing URL in the firefox, and run on action (like login), then the test case will be automatically recorded as selenium, and click “Play” button, the testing of your web app is flying, excellent

See detail document http://seleniumhq.org/docs/02_selenium_ide.html

Now it is time to think how to test it automatically, it is the job for Selenium RC (remote control) server

Run in selenium RC server

image The official usage for selenium RC server is to have selenium client who send the test cases to the server, and the server invoke the browser to verify it, it also means it needs real browser to execute.

In order to verify IE browser, mostly we have to use selenium RC server to run on windows platform.

For Selenium Client, it could be python, java, ruby, perl, mostly you can export the recorded test case from IDE to your preferred language, and maintain it in that language.

See reference http://seleniumhq.org/docs/05_selenium_rc.htmlimage

It is possible to run it in command line without Selenium Client if it is html format, format like

$ java -jar selenium-server-standalone-2.0b2.jar -htmlSuite "*iehta" http://google.com/ ~/Desktop/seleniumTestCase result.html

Unfortunately I got error like right, no clue how to fix it.

This solution needs real browser to execute, it takes me more time to figure it out on my ubunut server (testing machines) since it needs install x-windows probably which I want to avoid and for my case, I just want to have auto GUI testing.

Thank for my colleague, ChenLiu, who points me it is better to use Selenium WebDriver for this case

Another way using selenium WebDriver

imageSelenium WebDriver is kind of next evoluation for Selenium RC server, I am not exactly sure whether this is true, please check http://seleniumhq.org/docs/03_webdriver.html. &
http://stackoverflow.com/questions/3619824/whats-the-relationship-between-selenium-rc-and-webdriver

It is java framework, and it supports headless HTMLUnit without real browser !!! so it is fast and easy to use.

And it is not mentioned in the document above, actually if you still want to reuse the test case from Selenium IDE, you need to install extra plugin : https://addons.mozilla.org/en-US/firefox/addon/webdriver-backed-formatters/

And if you want to use, please check http://code.google.com/p/selenium/wiki/UsingWebDriver and the maven repo is http://nexus.openqa.org/content/repositories/releases

Since it is JUnit 3 test case, it should be easily integrated into jenkins CI group

Integrate into Jenkins CI

We can reuse the JUnit report to view the result , it is simple, now it is there

image 

Summary

- It is very nice to have GUI testing in your CI, and selenium suite is nice for this purpose
- Using Selenium IDE to record test case and export to programming language
- Using WebDriver if you don’t want to invoke real browser
- Using Selenium RC Server/Selenium Grid when you need more performance
- Using JUnit can be easily to generate report in same way in CI, but it will challenge the verification engineers

Using Selenium is just start dancing with Web app, continuously improvement could help you on enjoying and benefit more for it.

develop jenkins plugin for redmine

Saturday, February 12th, 2011

Yesterday when I play with jenkins and redmine, I noticed it was little weak for current redmine plugin, so I decided to take a look at the source codes and build some compentence here.

Since I didn’t play with java codes for long time, I need to bring it back especially for maven knowledge.

To my surprise, jenkins’s documentation and its develop environment is excellent, see detail below

Getting started

image http://wiki.jenkins-ci.org/display/JENKINS/Plugin+tutorial is the good start, and since mostly we use nexus, we need to follow http://wiki.jenkins-ci.org/display/JENKINS/HudsonWithNexus to configure the nexus server as well, yesterday I forget this ;-) , two tips you may need

  1. besides recommend setting for nexus user, the plugin group org.jvnet.hudson.tools needs to be set in settings.xml as well
  2. in nexus server, I added apache snapshot as well though it is not in the list, otherwise it complain to miss maven-enforcer-plugin:pom:1.1-snapshot

The guideline and the hudson maven plugin is excellent, which we can also learn for our own products

$ mvn -cpu hpi:create
$ cd create_samples
$ mvn package
$ mvn install
$ mvn hpi:run

image You can see during the package step, it will trigger the jetty server for smoke test, and after hpi:run command, I can visit my first jenkins plugin “UI Samples” for my browser.

so easy to start, this is also a reason the jenkins community is so big and lots of contribution since they have an excellent platform to work on.

Also this is a reason why almost every developers follow jenkins’s fork from hudson.

Play with redmine plugin

imageThis plugin is not moved to github yet, and I don’t know how to download via svn, anyway lastest source codes exist here https://svn.jenkins-ci.org/trunk/hudson/plugins/redmine/, I just use wget to download the source codes, sth like

wget "--accept=*" -l 7 -np -rL  --no-check-certificate https://svn.jenkins-ci.org/trunk/hudson/plugins/redmine/

Thanks to maven, I can simple use the same command to trigger it out, and to be fun, I just replace one icon to see whether it works, bingo, very good.

I will try to write some patches for our own usage.

Summary

- The jenkins development plugin is excellent on its code management using maven, since each plugin’s pom.xml is simple, it can let developer to focus its plugin business.

- mostly we need to develop own plugins in jenkins in the future to do integration.

ALM – From requirement to implementation and deployment

Friday, February 11th, 2011

image Now I start to focus on CI (jenkins a.k.a. hudson) part to see how it can be, and I want to see what could happen after I commit the codes

  1. The issues can be automatically updated for the status and links
  2. The product can be deployed to the live system automatically
  3. In product live system, it can show the changes (have connection to issue management system)
  4. .. testing part .. will be blogged later

And generally it is good.

General information

git and redmine integration to close issue automatically

In redmine system, as PO, I register one use story issues 58, Hotkey in live system to visit build server, the status is new,  see below

image

And as developer, I use maven to generate a sample web app and check in for first step, and add some javascript (see detail below) to trigger to visit build system

After quick verification, I commit and push the code to git repository

~/demo/helloworld2$ git commit -am "closes #58, add support to link to lastest build in jenkins"
~/demo/helloworld2$ git push

Then I visit the redmine system, and the status is closed and set done to %100 automatically, well done

image

Why ? because in the redmine/git integration, it can scan the keyword and update the issue automatically

image

Clean and easy to use.

deploy to live system automatically

if you are familar with maven and jenkins, it should not be difficult, and it works great.

I setup a tomcat server already, and open the admin interface, therefore in CI, it can trigger to deploy into tomcat automatically.

image

This part works good, surely in real live system, it will not be so simple, but it just needs improvement

connect to changes in live system

In the live system, mostly we want to know what changes since last time, so we need to add link (to save time to find the link) in live web system, and also in order not to break the original view, I prefer to use keyboard shortcut to trigger.

The changes information I use now for demo is in jenkins, see below

 image

This part is not perfect, since I want to show changes on feature and bugs list which existing in redmine system, not it only shows the code changes, I need to dig into it to see why current redmine jenkins plugin is so weak, and I am not jenkins expert, I need time.

[update] if i update the commit message with return key after issue number, it can link to redmine directly, great, see below, just can’t see detail issue information, it is pity

image

Summary

ALM tries to connect everything together easily, and I want to make most of steps automatically, good start, I will pursuade some project to use it to gain more experience

Technical Detail

Generate maven example

it is simple, mvn archetype:generate -DgroupId=com.example.demo -DartifactId=helloword2 and select web application example, then all the codes will be generated automatically

run web application locally in jetty

Mostly we can use jetty to start local web container, please check http://maven.apache.org/plugins/maven-war-plugin/examples/rapid-testing-jetty6-plugin.html for more detail, since mostly the default port is already used by others, need configure it pom.xml

maven deployment in tomcat

originally I try to setup jetty server for live system, after play a while, I notice jetty doesn’t have (at least 6.x) remote interface to be deploy/redeploy, so I have to switch to tomcat.

Here is a good guideline to do this http://wiki.base22.com/display/btg/How+to+create+a+Maven+web+app+and+deploy+to+Tomcat+-+fast

Why set the tomcat admin user/name in ~/.m2/settings.xml instead of pom.xml due to security reason, since pom.xml will be visible to everyone.

keyboard shortcut in javascript

imageshould be lots of scripts for this, I just happen to (google) use http://www.openjs.com/scripts/events/keyboard_shortcuts/, and it works fine after help from Yuwen and LiRen.

I just need to add some lines in my productive code, surely in real system, those lines should exist in debug mode only

ALM – redmine integration with hudson, good

Friday, January 28th, 2011

image Let’s continue with redmine, and today start to look at hudson (when I can call jenkins ;-) , which we used often today for CI.

Preparation

As normal, LiRen helps me to install the hudson plugin (http://www.redmine.org/boards/3/topics/14348?r=21051), this is one of the most mature plugin in redmine.

And I also start the hudson from command line

Integrate redmine + hudson

It is quite smoothly, enable the hudson model in the project setting, and in hudson tab, click setting for hudson, simple fill the the hudson URL and admin username and password, then you can view hudson jobs inside.

And if you have permission, you can start the hudson job directly, the most useful information now can be viewed directly inside redmine.

image

it can be viewed in activity as well, nice to have it.

It is mentioned it can be assciated revisions to issues like code yesterday, unfortunately I don’t know how to do it, but anyway it is good enough to show it out.

Summary

When redmine meet with hudson, it is also a good job, well done.

hudson or jenkins

Tuesday, January 18th, 2011

image Probably you already noticed the annoucement of Hudson’s future and jenkins will be the name for forked name for hudson in the community.

The new site is not fully ready yet, but it will be finalized soon, see current web site ;-)

image

Surely as the community, it more embrace for jenkins, since the core developers will move there.

Oracle probably will announce the stratgegy on how to continue on hudson, probably continuously it with its own control, don’t know whether it will kept as opensource or adapted it to commercial one.

While sometimes, I am curiously know from managers point of view, will they still use hudson from Oracle ? since people are used to have tools which company can provide support.

Surely there will be some consultant companies around jenkins

Summary

When old hudson is dead ? will you choose new hudson (oracle) or jenkins ?

For me, surely I will choose jenkins ;-)