Speaking at QCon Beijing

Fábio Pereira

Sun, 02/05/2012 - 04:09

I’m very happy to be a guest speaker at QCon Beijing in April 2012.

I submitted the 2 abstracts below. We haven’t agreed completely on the schedule, but it seems like one of them will be a half-day tutorial (Shallow Depth of Tests) and the other one a talk (Predictably and Irrationally Agile).

Shallow Depth of Tests - Scalable TDD/BDD

Test automation is prevalent in the software development community. Practices like TDD and BDD are widespread and applied almost unquestionably. However, several organisations have struggled in attempting to scale automated test suites, which very often become slow, brittle, non-deterministic, unreliable and difficult to maintain.
In this talk, I will discuss some common mistakes, Tautological TDD (TTDD), for example, and also present patterns that I have successfully applied, such as Shallow Depth of Tests and Testing Pyramid. These have enabled us to achieve maintainable and scalable tests that fulfill their purpose - to help software development teams deliver faster and more confidently the features required by business people.

Predictably and Irrationally Agile

People behavior is one of the centerpieces of Agile software development. Cognitive Psychology and Behavioral Economics have helped us achieve a better understanding of some human seemingly idiosyncratic behaviors, for example, the decoy effect on the decision-making process. Agile teams are constantly making decisions, for instance, while prioritising, estimating stories or choosing the size of an iteration.
This talk will compare and correlate Dan Ariely’s controlled experiments described in his book “Predictably Irrational” to Agile. The anticipated result should be an increased awareness of the reasoning behind some Agile values, principles and practices which, as a consequence, should improve the way we apply them as agile adopters and practitioners.

Qcon speakers

Back to the basics: What made this Agile Inception especial?

Paulo Caroli

Fri, 02/03/2012 - 12:14
The following two pictures depict the latest Inception I participated at.








A little bit of history: For the past two years I have participated directly in 3 Inceptions, and indirectly in 5 inceptions. By directly, I mean, I was sitting in the war room for most of the Inception sessions. And by indirectly, I mean, I was participating on the Inception sessions over video from a Nearshore location (onshore is San Francisoc, USA, nearshore is Porto Alegre, Brazil).

I attribute the success of the last Agile Inception to 3 things: collocation, war room, and colorful post-it.

Collocation

Don’t under estimate the value of a face to face interaction. I am currently in Brazil and I am used to having effective meetings over video and phone with USA. I know that technology can bring people closer together, and, perhaps, we can work together without sitting next to each other. However, the face to face during Inception will bring the team together in a way that it will be worth each penny spend for making the collocated Inception a reality.

I compare it to dating and internet dating. Relationship development goes to another level when the whole team is at the same room. Think creatively on how to save on costs. In our case we were able to reduce the collocated period by having a pre-Inception period before the collocate Inception. Spikes, research, data gathering, codebase analysis were the sort of activities we did in the pre-Inception week.

War room

Keep a single room for the team during the intense Inception period: the war room! The room should fit all team comfortably. It must have a clean table and wall space. The room should also have a cabinet or a box with index cards, colorful post-its and pen.

The war room makes the environment for collaborative sessions. It also avoids the waste of time of people moving from one room to another. Another important point is about carrying the information between rooms. You can either carry all hand-written notes (index cards, post-its, flip-charts, etc) and put them back in the wall and tables, or upload them on a digital format and carry it on your laptop. The former option is a waste of time. The later lessens people interaction. There is no replacement for writing on and tearing apart colorful post-it or index cards. Once the information goes to the computer, it will not get back to paper. People interaction reduces as there is nothing on the table to gather around.

colorful post-its

Do not bring a list of existing user stories to the Inception. I am sure there is a list somewhere (excel, Jira, or alike). Use it for reference, but don’t use it for driving the Inception sessions. Print a few copies and bring them to the war room. Let people consume it if required. Try not to read items from a list during a collaborative session. In fact, do not build a list while in a collaborative session.

Group people around colorful post-its. Write and place post-its either on the table or at the wall.. Talk about them. Write a few more. Tear them apart. Make use of colors. Reorganize it. The collaboration from using such basic, low-fi technology— colorful post-its and pen—cannot be matched by any digital alternative (file sharing, projector, spreadsheets, etc).

