Know more and connect with me on [Linkedin Profile].

Tuesday, December 08, 2015

GUI Test Automation at End of Release

Today, I was consulting Egyptian company in Cairo. They had an objection to the CEO request to write automated GUI tests per sprint. Typically, he asked them to include that GUI test automation as a done definition per story, so the story will not be scored as done if its related automation was not totally done. The team suggested to delay that test automation to the end of release, as the GUI is constantly changing and that made them re-record all their automated tests again and again even with the smallest change to the GUI. This rework was not just a waste of effort but also a disappoint. In addition to that,  some team members suggested to delay database unit testing and code unit testing also to the end of release.

Sure, we have flexibility in Agile, but some customizations could easily destruct the whole Agility concept. This one is typically one of them. A decision that could revert us back to old traditional ways of development and makes us follow hollow agile rituals.

First: We had a big issue in the team discussion, as their talks was opinion oriented, that could lead us to endless discussions to explain opposing points of view without getting a crisp image and rational decision. That meant in our case is to have data. How many tests are re-recorded? How much effort does it take? Why the user interface is so sensitive that much, to any change even if it is a small change? Without crisp and clear understanding and without measures we are deciding in a blind mode assuming many things all at once.

Getting facts and metrics is affordable in Scrum. As we have short cycles of complete software development efforts, we have the great opportunity to experiment and collect data to have solid feedback that could help us steer our development techniques in a really short time. This cycle is typically two weeks in  the mentioned organization. So instead of debating subjectively about some technique, why not make an experiment in a sprint and see the result. So, I advised the team to plan a sprint, collect data abd  talk with the CEO with facts, instead of opinions and fears.

Doing the automation at end of release can lead to a disaster. We will stretch the feedback loop of the test automation to the release level. Not only that, it will also show us a deceiving velocity of sprints, as by end of release we have to spend un-known amount of days recording the automated tests. In addition of that, the experimentation idea of short cycles is dead. Now we have to experiment on the level of release! what a long time! So, by all means we should delay that route as a last resort of action if at all.


Tuesday, November 03, 2015

Agile Manifesto Principle 7


Agile Manifesto Principle 7: Continuous attention to technical excellence and good design enhances agility.

In waterfall projects, the technical excellence happens at the start through focus on good design and architecture, and happens again at the end of the project by focusing on finishing features and fixing bugs. In the middle, do whatever or in best cases, the technical excellence is reduced in favor of just delivering a working product.

In Agile projects, continuous attention to technical excellence is happening all the time through Test Driven Development and continuous refactoring. Also, there is a continuous attention to quality through validating stories with the customer and bug fixing.

If one of the core concepts of Agility is responding actively to change, then having technical excellence will help us responding to change. No doubt, changing a system that is bug free and have a good design is much easier that changing a system that has poor design and has lot of bugs.


Monday, October 26, 2015

Just discovered ethical principle in Agile Manifesto!

I instructed Agile introduction course many times. Every time I explained the 12 Agile Manifesto principles I felt a repetition of ideas between Principle 1 and 3.

Here a copy of the two principles:

Principle1: Our highest priority is to satisfy the customer through early and continuous delivery of valuable software.
Principle 3: Deliver working software frequently, from a couple of weeks to a couple of months, with a preference to the shorter timescale.

I was explaining principle 1 as; Customer satisfaction is everyone's ideal, so the core intent of that practice lies in the sub-statment of "Early and continuous delivery of valuable software". And when I was explaining Principle3, I just emphasis the exact time frame mentions as, "from a couple of weeks to a couple of months" with  the principle preference to shorter timescale.

Today, it jumped to my mind that, the first principle is not just about delivery of software, but about the principle of satisfying the customer through and only through valuable software. This excludes any corrupted ways of satisfying customers. So the principle is turned to be an ethical principle that eliminate the use of bribe, cheat or corrupted means of satisfying the customer. Another point is that, we should be delivering "valuable software" not just software. Delivery of valuable software that meets customer needs, used by users and enhances customer's competitive advantage, not a buggy or crappy software.

Thank you writers of the Agile Manifesto.



Just discovered ethical principle in Agile Manifesto!

