Selenium IDE + JMeter + JUnit

Instalación

  1. Instale el plugin según su navegador.

Opción 1: Chrome

  1. Ingrese al link anterior y haga click en "Agregar a Chrome".

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

  2. En la ventana emergente autorice la instalación del pugin haciendo click en "Add extension".

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

  3. En la parte superior izquierda de la pantalla encontrará un ícono con forma de pieza de rompecabezas, ahí encontrará todos sus plugins. Para abrir Selenium IDE basta con hacer click en ese ícono y luego seleccionar el plugin.

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

Opción 2: Firefox

  1. Ingrese al link anterior y haga click en "Add to Firefox".

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

  2. En la ventana emergente autorice la instalación del plugin haciendo click en "Allow".

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

  3. En la parte superior derecha de la pantalla encontrará el ícono de Selenium IDE (un cuadradito gris con las letras "Se"), puede hacer click ahí cada que quiera abrir el plugin.

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

La versión de Selenium para ambos navegadores tiene exactamente el mismo funcionamiento, por lo que los pasos siguientes se mantienen sin cambios independientemente del navegador utilizado.

Grabación

  1. Ingrese al navegador y abra el plugin. Al hacerlo se desplegará la siguente ventana, seleccione la primera opción "Record a new test in a new project".

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

  2. Digite el nombre del proyecto y haga click en "Ok".

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

  3. Ingrese la URL en la que desea realizar la grabación y seguidamente haga click en "Start Recording"

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

  4. Se abrirán las siguientes dos ventanas, en la de la izquierda se guarda y administra todo lo relacionado con la grabación, en la derecha encontrará su navegador en la URL que ingresó, puede interactuar en esta y todas las acciones que haga serán grabadas.

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

  5. Al finalizar la grabación, ingrese el nombre del test o de la prueba que acaba de realizar.

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

  6. Exporte la prueba en formato Java + JUnit, para esto haga clic en los tres puntos que aparecen a la derecha del test cuando pasa el mouse por encima de él u haga click en "Export".

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

  7. En la ventana emergente seleccione la opción "Java JUnit" y luego haga click en "EXPORT". Esto descargará el archivo .java que utilizará en la siguiente sección.

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

Generar JAR

Opción 1: Use el comando jar cvf Test.jar * desde la carpeta donde se encuentra el .java, este comando generará el .jar que usará en los siguientes pasos.

Opción 2: Genere el JAR desde IntelliJ siguiendo los siguientes pasos:

  1. Tras abrir el código en un nuevo proyecto de IntelliJ cambie el nombre de la clase y del archivo a "Main" y agregue justo después las siguientes líneas de código.

    ​​​​    public static void main(String[] args) {
    ​​​​        JUnitCore.main("Main");
    ​​​​    }
    
  2. En la barra de menú superior de IntelliJ seleccione la primera opción "File" y luego haga click en la opción "Project Structure".

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

    Se debería abrir la siguiente ventana emergente.

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

  3. Seleccione la opción "Artifacts" y luego haga click en "+".

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

  4. En la lista de opciones desplegada, busque la opción "JAR" y posteriormente seleccione "From modules with dependencies".

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

  5. Seleccione el nombre del módulo principal del proyecto.

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

  6. Para buscar la clase principal haga click en la carpeta a la derecha del campo.

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

  7. Para buscar la clase principal, haga click en "Project" diríjase a la carpeta donde tiene el archivo y selecciónelo, luego haga click en "Ok".

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

  8. Seleccione la opción "Extract to the target JAR" y ya que ha llenado todos los campos del formulario, haga click en "Ok".

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

  9. Regresará a la ventana anterior y podrá notar que el nuevo artefacto ya se encuentra en la lista, para aplicar los cambios y guardar la configuración actual del proyecto haga click nuevamente en "Ok".

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

  10. Para generar el JAR seleccione la opción "Build" en la barra de menú superior de IntelliJ y luego haga click en "Build Artifacts".

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

  11. Se abrirá la siguiente ventana, seleccione el artefacto y luego la opción "Build".

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

  12. El JAR se encontrará en la carpeta del proyecto dentro de out/artifacts/Test_jar/Test.jar.

Generar JMX en JMeter

  1. Descargue JMeter desde aquí y descomprima la carpeta.

  2. Ingrese a la carpeta descomprimida y haga doble click en la carpeta "lib".

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

  3. Dentro de "lib" busque e ingrese a la carpeta "junit", si no la encuentra cree una nueva.

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

  4. Inserte dentro de esta carpeta el JAR generado en la sección anterior.

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

  5. Regrese a la carpeta de JMeter y busque e ingrese a la carpeta "bin".

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

  6. En esta carpeta encontrará un archivo ejecutable llamado "ApacheJMeter.jar", haga doble click sobre él para abrir JMeter.

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

  7. Dentro de JMeter cree un Thread Group haciendo click derecho en "Test Plan", luego click en "Add", "Threads (Users)" y "Thread Group".

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

  8. Dentro del Thread Group cree un Sampler haciendo click derecho en "Thread Group", luego click en "Add", "Sampler" y "JUnit Request".

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

  9. Marque la casilla "Search for JUnit 4 annotations (instead of JUnit 3)".

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

  10. Seleccione el nombre de la clase.

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

  11. Seleccione el nombre del método de prueba.

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

  12. Una vez haya terminado de configurar el sampler, haga click en "File" a la izquierda en la barra de menú superior y seleccione la opción "Save Test Plan as".

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

  13. Se abrirá la siguiente ventana emergente, seleccione el directorio donde desea guardar el JMX junto con el nombre y tipo de archivo (JMeter [.jmx]), posteriormente haga click en "Save".

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

Ejecutar el JMX desde consola

  1. Ingrese desde la terminal a la carpeta donde se encuentra "ApacheJMeter.jar" (el archivo que abrió en el paso 6 de la sección anterior).

  2. Ejecute el siguiente comando, reemplazando la palabra path por la ruta al archivo jmx que guardó en el paso 13 de la sección anterior.

    ​​​​jmeter -n -t path