The picture below depicts a great example from my last Inception. Without a previous encoding, the team decided to use the colored small post-its for personas. User Stories (in green post-its) were placed on white index cards containing numbers and estimated (with notes on the back).


On future posts: user story mapping for driving Inception, and a few notes on Inception facilitation

Cross-Functionality in Scrum

Paulo Caroli

Fri, 02/03/2012 - 00:18

Scrum recommends that a team should feature all the skills required in order to deliver the releasable product increment by the end of the Sprint. 
Why is it a good thing to have all the skills needed? It is all about dependencies. We try to design our software systems to be loosely coupled and highly cohesive. The same principles apply to team composition. We want our team to be like a special unit, self sufficient and able to deliver on the chosen assignment.So, what would happen if one significant skill is missing from the team? The team will have a strong external dependency and will need to ask for support from external sources. This is a huge risk. Will the team get access to the person at the right time for the right duration? This creates an additional drag factor and affects the delivery date or reduces the scope of the product to be delivered.
Scrum does not require cross-functional teams, it only recommends them. In practice they have shown to be a significant boost for productivity. Especially in combination with self-organization.
Often it is misunderstood that cross-functional means that any person in the team needs to be able to do all the upcoming work. This is wrong. The unit that needs to be cross-functional is the development team. The dev team has the responsibility to self-organize in order to maximize the usage of its skills.  Hence, the team might be composed of specialists only, however the sum of the individuals needs to possess all required skills.
Nevertheless, as described above, if you only have specialists then you will have rather large teams, as for every skill you will need at least one developer. This will cause larger than needed teams and probably all other kinds of problems: part time team members based on FTE mathematics, work organized by activity not by feature, bad ‘unskilled' estimates, ...
Therefore agile teams favor generalists, developers with a rounded and versatile skill set. I like to use the term specialized generalists, strong all-rounders with one top notch special area.

MongoDB: rename a field in all collections

Franklin Dattein

Thu, 02/02/2012 - 23:54

I would like to share a script to rename all fields in a collection. It can be used to update field values, as well.

var collections = db.getCollectionNames()

collections.forEach(function(collectionName) {
	var collection = db.getCollection(collectionName)
	collection.update ( {}, { $rename : { "oldFieldName" : "newFieldName" }} );
});

Google Drawing – another great tool for distributed retrospectives

Paulo Caroli

Wed, 02/01/2012 - 12:09
Yesterday I used Google Drawing for a distributed retrospective. I was very pleased with the tool.

The team members talked over a phone bridge (skype or similar would work as well).

Google Drawing was used to collect data on the main data gathering exercise for the retrospective.

Here is the picture generated at the end of the retrospective.

How did I use Google Drawing?

  1. I created a new document (empty canvas)
  2. I prepared the canvas; in this case I placed a picture representing the speed car – abyss retrospective exercise in the middle of the canvas with 4 text boxes identifying the 4 exercise quadrants.
  3. I shared it as a public document and emailed the link to the whole team
  4. I gave the instruction verbally and asked people to use Text Boxes for their notes
  5. I changed the text box color to blue for the notes which became action items
  6. I exported the drawing as a .png and emailed it to the whole group

Simple is good!

The only problem we faced: a few of us got an error message when creating a text box (I believe this was due to all 10 team members creating text boxes at the same time). But this only happened a few times. A simple refresh took the problem away.

Feedback at LESS 2011

Francisco Trindade

Tue, 01/31/2012 - 15:30
I’ve been to quite a few conferences in the past few years and one thing that is always a contention point is how to gather feedback from presentations. Solutions that I’ve seen go from feedback forms and putting votes in a ballot to high tech iPhone apps where you can register your impressions. At LESS [...]

Back the basics: What made this Agile Inception especial?

Paulo Caroli

Mon, 01/30/2012 - 13:32
The following two pictures depict the latest Inception I participated at.








A little bit of history: For the past two years I have participated directly in 3 Inceptions, and indirectly in 5 inceptions. By directly, I mean, I was sitting in the war room for most of the Inception sessions. And by indirectly, I mean, I was participating on the Inception sessions over video from a Nearshore location (onshore is San Francisoc, USA, nearshore is Porto Alegre, Brazil).

