Question : Will a GUID lose it’s uniqueness when you remove the dashes (-)?

Today while I was fixing an issue at TeamMentor, I wanted to play around with the URL manipulation.

Url manipulation

I tried to remove all the dashes (-) from the URL  GUID to see what would be the behavior. And I was able to see the same article without any side effect (by side-effect I mean that the result was the same).

integrity

I was wondering if the fact of removing the dashes from a given GUID should cause any damage to the integrity of that GUID. I did a quick search on internet and I found this thread at StackOverflow called “Is good idea to remove dash from a GUID?”

The short answer given to this question is that the integrity or uniqueness of the GUID is guaranteed even after removing the dash. Also in this thread, some of the folks state that dash are added for readability purposes. The anatomy of a GUID is described here

In fact  by reading this thread at StackOverflow, I discovered that using .Net you can generate a GUID without the dashes. I used PowerShell to give it a try.

PS

Posted in GUIDS | Tagged , | 1 Comment

Standardizing TeamMentor branching names

I started working on fixing some small issues at TeamMentor with the idea in mind of understanding the branching model that GitHub offers, along with the idea of getting involved with all the workflow at  TeamMentor.

So namely we review the issue list and then we create a branch to address the issue. When it comes to branches, we believe it would be great to standardize it, so all the developers can follow the same pattern. This approach will help us to be all in the same page.

Therefore if you are working in the 235 issue, we believe that we follow the Issue + Underscore + Issue number pattern :

So if you are fixing Issue 235, the name of the branch should be Issue_235.

This approach will help us to track what issue is being addressed in the branch. And it’s important that we are addressing an issue at the time. Having said that, we will have a branch per issue.

This is a small example that will help us to do things better!

Posted in Uncategorized | Tagged , , , | Leave a comment

How to design an application using AngularJS if you are familiar with jQuery?

I found a very interesting question at StackOverflow (which has a lot of reputation and a very good approach), so the idea here is to point this question so it can give us an idea on how to address the fact of design applications using either jQuery or AngularJS.

The question was How do I “think in AngularJS” if I have a jQuery background?

Don’t get me wrong :), the idea here is not to create a debate on what is better, no that is not the point. The main idea here is to understand the power of both frameworks and that both of them can be used depending on our needs :).

I hope it helps to guide us on the right direction.

Posted in Architecture, Standardization | 1 Comment

Some jQuery selectors works on Firefox console, even though jQuery hasn’t been referenced

While we have seen the power of AngularJS (which looks very promising ), it seems like this framework is a good candidate for our future implementations. At the time of writing this article (April 29th, 2013), we are already using this framework on top of TeamMentor Tbot page.

Tbot

Something took my attention while I was trying to add some browser automation test to this Tbot page. I was trying to use jQuery selectors to interact with DOM elements on a page that does not have a reference to jQuery.

The funny part of this story, is the fact that some jQuery selectors worked on Firefox Console, even when we are missing jQuery reference from the page. To give you an example, this is the jQuery selector to find  Tbot title :

$(‘.alert’)

Note that we are finding the element given the class, and as you can see here, we were able to find that element:

Find element

But we are interested on apply a jQuery selector that returns the DOM element, so our best candidate is using  jQuery .get  DOM Element Method.

Following with jQuery documentation, you can read that .get “Retrieve the DOM elements matched by the jQuery object.” and this is what we are interested on.

But since we don’t have jQuery referenced on that page, we get an error when trying to apply get method: TypeError: $(…).get is not a function

ScreenHunter_429 Apr. 29 19.58

Using FireQuery Firefox addon  we confirm that our page does not have jQuery referenced:

jquery

The addon adds the latest version of jQuery to the page :

addon

Now, the jQuery selector returns the DOM element (which can be used to convert it to a IWebElement).

good

So it seems like the idea behind using jQuery selectors  on a page/site that relies on jQuery is not that bad (because easily you can find DOM elements), but considering that you can have mixed frameworks (and it’s worth to reference StackOverflow question How do I “think in AngularJS” if I have a jQuery background?) then it would be better on to think about other options like CSS selectors, which appart from being a W3C recommendation, they provide a more generic approach to find DOM Elements.

