Ing. Andrés Canavesi | Blog

CAT | programación

qTranslate hace lo que tiene que hacer y es muy sencillo de usar, recomendable.

, , , Hide


Selenium is a powerful and popular tool which can be used to test your SmartClient applications.
Selenium executes tests against your running application in a browser emulating user interaction and asserting various conditions.
Selenium provides a record/playback tool for authoring tests without learning a test scripting language. You must be familiar with
Selenium and use of Selenium IDE before proceeding. Refer to the documentation on the Selenium

site.

Use of Selenium with SmartClient applications is no different than using Selenium to write and run test cases with any other application with
the exception on on caveat. Selenium supports the concept of Locators
in order to specify the element you’d like a given Selenium command to operate on. For example Selenium supports XPath based locators, and DOM ID based locators.
XPath based locators are extremely fragile due to complexity of certain highly nested DOM elements you need access to combined with the fact that
XPath support varies across browsers and so your tests might not work across different browsers.

SmartClient occasionally renders a different DOM structure depending on the browser for performance for rendering the UI such that it appears identical across various browsers.
As a result using DOM ID or DOM XPath based locators with SmartClient applications is not advisable. Instead SmartClient supports a new Selenium
locator which is an xpath-like string used by Selenium to robustly identify DOM elements within a SmartClient application. SmartClient locators for Selenium
are prefixed by “scLocator=” and have a readable XPath like value even for cells in ListGrid’s or TreeGrids. Typically these locators will not be hand-written and
are generated by Selenium IDE, Selenium’s test recording tool.
One primary locator is based on the ID of the SmartClient widget and has the syntax ID=<Canvas ID>. This
simplifies the task of writing tests if you know the ID of the Canvas. For reference, the scLocator syntax for
ListGrid cells and DynamicForm FormItem"s can be found at the end of this document.

Setup Instructions

  • SmartClient ships with a Selenium user extension Javascript file : user-extensions.js. When running the Selenium tests make sure you place this file at the appropriate location.
    Refer to the Selenium Documentation for mode details.
  • In order to create tests, we suggest you use Selenium IDE. By default, Selenium looks for a file called “user-extensions.js”, and loads the javascript code found in that file.
    In the standard Selenium distribution, this file does not exist. You should place this file in this common location.
    Refer to the Selenium documentation if you need additional information. Once you have
    Selenium IDE installed, you will need to use the SmartClient user-extensions.js file with Selenium IDE. This is installed by
    putting the pathname to its location on your computer in the Selenium Core extensions field of Selenium-IDEÕs Options=>Options=>General tab.
    Additional Details on how this can be setup can be found here.
  • You will also need to configure Selenium IDE with a SmartClient provided Selenium IDE extensions javascript file : user-extensions-ide.js This is installed by
    putting the pathname to its location on your computer in the Selenium IDE extensions field of Selenium-IDEÕs Options=>Options=>General tab.

That’s it, we’re done configuring the environment.

Recording Selenium tests with Selenium IDE

Once you have your application running in Firefox, open Selenium IDE from the Tools ==> Selenium IDE menu option. If the Selenium IDE is in record mode,
then clicking or carrying out other operations like typing in a text field with automatically record the appropriate Selenium commands with the SmartClient locator.
There’s no need for you to manually enter the locator, the recorder does this for you! Sometimes users many want finder grain control of what Selenium command
is created instead of having the Selenium IDE recorder do this automatically. For example if you want to verify the value of a particular cell in a ListGrid.
Instead on typing in the command “verifyTable” and manually enter the SmartClient Locator (scLocator), you can simply right click on the table cell or any other
SmartClient widget and the most suitable Selenium commands will appear in the context menu along with the scLocator path for the clicked element. See image below.


Common scLocator syntax

List Grid cells

//ListGrid[ID="itemList"]/body/row[itemID=1996||itemName=Sugar White 1KG||SKU=85201400||1]/col[fieldName=SKU||1]

  • This assumes the ListGrid has an explicit ID
  • the ‘body’ part might be ‘frozenBody’ if the field in question was frozen
  • row[......] identifies the row (record)
  • itemID= – that’s the primary key field from the dataSource the grid is bound to
  • itemName= – that’s the title field value for the record
  • SKU=… – that’s the cell the user clicked’s value
  • 1 – that’s the index of the row (rowNum)
  • col[.....] – identifies the column in the grid
  • fieldName=… – field name for the field the user clicked
  • 1 – that’s the index of the column

Form Items

//DynamicForm[ID="autoTestForm"]/item[name=textField||title=textField||value=test||index=0||Class=TextItem]/element

This example is the data element (text entry box) for a text field

  • this form has an explicit ID
  • item[...] identifies the item
  • name (field name, if set)
  • title (title, if set)
  • value (current value if set)
  • index (index in the form items array)
  • Class (SC class of the item – in this case TextItem) after the “/” we identify the part of the item in question options here include:
  • “element” – the data element
  • “canvas” – for CanvasItems – points to the canvas embedded in the item
  • in this case the xpath might continue to contain, for example children of the canvas or elements within it (cells in a listGrid, etc)
  • “textbox” – the “text box” – this is the area where content is written out for items without a ‘data element’ – like header items
  • “[icon=<...>]” – the icon element — “<...>” would contain the “name”
    of the icon