I attribute the success of the last Agile Inception to 3 things: collocation, war room, and colorful post-it.

Collocation

Don’t under estimate the value of a face to face interaction. I am currently in Brazil and I am used to having effective meetings over video and phone with USA. I know that technology can bring people closer together, and, perhaps, we can work together without sitting next to each other. However, the face to face during Inception will bring the team together in a way that it will be worth each penny spend for making the collocated Inception a reality.

I compare it to dating and internet dating. Relationship development goes to another level when the whole team is at the same room. Think creatively on how to save on costs. In our case we were able to reduce the collocated period by having a pre-Inception period before the collocate Inception. Spikes, research, data gathering, codebase analysis were the sort of activities we did in the pre-Inception week.

War room

Keep a single room for the team during the intense Inception period: the war room! The room should fit all team comfortably. It must have a clean table and wall space. The room should also have a cabinet or a box with index cards, colorful post-its and pen.

The war room makes the environment for collaborative sessions. It also avoids the waste of time of people moving from one room to another. Another important point is about carrying the information between rooms. You can either carry all hand-written notes (index cards, post-its, flip-charts, etc) and put them back in the wall and tables, or upload them on a digital format and carry it on your laptop. The former option is a waste of time. The later lessens people interaction. There is no replacement for writing on and tearing apart colorful post-it or index cards. Once the information goes to the computer, it will not get back to paper. People interaction reduces as there is nothing on the table to gather around.

colorful post-its

Do not bring a list of existing user stories to the Inception. I am sure there is a list somewhere (excel, Jira, or alike). Use it for reference, but don’t use it for driving the Inception sessions. Print a few copies and bring them to the war room. Let people consume it if required. Try not to read items from a list during a collaborative session. In fact, do not build a list while in a collaborative session.

Group people around colorful post-its. Write and place post-its either on the table or at the wall.. Talk about them. Write a few more. Tear them apart. Make use of colors. Reorganize it. The collaboration from using such basic, low-fi technology— colorful post-its and pen—cannot be matched by any digital alternative (file sharing, projector, spreadsheets, etc).

The picture below depicts a great example from my last Inception. Without a previous encoding, the team decided to use the colored small post-its for personas. User Stories (in green post-its) were placed on white index cards containing numbers and estimated (with notes on the back).


On future posts: user story mapping for driving Inception, and a few notes on Inception facilitation

Graphical Recording, the Cheap Way

Francisco Trindade

Tue, 01/24/2012 - 15:30
A couple of months ago I did a graphical facilitation training with fellow Thoughtworkers in Sydney. The training itself was excellent and gave us a much better understanding on how to use graphics to facilitate a meeting/workshop. Unfortunately I haven’t been in many situations that would allow me to use those skills lately, but wanting to [...]

AmazonSESSMTPAppender for Log4J

Franklin Dattein

Mon, 01/23/2012 - 01:12

Log4J can easily send e-mail notifications   every time an error occurs. It is particularly interesting and a very powerful functionality for production environments. However,  the default SMTPAppender lacks support for SSL enabled SMTP servers and it is also not easily configurable according to the environment.

This is an enhanced version of the Original SMTPAppender, which supports SSL and is environment aware.

package com.dattein.logging;
import javax.mail.PasswordAuthentication;
import javax.mail.Session;
import java.security.Security;
import java.util.Properties;

public class SMTPAppender extends org.apache.log4j.net.SMTPAppender {

    public SMTPAppender() {
        Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
    }

    @Override
    protected boolean checkEntryConditions() {
        //Obviously you have to use your own environment aware mechanisme, instead of the line below
        return Environment.isProduction();
    }

    @Override
    protected Session createSession() {
        Properties properties = new Properties();
        properties.setProperty("mail.transport.protocol", "smtp");
        properties.setProperty("mail.host", getSMTPHost());
        properties.put("mail.smtp.auth", "true");
        properties.put("mail.smtp.port", getSMTPPort());
        properties.put("mail.smtp.socketFactory.port", getSMTPPort());
        properties.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
        properties.put("mail.smtp.socketFactory.fallback", " false");
        properties.setProperty("mail.smtp.quitwait", " false");
        Session session = Session.getDefaultInstance(properties, new javax.mail.Authenticator() {
            @Override
            protected PasswordAuthentication getPasswordAuthentication() {
                return new PasswordAuthentication(getSMTPUsername(), getSMTPPassword());
            }
        });
        return session;
    }
}