I instructed Agile introduction course many times. Every time I explained the 12 Agile Manifesto principles I felt a repetition of ideas between Principle 1 and 3.

Here a copy of the two principles:

Principle1: Our highest priority is to satisfy the customer through early and continuous delivery of valuable software.
Principle 3: Deliver working software frequently, from a couple of weeks to a couple of months, with a preference to the shorter timescale.

I was explaining principle 1 as; Customer satisfaction is everyone's ideal, so the core intent of that practice lies in the sub-statment of "Early and continuous delivery of valuable software". And when I was explaining Principle3, I just emphasis the exact time frame mentions as, "from a couple of weeks to a couple of months" with  the principle preference to shorter timescale.

Today, it jumped to my mind that, the first principle is not just about delivery of software, but about the principle of satisfying the customer through and only through valuable software. This excludes any corrupted ways of satisfying customers. So the principle is turned to be an ethical principle that eliminate the use of bribe, cheat or corrupted means of satisfying the customer. Another point is that, we should be delivering "valuable software" not just software. Delivery of valuable software that meets customer needs, used by users and enhances customer's competitive advantage, not a buggy or crappy software.

Thank you writers of the Agile Manifesto.



Saturday, July 25, 2015

Managing Browser Back/Forward when you use JqueryMobile

I am using JQueryMobile for building website that works on Mobile, tablet, and desktop computers.

As my application is an Ajax application. I wanted to control the browser URL in order to enable browser back/forward button in my Ajax single-page application.

The solution is really easy, whenever you want to change the location call

location.hash = "456";

This will update browser URL as following:

       http://mysite.com/myfolder/index.html#456

Of course passing your own application specific hash

Whenever the user click back or forward, you need to handle the following event:

window.onhashchange = function () {

        //Use location.hash and update your application display as you need

};

Until now everything is perfect. But if you are using JQM (JqueryMobile) you will face trouble.
JQM uses hash to manage the transition between multiple pages and dialogues. While doing so, it update the localtion.hash.

The best workaround for this is to let JQM leave location.history alone. This can be easily done by:

$.mobile.changePage("#my-page", {changeHash: false});

As you see, the second parameter is an object with many option, what we need here is:

      changeHash: false

And viola, now you have full control of your location hash.

What is a downside is that it will impose burden on you to control all page/dialogue changes yourself. you can not simply use:

        href="#my_other_page"

Because JQM will simply change it but will update browser hash.


Links:
https://api.jquerymobile.com/jQuery.mobile.changePage/






Wednesday, July 22, 2015

Being a Javascript Expert

Recently I am focusing to be an expert in Javascript. Being an expert is not an easy task. I have to focus as much as I can. If you know how much technologies I learned and worked in lately, you will know how I am distracted. I developed iphone, android and web applications using Java, Python, and new frameworks such as AngularJS, Jquery Mobile, Python Django and Cordova frameworks.

I want to focus all my new projects around Javascript to master the client side. Given my long experience, I should be an expert in something to show my strength in that very competitive field.

Currently my objective is to move to new meaty javascript projects and study Javascript as much as I can.

Wish good luck to me ;)

Saturday, May 23, 2015

Discarding Arabic Diacritics From Text


To strip out diacritics from Arabic text, this is a little code in Python that I like a lot.

    import unicodedata
    return filter(lambda c: unicodedata.category(c) != 'Mn', s)

Look how it is elegant and small. Just one line with Lambda expression and a check of which the letter is unicode diacritics or not.

The same job can be easily done in regular expressions with javascript. Look at this Javascript code:

function stripAccents(text) {
    return text.replace(new RegExp('[\u064B-\u065F]*', 'g'), '');
}

It is one line that find one or more vowels in the range from u064B to \u065F and just replace it with no thing.

Thanks to lambda and regular expressions. Both are really smart and helpful.



Java and Arabic Support

[THIS IS AN OLD ARTICLE, I republish for the sake of benefit to friends]

Java uses Unicode as native encoding, so any text will be converted to Unicode for proper handling. Java already has support almost to all known encodings, see: http://java.sun.com/products/jdk/1.1/docs/guide/intl/encoding.doc.html.