Known Limitations

  • Support for multi-select for SelectItems with selection mode “grid” (non-default)
  • Support for Drag & Drop due to limitations in Selenium

, , , , Hide


Para quien no conoce el concepto de looping, es un término que crearon los informáticos para definir un enredo de los tantos que han creado y para lo cual no tienen una explicación sencilla que resuelva el problema. Haciendo poco esfuerzo, trataré de explicarles en pocas palabras este famoso término.

looping

Se dice que un programa de computación “entró en un looping” cuando ocurre una situación como la siguiente:

El DIRECTOR llama a su secretaria y le dice:
Señorita Vanessa: Tengo un seminario en Argentina por una semana y quiero que me acompañe para que conozca a mis socios. Haga los preparativos del viaje…

La secretaria llama al marido:
Oye Juan – Voy a viajar al exterior con el director por una semana. Cuidate, querido.

El marido llama a la amante:
Leonor, mi tesoro – La bruja va a viajar al exterior por una semana, vamos a pasarnos esta semana juntos, mi reina…

La amante llama al niño a quien le da clases particulares:
Manuelito – Tengo mucho trabajo la próxima semana.. No tienes que venir a clases…

El niño llama a su abuelo:
Tata – La próxima semana no tengo clases, mi profesora estará ocupada. Así que, por fin… ¡Vamos a poder pasar la semana juntos!!

El abuelo (que es el DIRECTOR en esta historia) llama a la secretaria:
Señorita Vanessa venga rápido – Suspenda el viaje, voy a pasar la próxima semana con mi nieto que hace un año que no veo, así que no vamos a participar en el Seminario. Cancele el viaje y el hotel.

La secretaria llama al marido:
Juan- El imbécil del director cambió de idea y acaba de cancelar el viaje, se me jodió el viaje.

El marido llama a la amante:
Amorcito disculpa – No podremos pasar la próxima semana juntos, el viaje de la tetona de mi mujer fue cancelado.

La amante llama al niño de las clases particulares:
Manuelito – Cambié de planes: esta semana le voy a dar clases como siempre.

El niño llama al abuelo:
Abuelo, la vieja de mi profesora me dijo que esta semana tengo clases normales, discúlpame, no voy a poder hacerte compañía.

El abuelo llama a la secretaria:
Señorita Vanessa – Mi nieto me acaba de decir que no va a poder estar conmigo esta semana porque tiene clases. Así que continúe con los preparativos del viaje al seminario…

¿Quedó claro lo que es un looping…???

Fuente: null

, Hide


Investigando en Wikipedia llegué a una categoría que no conocía: Antipatrón de diseño lo que en pocas palabras significa, una mala solución a un problema.
Está muy interesante recorrér algunos de los que allí se presentan y notar que no necesariamente se aplican a la informática.
Algunos de los que me parecieron mas interesantes:

http://es.wikipedia.org/wiki/Base_de_datos_como_comunicador_de_procesos

http://es.wikipedia.org/wiki/Par%C3%A1lisis_del_an%C3%A1lisis

http://es.wikipedia.org/wiki/Fear_of_success

http://es.wikipedia.org/wiki/C%C3%B3digo_ofuscado

http://es.wikipedia.org/wiki/Magic_pushbutton

http://es.wikipedia.org/wiki/Martillo_de_oro

Antiapatron de diseño

, , Hide


En mi caso utilizo ubuntu pero debería ser muy similar en cualquier otra distribución, especialmente de la familia de
Debian

Previo a la instalación debemos tener instalado el JDK:

sudo apt-get install sun-java6-jdk

Vamos a la web de descargas de Netbeans:

http://netbeans.org/downloads/index.html

Descargamos la opción de PHP.

Supongamos que descargamos el archivo en el escritorio, abrimos una consola, escribimos:

cd Escritorio

Le damos permisos de ejecución al archivo descargado:

sudo chmod 644 netbeans-6.8-ml-php-linux.sh

Ejecutamos el archivo:

sudo sh netbeans-6.8-ml-php-linux.sh

Se nos abrirá el instalador y seguimos los pasos que nos indica.

Netbeans logo

, , , , Hide


Oct/09

31

Chromeexperiments.com

Siempre me gustó mas javascript que flash, chromeexperiments.com es una gran prueba de que se pueden hacer las mismas cosas que con flash :)

chrome experiments

Uno de los ejemplos que mas me gustó:

http://www.chromeexperiments.com/detail/browser-ball/

Otra vez Matías tirando buena info.

, , Hide


Processing es una librería javascript con una filisofía similar a los applets de Java.

Para aprender un poco acerca de la sintaxis es que hice un ejemplo muy básico, simplemente se pinta un círculo en donde hagas click.

processingjs-image

Dentro del método setup() hay otro método llamado noLoop(), este es usado para que el método draw() no se refresque solo. Para lograr que el canvas se refresque hay que poner el método redraw() luego de nuestra acción, en este caso lo puse dentro del método mouseClicked(). Para probar, puedes comentar ambos métodos a la vez para ver que funciona de todos modos, también puedes probar comentar uno y otro para ver el comportamiento.

Descarga el ejemplo

Gracias Matias Menafra por el aporte.