That is how you use it:



"/>
"/>






        

        
    

    
        
        
    

If you are wondering how to activate the Amazon SES SMTP server, check this out:

https://console.aws.amazon.com/ses/home#smtp-settings:

Beyond Budgeting at LESS 2011

Francisco Trindade

Thu, 01/19/2012 - 15:00
One of the things that attracted my interest to LESS 2011 was the Beyond Budgeting track. Having read the book a couple of years ago, it is definitely a topic that catches my interest. And it was even better that the first keynote was presented by Bjarte Bogsnes, talking about how beyond budgeting is used at [...]

Então você quer aprender REST?

Daniel Wildt

Tue, 01/17/2012 - 08:00

Mando alguns resources. :-)

Conceitos de REST?
Importante ler sobre o material de Roy Fielding. E olhar o material sobre REST da Wikipedia.

Outro artigo é o que saiu na InfoQ. Tem tradução na InfoQ Brasil.

Livro?

Indico o Rest in Practice, do Jim Webber.

Exemplos de API para trabalhar com o REST? As APIs listadas abaixo são em alguns casos baseadas nos conceitos de REST, mas já vão ajudar em muito.

Ferramentas para trabalhar?

Vou indicar apenas duas:

  • Restfulie – projeto liderado pela galera da Caelum, que vale apena ser observado, seguido e apoiado.
  • Jersey – API Java muito consistente para fazer trabalhos com REST.

 


Tagged: rest

Two wrongs do not make a right

Marco Valtas

Thu, 01/12/2012 - 11:17

In the software development business there’s some well known currencies, these currencies are used to value an employee and the employee (dev, architect, QA or manager) struggle to achieve them as they make their employment more stable or more profitable, this fact goes probably for all work environments. Some more common is productivity (whatever way it’s measured), proactivity, efficiency, leading, domain knowledge. Whatever the company values the employee will try to make himself/herself good at it.

Companies, whatever they value, have to pay attention to these values, misunderstanding what they mean and evaluating it wrong will lead to employees behaving as they’re measured, which it turns out not to be the value glued in a beautiful frame on the wall.

One in particular that I want to focus is “domain knowledge”. I’ve seem much misunderstanding of this skill inside big companies. Let’s say that you work on a big company that develops software. Some old time folks would be considered valuable because the have a lot of “domain knowledge”, which usually translates in knowing the technology stack and how it works and its implementations, that’s supposed to be good, right?

An employee with this kind of knowledge is essential to help new comers to understand what is happening and how to deal with the application, how to improve it without breaking it and how to modify it. This is a good thing and companies are right to be worried about retaining such employees.

Gaming the system is easy though. This is where I find hard to deal with in legacy systems. Much of the systems that I saw are not so complex in essence but they are a bad coded software. Domain Knowledge experts know the way around it because they wrote the thing in first place but often do not know the business concerns behind it. It turns out that this “domain knowledge” is just a background of the past bad code written.

In such situations two wrongs do not make a right, bad code is bad code, knowing how was written doesn’t make an expert it is just half of the knowledge needed, it is still missing the knowledge of the problems the software was trying to solve. I expect from an expert to know the problem and the current solution and be able to discuss new solutions for the same problems as well find out other problems. Companies have to be aware of that otherwise employees regarded as experts might be only gaming the system and holding the company back on innovative solutions.

uMov.me – 1 year after public launch

Daniel Wildt

Wed, 01/11/2012 - 13:17

Since May of 2009 I’m playing as CIO / CTO for Trevisan Tecnologia, a mobile development company located in the south of Brazil.

My mission here is to create a new culture and help grow the company teams to enable the creation of new products. When I say culture I mean creating a Learning culture based on Lean and Agile practices. Our team is growing a lot and will keep growing. When I say new products, I’m saying Lean Startup style.

Today is a great day. uMov.me is completing 1 year after public release. uMov.me is a mobile platform that enables companies to deliver quality corporate mobile apps faster to the market. It’s simple, fast to develop, and you can find what you need to develop corporate mobile applications.