Our involvement is how to adjust the input and the output; the Input will be from request parameters (in case of web development), files, Properties, and JDBC. The output will be to the browser through the HttpServletResponse object or a file, ...


Converting text strings:

  • String class already has support to conversion to Unicode; see String constructors that take encoding as a parameter.
  • String class can convert to any encoding; see getBytes() function that take encoding parameter.
  • String class content at anytime must be Unicode, so it can convert non-Unicode input to Unicode or give you the non-Unicode bytes upon request by getBytes().
  • A running examples is available at http://java.sun.com/docs/books/tutorial/i18n/text/string.html
  • You can also use Charset, CharsetDecoder and CharsetEncoder.

Accessing files: (Input/Output)

You can access files, using normal Java classes but be aware that if you did not specify certain encoding, the file input classes will read the system property file.encoding and convert the file content to Unicode based on it.

To know the system file encoding, read System.getProperty("file.encoding")

So if you are writing I18n (Internationalization) applications, you should specify the encoding when you are reading or writing to files:

Use InputStreamReader and InputStreamWriter to specify encoding wanted, see Character and Byte Streams at: http://java.sun.com/docs/books/tutorial/i18n/text/stream.html

Request Input Arabic Parameters:

If you want to pass Arabic text in URLs, you will get the Arabic as the default system encoding, Cp1252 in a Unicode string, you should convert the parameter back to Cp1252, then to Unicode as an Cp1256, see the example:

String aParUnicode = request.getParameter("apar");

byte [] by1252 = aParUnicode.getBytes("Cp1252");

aParUnicode = new String(by1252, "Cp1256");

By the introduction of Servlet 2.3 you can set the encoding of the request and get the parameters as Unicode correctly.

request.setCharacterEncoding("Cp1256");

Response and Locale Object:

Each running application already have Locale object, server applications should specify Locale that matched its language, this will give support in automatic conversion to strings based on this locale, please look at Locale class. The ServletHttpResponse already have a member to set locale called, setLocale

By default Locale is set to en (English) even if your default Windows language is Arabic, so all Unicode will be converted to 8859_1 (Latin1). When you set Locale to ar (Arabic), all Unicode will be converted to 8859_6 (ISO Latin/Arabic Alphabet) and will be displayed correctly as Arabic (ISO).

ISO8859_6 is better than Cp1256, as its compatible with Unix/Mac and Windows, not just Windows.

Properties class:

Properties class are hard coded to read files that encoded as 8859_1 any other characters should be written as Unicode escape character sequence. You can still write Arabic in key values, by it will be converted to Unicode as an 8859_1, so you should convert the Unicode back to 8859_1 and convert to Unicode as Cp1256 or whatever the file real encoding.

String Arabic1256 = new String(latin8859_1.getBytes("8859_1"), "Cp1256");

The above example convert the string from Unicode back to 9959_1 and then back to Cp1256, and assumes the properties file was written using ANSI Cp1256.

  • An alternative solution is to use NetBeans IDE to write Arabic in keys and the NetBeans automatically will convert it to Unicode escape character sequences back and forth, so you always see it Arabic and always stored in the properties file as an escape Unicode character sequences.

JDBC:

Once you have the characters as String Unicode , its already converted to Unicode, so you can convert back to the original encoding and convert to Unicode correctly, some JDBC drivers give you the option to set the charset for the JDBC to make proper conversion like MySQL, the SQL server driver convert to Unicode correctly based on the dbase encoding as selected when you create the dbase.

Be careful if you are using JDBC-ODBC bridge with Access dbase, the driver usually failed to convert Arabic characters to Unicode if your default Windows language is not Arabic.

References:

Java Tutorial Internationalization:
http://java.sun.com/docs/books/tutorial/i18n/index.html

Good ole' ASCII :
http://czyborra.com/charsets/iso646.html

The ISO 8859 Alphabet Soup:
http://czyborra.com/charsets/iso8859.html

J2sdk1.4.0 documentationa and API doc:
http://java.sun.com/j2se/1.4/docs/guide/intl/index.html

>Originally written in 22/5/2002

Python Language

With Python, I write one quarter of the equivalent Java code !!
Java code is a waste of life :)

I think the same applies for C# if not worser than java.

Python is really a simple design and Agile programming language, IMHO.