¿Con qué tipo de problema se encontró con la necesidad de emular el trabajo de los usuarios a través de la solución Selenium WebDriver?
Si está seguro de que esto no se puede omitir, hay varias opciones para ejecutar desde JMeter el código que realiza la prueba en Selenium Webdriver.
Puedes usar WebDrvier Components for Apache JMeter.
Para esto:
1.1 Descargar Plugin Managery póngalo en el directorio lib/ext
, luego reinicie JMeter.
1.2 Abierta Options
- Plugins Manager
- Available Plugins
y encontrar e instalar Selenium/WebDriver Support
.
1.3. Agregar al elemento de configuración del plan de prueba - Chrome (or Firefox\PhantomJS..) Driver Config
, y especifique la ruta a WebDriver aquí.
1.4. Poner WDS Sampler
a Thread Group
.
1.5. Aquí hay un código de muestra dentro de WDS Sampler:
//1a. Start capturing the sampler timing
WDS.sampleResult.sampleStart()
// 2. Perform the Sampler task
WDS.browser.get('http://google.com.au')
// 1b. Stop the sampler timing
WDS.sampleResult.sampleEnd()
// 3. Verify the results
if(WDS.browser.getTitle() != 'Google') {
WDS.sampleResult.setSuccessful(false)
WDS.sampleResult.setResponseMessage('Expected title to be Google')
}
Pero tenga en cuenta que para emular una carga sustancial, necesitará una gran cantidad de PC, como dice la documentación oficial:
From experience, the number of browser (threads) that the reader creates should be limited by the following formula:
C = N + 1
where C = Number of Cores of the host running the test
and N = Number of Browser (threads).
eg, if the current reader's host has 4 cores, the formula would yield:
4 = 3 + 1
meaning that the script should have a MAXIMUM of 3 threads.
Si necesita ejecutar 1000 usuarios simultáneos, verifique el segundo ejemplo.
- Puede usar Selenium WebDriver para crear y ejecutar pruebas de rendimiento en la cloud servces. Por ejemplo puedes usar RedLine13, mira esto video instruction o vea las instrucciones paso a paso how to run Load test with Selenium in the cloud.