The good thing is to look back and see amazing things our team done, not only technically but also looking at the product itself. I’m proud to be part of this team.

We have published an infographic telling a bit of the story of this past year.

uMov.me infographic


Tagged: agile, fun, teamwork, uMov.me

Keeping QuickSilver up with Launchd

Marco Valtas

Tue, 01/10/2012 - 20:59

OS X launchd spawn processes and manage them, you can actually make use of it to help you out on OS X automation. I had the same exactly thought that Diego Zamboni had when wrote this blog post four years ago.

QuickSilver became part of my interactions with OS X for a while but QS is not perfect and sometimes crash or needs to be restarted. As Diego felt, I felt that when QS quits is annoying go chasing it again to restart it. For this launchd can help you.

Start by disabling the Start at Login option of QS in its preferences.

After that adding the below XML as ~/Library/LaunchAgents/com.blacktree.Quicksilver.plist will do the trick of keep QS running, if it quits, it will be restarted automatically.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
  <dict>
    <key>Label</key>
    <string>com.blacktree.Quicksilver</string>
    <key>LimitLoadToSessionType</key>
    <string>Aqua</string>
    <key>KeepAlive</key>
    <true/>
    <key>ProgramArguments</key>
    <array>
      <string>/Applications/Quicksilver.app/Contents/MacOS/Quicksilver</string>
    </array>
  </dict>
</plist>

You can check the this Technical Note for a lot of details. But I will give a short explanation of what we have here.

  • Label – It’s mandatory to identify the job and has to be unique, it has to match the file name (without the suffix .plist)
  • LimitLoadToSessionType – The context the job should run, Unix fellows this is similar to run levels. The value of Aqua means full GUI.
  • ProgramArguments – Is actually what we want to run. Check the man launchd.plist and execvp(3) on the Terminal for more information.

That’s it, log out and log in back again and you should see QS running. If you want to test if launchd is managing your QS just quit it and you should see it running back again.

Setting up a Mac for Development

Marco Valtas

Sun, 01/08/2012 - 20:24

Recently I got a new Mac and setting up for development is always fun, so I decided share some of the setups I do on a new Mac.

Is a Mac a good machine for development?

I think so and also know folks that think Linux is better, some are more use to Windows. In the end I think is not the OS which makes a better development machine (although there’s space for some debate here) but how you deal with it. Take a look on The Productive Programmer by Neal Ford for some other tips.

What to keep in mind

As you setup a machine for development some things you should keep in mind. First is you want to lower the keyboard to mouse time. Taking your hands off the keyboard to point to a link in a webpage and then going back is time consuming, a developer goes from the IDE to the browser lots of time during the day.

Make the computer do what you’re thinking without much effort, few keystrokes should take or do what you want. Going through menus, mouse, chasing windows on the desktop are also time consuming, unproductive and (for me) annoying.

If you do twice, think about how to do with one keystroke. If you caught yourself repeating something, think in a way to automate it (if makes sense). Apple has AppleScript and Automator which you can use to make simple scripts for mundane things.

Keep your projects and files organized, this goes for every developer. Not knowing where the files are leads you to browsing around to find them, avoid that. I have a Projects directory and an alias gp that goes to this folder, plus gp project takes me direct to the project folder. If you have some suggestion please do so (use the comments), I’m keen to know how you make your environment more smart and fast.

Now, some of the things I do on my Mac for development.

Disabling the Dashboard

I tried to use, make some meaningful use of it but never achieved, it just sit there. In Lion it turned to be a little more annoying as it shows on Mission Control view. Disabling the Dashboard is pretty easy, go to the terminal and issue this command:

defaults write com.apple.dashboard mcx-disabled -boolean YES

And restart the Dock:

killall Dock

Get iTerm 2

OS X has its Terminal application but iTerm 2 has some features that I really like, one is the Hotkey Window which you can trigger by a keyboard shortcut and it come and goes easily.

One tip for Lion users, if you use multi desktops set iTerm 2 to be available in All Desktops. You can achieve this by control + click on iTerm icon in the Dock and selecting Options – Assign To – All Desktops. This way when you invoke Hotkey Window it will not shift from desktop to desktop.