Posted in Browser Automation, JQuery, Selenium WebDriver, WebDriver | Tagged , , | 1 Comment

Using WebDriver Actions class to interact with TeamMentor contextual menu

I was trying to add a test to verify that TeamMentor contextual menu, was displayed using mouse right-click, so you should be able to see a menu like this one :

Image

Fortunately, WebDriver provide a class to interact with some user actions like double-click for instance. This class is named ActionsTo give you an idea on what methods this class provides, I’ve auto generate the following class diagram, which gives the big picture of the Actions class definition ( and all the user actions it’s able to handle).

Image

Therefore if we need to perform the right-click action, you will need to use the following syntax:

 //Defining Actions
   var action = new Actions(driver);
   action.ContextClick(jsTree).Build().Perform();

Now we are able to display (via browser automation) this context menu, therefore our purpose here is to verify that two options are displayed when the context menu was displayed. Using jQuery selectors, we can now access the context menu and perform some asserts on that:

Code

If you want to see the unit test for that, you can see Contextual_Menu_Is_Displayed_On_Right_Click

Code

Posted in JQuery, UnitTests, WebDriver | Tagged , | Leave a comment

How To Configure TM Server for updating forked content

 

 

So I started with making a clone of the latest TeamMentor code from https://github.com/TeamMentor/Master.git

    

 

Renamed the directory to a more meaningful name for that server

 


 

Changed the default configuration to

1. Not require SSL, as the server we are hosting on does not have a certificate (unfortunate but hopefully temporary measure)

2. Implemented a workaround to disable random users from being able to create their own accounts. This involves enabling Eval Accounts but setting the number of Eval Days to -1. This allows the user to be created however the user cannot access the content. For this implementation all users should be created by admin.

3. Enabled auto Git commit for both User_Data and Library_Data

 


 

I followed the available documentation on how to install TM on IIS6 from docs.teammentor.net. I started TM and made sure it works as expected.

 

Then moving to github I created a user called tm-sme. I granted a pull only permissions to the tm-sme user.

 


 

 

Then I forked all the repositories currently on teammentor.net from TMContent organization to the new tm-sme user

 

 


 

Going back to our new instance of TM I added the newly forked repositories (pointing to the tm-sme user forks) in the TMSecretData.config file

 


 

I then restarted TM and the ApplicationPool and here we go: An instance of TM with Libraries forked from the TMContent repositories. As the content is updated here, it then automatically will be pushed to the forked repositories, which in turn can later be merged (upon approval of content changes) to the TMContent repositories which hold the authoritative content.

 


 

Just to validate that the push works, I changed one of the articles on the TM instance (line 23 and 24):

(note that the other changes are the update of the article to the new 3.3 format)

 


 

Posted in Uncategorized | Leave a comment

Using jQuery Selectors to interact with TeamMentor : A good starting point for browser automation

It’s important to take advantage of the cutting-edge technologies we are using at TeamMentor and make sure those technologies can be used to perform testing and improve the quality of the product. 

Since at TeamMentor we rely on jQuery, it’s important to understand what a jQuery selector is and why are they useful and important. As decribed in the jQuery official page: “…jQuery offers a powerful set of tools for matching a set of elements in a document.”

As an example, if you would like to locate all the  HTML heading 1 in a page, then the jQuery selector could be something like this : jQuery(“h1″).html(“Hello!”);  or just $(“h1″).html(“Hello!”);.

A complete list of jQuery selectors can be found here  , here and here.

Using jQuery Selector in TeamMentor via Firefox

Using firebug, this task is very easy, you will need to open firebug and then select the Console tab. At the bottom there should be  a console window to enter some commands:

Image

 

 

 

Now, let’s use the following selector to put some  html on all the HTML heading 2: $(“h2″).html(“Hello TeamMentor!!”);

Selectors

Look that after executing that command, all the h2 heading elements in the page constrains now the text “Hello TeamMentor!!”

From this stand point, we can use the power of jQuery selectors to locate elements in the DOM and make easy the  testing.

Posted in Uncategorized | Tagged , , | Leave a comment