Get QuickSilver

QuickSilver is a very powerful application for action at distance. Some of you might know Alfred (check the app store), in Linux the Gnome Do and on Windows I recall Launchy.

On a Mac I prefer QuickSilver, mind that it is not just a Application launcher it can do a lot more than launch applications.

Get Dropbox

I use dropbox for a lot of file transferring and storage, specially when I change machines it helps to avoid the USB stick protocol.

Get Caffeine

A development machine that keeps dimming the monitor, going to screensaver and sleeping because you took more than five minutes to type doesn’t help you. Caffeine when on don’t let this happen, it’s way more easy than changing Energy Saver configurations.

Get iStat Menus

This one is paid. I use to keep and eye on CPU, Memory, Hard drive access and Network usage. Also it can replace the battery level indicator and the date menu on the Mac. This is a habit that I’ve acquired working with Linux for long time and Bubblemon.

Get Xcode

Although I don’t develop for Mac, Xcode is needed because it brings a lot of libraries for development that it’s needed for a dev.

Get Home Brew

Or another package manager for Mac as MacPorts. You will need to install other packages into your Mac. Unless you’re a fan of compiling everything you need something similar to apt-get to your Mac.

Get GleeBox

I can’t image myself using a browser without GleeBox. It makes easier to find links, form items, issue bookmarkslets on a page and more. Is one more application to lower the keyboard to mouse time.

Turn on keyboard access to all controls

In the System Preferences go to Keyboard then keyboard shortcuts and turn All Controls. Now you can use tab to navigate through windows buttons and fields.

If you use Safari, turn “Tab” for links

It doesn’t come with the “Tab” to links enabled by default, just to go to its preferences advanced and turn Press Tab to highlight each item on a webpage.

Get a real Text/Code editor

I use Vim and usually is the first thing that I install in any computer that I use. MacVim is the Vim for a Mac. Also I don’t like the menu if you also don’t like add to your ~/.gvimrc:

set guioptions=-T

Learn some common shortcuts of OS X

One of the good things about Apple software is it tries to be consistent over the keyboard shortcuts. The famous Command + , in almost every software that runs on a Mac takes you to the preferences of the app.

Another good one is Command + ? which takes you to the help menu, plus there’s a search that can show you a entry on the menu. If the app doesn’t not provide a shortcut for the action you’re trying to make you can use this one to go there.

Page Object Pattern + WebDriver + Spring

Roger Almeida

Sat, 01/07/2012 - 21:21
During the last week I had start creating a test suite for a existing web-application which my team is currently working on. So now is good time to share some experience:


The application
A normal old java web application: Java 1.4, Struts 1.1, EJB 2.1, JDBC to persist the data and the anemic design (VO+BO+DAO) but I will talk about in another post...


Page Object Pattern
To map the web page's components inside the test code I used the page object pattern.
This patterns helped me to eliminate duplicated code to access web-page's components.

Basically it consists of classes that maps web-pages, so that if you want to fill a login form from your test classes instead of doing this:

  @Test  
public void someTest() throws Exception {
WebElement userNameField = driver.findElement(By.name("j_username"));
userNameField.sendKeys(username);
WebElement passwordField = driver.findElement(By.name("j_password"));
passwordField.sendKeys(password);
WebElement logonButon = driver.findElement(By.xpath("/html/body/center/table/tbody/tr[2]/td/form/input"));
//asserts
}

You do this:

  
@Test
public void someTest()throws Exception {
loginPage.open();
loginPage.logon(properties.getUsername(), properties.getPassword());
//asserts
}

And inside your LoginPage you have:

   public void logon(String username, String password){   
String username = readUsernameFromFixture();
String password = readpasswordFromFixture();
WebElement userNameField = driver.findElement(By.name("j_username"));
userNameField.sendKeys(username);
WebElement passwordField = driver.findElement(By.name("j_password"));
passwordField.sendKeys(password);
WebElement logonButon = driver.findElement(By.xpath("/html/body/center/table/tbody/tr[2]/td/form/input"));
logonButon.click();
}

One thing that I would like to mention here: Keep your assertions in the test class. The idea of the PageObject class is to keep the maps to the web-page's components and to have some helper methods like the example above, not to have assertions.

Wire things togheter.

So now you will have your test class depending on many of the PageObjects, and each PageObject classes also depends on WebDriver:

IMHO is really boring to wire the classes manually, so there comes in Spring.
Spring is very helpful for tests, it is worthy to check the spring documentation about tests.
With simple annotations and just one piece of XML you can wire the pieces together. Check how will be the annotated sample test class:

package br.com.bright.halfprehalfpospaidapplication.test.online;  
...
imports...
...
@ContextConfiguration(locations = "/applicationContext.xml")
@RunWith(SpringJUnit4ClassRunner.class)
public class ExpireNoUsedCreditsFunctionalTest {
@Autowired
private LoginPage loginPage;
@Autowired
private HomePage homePage;
@Autowired
private ViewMobilePage viewMobilePage;
@Autowired
private ViewMobileResultPage viewMobileResultPage;
@Autowired
private AuxiliaryClassToCheckDataBase akaDaoOrRepository;
@Autowired
private MenuPage menuPage;
@Autowired
private Properties properties;
private Integer statusBeforeTest;
private Integer codeUnderTest;
@Before
public void setUp() {
statusBeforeTest = null;
codeUnderTest = null;
}
@After
public void tearDown() {
if (statusBeforeTest != null) {
akaDaoOrRepository.updateStatusByCode(statusBeforeTest,
codeUnderTest);
}
menuPage.Logoff();
}
@Test
public void noCreditsToRevert() throws Exception {
...

Yes my friends, you can inject dependencies inside private attributes! :O
Your PageObject classes have to be Spring Bean as well, so that Spring will be able to inject them in your test class:

package br.com.bright.thesameapplication.test.online.page;  
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class LoginPage extends PageBase{
@Autowired
public LoginPage(WebDriver webDriver) {
super(webDriver);
}
public void logon(String username, String password){
WebElement userNameField = driver.findElement(By.name("j_username"));
userNameField.sendKeys(username);
WebElement passwordField = driver.findElement(By.name("j_password"));
passwordField.sendKeys(password);
WebElement logonButon = driver.findElement(By.xpath("/html/body/center/table/tbody/tr[2]/td/form/input"));
logonButon.click();
}
}
And in order to inject the WebDriver in the constructor as a dependency we need it to be a Spring Bean as well, but you cannot annotated it as we just downloaded the WebDriver's jar. To solve that we will use the xml piece. Check this out:
         http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">




























Next Steps...
Normally when we are coding a test suite for a application we end up with a DSL for the application. Probably I will end up with a parent class with some useful method to interact with the application.
Also as I write this post I found a useful information about a page factory built-in WebDriver's support library. It seens to be very helpful.
See you later.

2011 in review

Daniel Wildt

Sat, 12/31/2011 - 18:14

The WordPress.com stats helper monkeys prepared a 2011 annual report for this blog.

Here’s an excerpt:

A New York City subway train holds 1,200 people. This blog was viewed about 5,700 times in 2011. If it were a NYC subway train, it would take about 5 trips to carry that many people.

Click here to see the complete report.


Tagged: fun

Revendo 2011: é dia de Java, Java One Latin America e RSJUG de volta!

Daniel Wildt

Tue, 12/27/2011 - 07:00

Então, dias 26 e 27 de agosto ocorreu o É dia de Java 2011, evento realizado na UFSCar junto com a galera do SouJava. Eu tive duas participações no evento, primeiro fazendo o workshop “Da visão a Produção” na sexta-feira a noite. Depois do workshop fui fazer um lanche com Fabio Velloso, Wagner Santos e Dalton Stoqui, e infelizmente foi a primeira vez que eu perdi para um Xis/Bauru/Sanduiche. No sábado fui palestrar sobre métricas, com uma palestra chamada “Da métrica a diversão“. Os fontes usados como base estão aqui no github.

Em novembro de 2011 estava grande a expectativa pelo Java One Latin America. E quando saiu a lista de palestrantes aceitos, lá estava eu! Tive a oportunidade de falar sobre eXtreme Programming, integração e entrega contínua de produtos. Falei sobre diversos tópicos, sobre a importância de termos feedback do nosso cliente sobre o que está sendo desenvolvido, sobre Lean Startup, sobre práticas do eXtreme Programming e depois mostrei alguns exemplos de como podemos “ganhar” em produtividade de deploy de aplicações. Mostrei um exemplo de script Ant fazendo a automação para deploy de um aplicativo no TomCat 7, rodando antes disto uma série de ferramentas para apoio a automação, com testes e auditoria de código. Em outro exemplo, mostrei um aplicativo feito com Play Framework, fazendo deploy no Heroku. Mais sobre a palestra:

Integração e entrega contínua de produtos? Que venha o eXtreme Programming!

Ser capaz de realizar um deploy de forma contínua não requer apenas habilidades no processo de deploy. E não tem nada a ver com reações rápidas a mudanças ou iterações curtas. Tem a ver com prevenção e aplicação de práticas de engenharia de software efetivas. O objetivo desta palestra é falar como as práticas do eXtreme Programming podem ajudar times Java a alcançarem a qualidade de código necessária para que se possa liberar software em produção de forma contínua e segura. Veremos ferramentas opensource, métricas, automação e riscos minimizados. Com participação da equipe toda e melhoria contínua. Lembre-se: entregar software em produção, para fazer bug fix / patching, não é entrega contínua. É bagunça generalizada, que pode ser evitada.

E para fechar 2011, fizemos a “reativação” do RSJUG, o Grupo de Usuários Java do Rio Grande do Sul. Com o apoio de Leandro Nunes, fizemos um evento fazendo um repeteco da minha palestra do Java One Latin America e depois um bate papo para entender como a comunidade do Rio Grande do Sul pode voltar a fazer eventos e criar novas ações. Fizemos uma relação de atividades que poderão ser desenvolvidas em 2012.


Tagged: agile, continuous delivery, continuous integration, java, lean startup, metrics, open source

Changing PATH variable in a more organized way.

Marco Valtas

Tue, 12/20/2011 - 21:35

This is more a note to self than a full post. This week I’ve been configuring my new laptop and again I had to configure the PATH variable for some applications and scripts.

Usually you will create a .bash_profile at your home folder and change the PATH like this:


PATH=~/bin:/some/new/application/bin:${PATH}

export PATH

Two simple Bash functions can make this more elegant, I have:

unset partial_path
_push_to_path () {
	if [ -z ${partial_path} ]; then
		partial_path=${1}
	else
		partial_path=${partial_path}:${1}
	fi
}
_export_path () {
	export PATH=${partial_path}
	unset partial_path
}

And then you can on your .bash_profile:

_push_to_path "~/bin"
_push_to_path "/some/new/application/bin"
_push_to_path $(launchctl getenv PATH)
_export_path

This is a little more organized and easy to maintain. Note the last line, on OS X you can add back the system path by asking launchctl to give you the system environment entry for PATH.

That’s it.

Agile Micromanagement, the good and the bad

Paulo Caroli

Mon, 12/19/2011 - 08:46
Jim Highsmith wrote an interesting post about micromanagement. He mentioned Steve Jobs and Bill Gates are good examples of successful product manager micromanagement. I totally agree with that.

He also talks about the Agile process micromanagement. Experiencing both worlds, waterfall and agile as a developer and a manager. I have a strong opinion about it. Agile is all about micromanaging!

Consider these:

  • You are coding and someone is talking about your code as you type it (Pair programming).
  • Every day you stand up and tell the whole group what you did yesterday and what you will be doing today (Daily Scrum meeting).
  • You retrospect about what you did well and what you can improve on (Retrospective)
  • You show everybody exactly which task you are working on and how it is progressing (Visible card wall)
  • You respect work in progress limits (Kanban WIP limit)
  • You make a code commit and let everyone know about it. (Continuous Integration)

The more I think about it, the clear it is to me: Agile is all about micromanagement. The good or bad depend on how people adopt its principles and practices. I have experienced many benefits that come from such micromanagement. In fact, when I look back at all projects I participated on, the projects I consider more successful (people enjoying working, delivered great products and improving the work process) are the ones with lots of micromanagement.

Come & join us!

ThoughtWorks isn't your average company, so we don't hire average people. Interested ...?

find out more >