diff --git a/docs_source_files/content/guidelines_and_recommendations/_index.en.md b/docs_source_files/content/guidelines_and_recommendations/_index.en.md index b53f75b3550e..fa2d977bf7c3 100644 --- a/docs_source_files/content/guidelines_and_recommendations/_index.en.md +++ b/docs_source_files/content/guidelines_and_recommendations/_index.en.md @@ -20,7 +20,7 @@ makes writing good tests a challenge. Selenium provides tools to make functional user interaction easier, but does not help you write well-architected test suites. -In this chapter we offer advice, guidelines, and recommendations. +In this chapter we offer advice, guidelines, and recommendations on how to approach functional web page automation. This chapter records software design patterns popular diff --git a/docs_source_files/content/guidelines_and_recommendations/_index.es.md b/docs_source_files/content/guidelines_and_recommendations/_index.es.md index e26ddddf7b01..775f50597b3c 100644 --- a/docs_source_files/content/guidelines_and_recommendations/_index.es.md +++ b/docs_source_files/content/guidelines_and_recommendations/_index.es.md @@ -5,30 +5,28 @@ chapter: true weight: 7 --- -{{% notice info %}} - Page being translated from -English to Spanish. Do you speak Spanish? Help us to translate -it by sending us pull requests! -{{% /notice %}} - # Guías y recomendaciones -A note on "Best Practices": We've intentionally avoided the phrase "Best -Practices" in this documentation. No one approach works for all situations. -We prefer the idea of "Guidelines and Recommendations". We encourage -you to read through these and thoughtfully decide what approaches -will work for you in your particular environment. +Una nota sobre "Mejores prácticas": hemos evitado +intencionalmente la frase "Mejores Prácticas" en esta +documentación. Ningún enfoque funciona para todas las +situaciones. Preferimos la idea de "Directrices y +recomendaciones". Te alentamos a leer a través de estos y +decidir cuidadosamente cuales enfoques funcionarían para ti en tu +entorno particular. -Functional testing is difficult to get right for many reasons. -As if application state, complexity, and dependencies do not make testing difficult enough, -dealing with browsers (especially with cross-browser incompatibilities) -makes writing good tests a challenge. +Las pruebas funcionales son difíciles de realizar por muchas +razones. Como si el estado de la aplicación, la complejidad y +las dependencias no dificultaran las pruebas, tratar con +navegadores (especialmente con incompatibilidades entre +navegadores) hace que escribir buenas pruebas sea un desafío. -Selenium provides tools to make functional user interaction easier, -but does not help you write well-architected test suites. -In this chapter we offer advice, guidelines, and recommendations. -on how to approach functional web page automation. +Selenium proporciona herramientas para facilitar la interacción +funcional del usuario, pero no le ayuda a escribir conjuntos de +pruebas bien diseñados. En este capítulo ofrecemos consejos, +pautas y recomendaciones sobre cómo abordar la automatización +funcional de páginas web. -This chapter records software design patterns popular -amongst many of the users of Selenium -that have proven successful over the years. +Este capítulo registra los patrones de diseño de software +populares entre muchos de los usuarios de Selenium que han +demostrado tener éxito a lo largo de los años. \ No newline at end of file diff --git a/docs_source_files/content/guidelines_and_recommendations/_index.fr.md b/docs_source_files/content/guidelines_and_recommendations/_index.fr.md index 986e8c8a760e..79f56a3b4f64 100644 --- a/docs_source_files/content/guidelines_and_recommendations/_index.fr.md +++ b/docs_source_files/content/guidelines_and_recommendations/_index.fr.md @@ -20,7 +20,7 @@ fait de la rédaction de bons tests un défi. Selenium fournit des outils pour faciliter l'interaction fonctionnelle des utilisateurs, mais ne vous aide pas à écrire des suites de tests bien conçues. -Dans ce chapitre, nous proposons des conseils, des directives et des recommandations. +Dans ce chapitre, nous proposons des conseils, des directives et des recommandations sur la façon d'aborder l'automatisation fonctionnelle des pages Web. Ce chapitre enregistre les modèles de conception de logiciels populaires diff --git a/docs_source_files/content/guidelines_and_recommendations/_index.ko.md b/docs_source_files/content/guidelines_and_recommendations/_index.ko.md index 09085840719f..fb9f67847d8b 100644 --- a/docs_source_files/content/guidelines_and_recommendations/_index.ko.md +++ b/docs_source_files/content/guidelines_and_recommendations/_index.ko.md @@ -26,7 +26,7 @@ makes writing good tests a challenge. Selenium provides tools to make functional user interaction easier, but does not help you write well-architected test suites. -In this chapter we offer advice, guidelines, and recommendations. +In this chapter we offer advice, guidelines, and recommendations on how to approach functional web page automation. This chapter records software design patterns popular diff --git a/docs_source_files/content/guidelines_and_recommendations/_index.nl.md b/docs_source_files/content/guidelines_and_recommendations/_index.nl.md index 421156b8a8bc..81672ceaaf0f 100644 --- a/docs_source_files/content/guidelines_and_recommendations/_index.nl.md +++ b/docs_source_files/content/guidelines_and_recommendations/_index.nl.md @@ -26,7 +26,7 @@ makes writing good tests a challenge. Selenium provides tools to make functional user interaction easier, but does not help you write well-architected test suites. -In this chapter we offer advice, guidelines, and recommendations. +In this chapter we offer advice, guidelines, and recommendations on how to approach functional web page automation. This chapter records software design patterns popular diff --git a/docs_source_files/content/guidelines_and_recommendations/avoid_sharing_state.es.md b/docs_source_files/content/guidelines_and_recommendations/avoid_sharing_state.es.md index 8b8ec46d3655..2f1753504d2f 100644 --- a/docs_source_files/content/guidelines_and_recommendations/avoid_sharing_state.es.md +++ b/docs_source_files/content/guidelines_and_recommendations/avoid_sharing_state.es.md @@ -3,21 +3,18 @@ title: "Evitar compartir estados" weight: 6 --- -{{% notice info %}} - Page being translated from -English to Spanish. Do you speak Spanish? Help us to translate -it by sending us pull requests! -{{% /notice %}} +Aunque se menciona en varios lugares, vale la pena mencionarlo +nuevamente. Asegurate de que las pruebas estén aisladas unas de otras. -Although mentioned in several places it is worth mentioning again. Ensure -tests are isolated from one another. +* No compartas datos de prueba. Imagina varias pruebas en la que cada una +consulta a la base de datos para pedidos válidos antes de elegir +uno para realizar una acción. Si dos pruebas eligen el mismo +pedido es probable que obtengas un comportamiento +inesperado. -* Do not share test data. Imagine several tests that each query the database -for valid orders before picking one to perform an action on. Should two tests -pick up the same order you are likely to get unexpected behaviour. +* Limpia los datos obsoletos en la aplicación que podrían ser +recogidos por otra prueba p. ej. registros de pedidos inválidos. -* Clean up stale data in the application that might be picked up by another -test e.g. invalid order records. - -* Create a new WebDriver instance per test. This helps ensure test isolation -and makes parallelisation simpler. +* Crear una nueva instancia de WebDriver por prueba. Esto ayuda +a garantizar el aislamiento de la prueba y simplifica la +paralelización. diff --git a/docs_source_files/content/guidelines_and_recommendations/consider_using_a_fluent_api.es.md b/docs_source_files/content/guidelines_and_recommendations/consider_using_a_fluent_api.es.md index 308632458c83..a79295b08669 100644 --- a/docs_source_files/content/guidelines_and_recommendations/consider_using_a_fluent_api.es.md +++ b/docs_source_files/content/guidelines_and_recommendations/consider_using_a_fluent_api.es.md @@ -3,17 +3,11 @@ title: "Considerar el uso de un API fluída" weight: 8 --- -{{% notice info %}} - Page being translated from -English to Spanish. Do you speak Spanish? Help us to translate -it by sending us pull requests! -{{% /notice %}} - -Martin Fowler coined the term ["Fluent API"](//www.martinfowler.com/bliki/FluentInterface.html). Selenium already -implements something like this in their `FluentWait` class, which is -meant as an alternative to the standard Wait class. -You could enable the Fluent API design pattern in your page object -and then query the Google search page with a code snippet like this one: +Martin Fowler acuñó el término ["API fluido"](//www.martinfowler.com/bliki/FluentInterface.html). +Selenium ya implementa algo como esto en su clase `FluentWait`, que +se entiende como una alternativa a la clase estándar Wait. +Puedes habilitar el patrón de diseño Fluent API en tu objeto de página +y luego consulta la página de búsqueda de Google con un fragmento de código como este: ```java driver.get( "http://www.google.com/webhp?hl=en&tab=ww" ); @@ -21,8 +15,8 @@ GoogleSearchPage gsp = new GoogleSearchPage(); gsp.withFluent().setSearchString().clickSearchButton(); ``` -The Google page object class with this fluent behavior -might look like this: +La clase de objeto de página de Google con este comportamiento fluido +podría verse así: ```java public class GoogleSearchPage extends LoadableComponent { @@ -51,8 +45,8 @@ public class GoogleSearchPage extends LoadableComponent { @FindBy(id = "gbqfb") private WebElement searchButton; public GoogleSearchPage(WebDriver driver) { gspfi = new GSPFluentInterface( this ); - this.get(); // If load() fails, calls isLoaded() until page is finished loading - PageFactory.initElements(driver, this); // Initialize WebElements on page + this.get(); // Si load() falla, se llama a isLoaded() hasta que la página termine de cargarse + PageFactory.initElements(driver, this); // Inicializa los WebElements en la pagina } public GSPFluentInterface withFluent() { diff --git a/docs_source_files/content/guidelines_and_recommendations/fresh_browser_per_test.es.md b/docs_source_files/content/guidelines_and_recommendations/fresh_browser_per_test.es.md index bfbdf814be99..a607d843c657 100644 --- a/docs_source_files/content/guidelines_and_recommendations/fresh_browser_per_test.es.md +++ b/docs_source_files/content/guidelines_and_recommendations/fresh_browser_per_test.es.md @@ -3,17 +3,11 @@ title: "Nueva instancia del navegador por prueba" weight: 9 --- -{{% notice info %}} - Page being translated from -English to Spanish. Do you speak Spanish? Help us to translate -it by sending us pull requests! -{{% /notice %}} - -Start each test from a clean known state. -Ideally, spin up a new virtual machine for each test. -If spinning up a new virtual machine is not practical, -at least start a new WebDriver for each test. -For Firefox, start a WebDriver with your known profile. +Comienza cada prueba desde un estado limpio conocido. +Idealmente, ejecuta una nueva máquina virtual para cada prueba. +Si ejecutar una nueva máquina virtual no es práctico, +al menos inicia un nuevo WebDriver para cada prueba. +Para Firefox, inicia un WebDriver con su perfil conocido. ```java FirefoxProfile profile = new FirefoxProfile(new File("pathToFirefoxProfile")); diff --git a/docs_source_files/content/guidelines_and_recommendations/generating_application_state.es.md b/docs_source_files/content/guidelines_and_recommendations/generating_application_state.es.md index 3b69c3381af1..c4478e3f8a79 100644 --- a/docs_source_files/content/guidelines_and_recommendations/generating_application_state.es.md +++ b/docs_source_files/content/guidelines_and_recommendations/generating_application_state.es.md @@ -3,20 +3,17 @@ title: "Generar el estado de la aplicación" weight: 3 --- -{{% notice info %}} - Page being translated from -English to Spanish. Do you speak Spanish? Help us to translate -it by sending us pull requests! -{{% /notice %}} +Selenium no debe usarse para preparar un caso de prueba. Todas +las acciones repetitivas y los preparativos para un caso de +prueba deben realizarse a través de otros métodos. Por ejemplo, +la mayoría de las IU web tienen autenticación (por ejemplo, un +formulario de inicio de sesión). Eliminar el inicio de sesión a través +del navegador web antes de cada prueba mejora tanto la +velocidad como la estabilidad de la prueba. Un método debe ser +creado para obtener acceso al AUT* (por ejemplo, usando una API +para iniciar sesión y establecer un cookie). Además, crear +métodos para precargar datos para las pruebas no deben +realizarse con Selenium. Como se mencionó previamente, las API +existentes se deben aprovechar para crear datos para el AUT*. -Selenium should not be used to prepare a test case. All repetitive -actions and preparations for a test case, should be done through other -methods. For example, most web UIs have authentication (e.g. a login -form). Eliminating logging in via web browser before every test will -improve both the speed and stability of the test. A method should be -created to gain access to the AUT* (e.g. using an API to login and set a -cookie). Also, creating methods to pre-load data for -testing should not be done using Selenium. As mentioned previously, -existing APIs should be leveraged to create data for the AUT*. - -***AUT**: Application under test +***AUT**: Application Under Test (aplicación bajo prueba) diff --git a/docs_source_files/content/guidelines_and_recommendations/improved_reporting.de.md b/docs_source_files/content/guidelines_and_recommendations/improved_reporting.de.md index e1f8df846850..7db70b5ca58c 100644 --- a/docs_source_files/content/guidelines_and_recommendations/improved_reporting.de.md +++ b/docs_source_files/content/guidelines_and_recommendations/improved_reporting.de.md @@ -17,7 +17,11 @@ reports are popular for importing results to a Continuous Integration for more information regarding report outputs for several languages. [NUnit 3 Console Runner](//github.com/nunit/docs/wiki/Console-Runner) + [NUnit 3 Console Command Line](//github.com/nunit/docs/wiki/Console-Command-Line) + [xUnit getting test results in TeamCity](//xunit.net/docs/getting-test-results-in-teamcity) + [xUnit getting test results in CruiseControl.NET](//xunit.net/docs/getting-test-results-in-ccnet) + [xUnit getting test results in Azure DevOps](//xunit.net/docs/getting-test-results-in-azure-devops) diff --git a/docs_source_files/content/guidelines_and_recommendations/improved_reporting.en.md b/docs_source_files/content/guidelines_and_recommendations/improved_reporting.en.md index 7571b66b8f79..2acc73797de6 100644 --- a/docs_source_files/content/guidelines_and_recommendations/improved_reporting.en.md +++ b/docs_source_files/content/guidelines_and_recommendations/improved_reporting.en.md @@ -12,7 +12,11 @@ reports are popular for importing results to a Continuous Integration for more information regarding report outputs for several languages. [NUnit 3 Console Runner](//github.com/nunit/docs/wiki/Console-Runner) + [NUnit 3 Console Command Line](//github.com/nunit/docs/wiki/Console-Command-Line) + [xUnit getting test results in TeamCity](//xunit.net/docs/getting-test-results-in-teamcity) + [xUnit getting test results in CruiseControl.NET](//xunit.net/docs/getting-test-results-in-ccnet) + [xUnit getting test results in Azure DevOps](//xunit.net/docs/getting-test-results-in-azure-devops) diff --git a/docs_source_files/content/guidelines_and_recommendations/improved_reporting.es.md b/docs_source_files/content/guidelines_and_recommendations/improved_reporting.es.md index 92ddf8aac788..f28870abc88e 100644 --- a/docs_source_files/content/guidelines_and_recommendations/improved_reporting.es.md +++ b/docs_source_files/content/guidelines_and_recommendations/improved_reporting.es.md @@ -3,22 +3,23 @@ title: "Mejores reportes" weight: 5 --- -{{% notice info %}} - Page being translated from -English to Spanish. Do you speak Spanish? Help us to translate -it by sending us pull requests! -{{% /notice %}} - -Selenium is not designed to report on the status of test cases -run. Taking advantage of the built-in reporting capabilities of unit -test frameworks is a good start. Most unit test frameworks have -reports that can generate xUnit or HTML formatted reports. xUnit -reports are popular for importing results to a Continuous Integration -(CI) server like Jenkins, Travis, Bamboo, etc. Here are some links -for more information regarding report outputs for several languages. +Selenium no está diseñado para informar sobre el estado de los +casos de prueba ejecutados. Aprovechando las capacidades de +reporte incorporadas en la mayoría de los frameworks de pruebas +unitarias es un buen comienzo. La mayoría de los frameworks de +pruebas unitarias tienen utilidades que +pueden generar reportes con formato xUnit o HTML. Los reportes +xUnit son populares para importar resultados a una +integración continua (CI) como Jenkins, Travis, Bamboo, etc. +Aquí hay algunos enlaces para obtener más información sobre la +generación de los reportes para varios lenguajes. [NUnit 3 Console Runner](//github.com/nunit/docs/wiki/Console-Runner) + [NUnit 3 Console Command Line](//github.com/nunit/docs/wiki/Console-Command-Line) + [xUnit getting test results in TeamCity](//xunit.net/docs/getting-test-results-in-teamcity) + [xUnit getting test results in CruiseControl.NET](//xunit.net/docs/getting-test-results-in-ccnet) + [xUnit getting test results in Azure DevOps](//xunit.net/docs/getting-test-results-in-azure-devops) diff --git a/docs_source_files/content/guidelines_and_recommendations/improved_reporting.fr.md b/docs_source_files/content/guidelines_and_recommendations/improved_reporting.fr.md index 8144732458fc..acd31bfd23cd 100644 --- a/docs_source_files/content/guidelines_and_recommendations/improved_reporting.fr.md +++ b/docs_source_files/content/guidelines_and_recommendations/improved_reporting.fr.md @@ -12,7 +12,11 @@ les rapports sont populaires pour importer des résultats dans une intégration pour plus d'informations sur les sorties de rapports pour plusieurs langues. [NUnit 3 Console Runner](//github.com/nunit/docs/wiki/Console-Runner) + [NUnit 3 Console Command Line](//github.com/nunit/docs/wiki/Console-Command-Line) + [xUnit getting test results in TeamCity](//xunit.net/docs/getting-test-results-in-teamcity) + [xUnit getting test results in CruiseControl.NET](//xunit.net/docs/getting-test-results-in-ccnet) + [xUnit getting test results in Azure DevOps](//xunit.net/docs/getting-test-results-in-azure-devops) diff --git a/docs_source_files/content/guidelines_and_recommendations/improved_reporting.ja.md b/docs_source_files/content/guidelines_and_recommendations/improved_reporting.ja.md index d8d32f08ef54..11e59befdfdb 100644 --- a/docs_source_files/content/guidelines_and_recommendations/improved_reporting.ja.md +++ b/docs_source_files/content/guidelines_and_recommendations/improved_reporting.ja.md @@ -11,7 +11,11 @@ xUnitレポートは、Jenkins、Travis、Bambooなどの継続的インテグ いくつかの言語のレポート出力に関する詳細情報へのリンクがあります。 [NUnit 3 Console Runner](//github.com/nunit/docs/wiki/Console-Runner) + [NUnit 3 Console Command Line](//github.com/nunit/docs/wiki/Console-Command-Line) + [xUnit getting test results in TeamCity](//xunit.net/docs/getting-test-results-in-teamcity) + [xUnit getting test results in CruiseControl.NET](//xunit.net/docs/getting-test-results-in-ccnet) + [xUnit getting test results in Azure DevOps](//xunit.net/docs/getting-test-results-in-azure-devops) diff --git a/docs_source_files/content/guidelines_and_recommendations/improved_reporting.ko.md b/docs_source_files/content/guidelines_and_recommendations/improved_reporting.ko.md index b12cc61bc6e6..e379f22ba2fc 100644 --- a/docs_source_files/content/guidelines_and_recommendations/improved_reporting.ko.md +++ b/docs_source_files/content/guidelines_and_recommendations/improved_reporting.ko.md @@ -18,7 +18,11 @@ reports are popular for importing results to a Continuous Integration for more information regarding report outputs for several languages. [NUnit 3 Console Runner](//github.com/nunit/docs/wiki/Console-Runner) + [NUnit 3 Console Command Line](//github.com/nunit/docs/wiki/Console-Command-Line) + [xUnit getting test results in TeamCity](//xunit.net/docs/getting-test-results-in-teamcity) + [xUnit getting test results in CruiseControl.NET](//xunit.net/docs/getting-test-results-in-ccnet) + [xUnit getting test results in Azure DevOps](//xunit.net/docs/getting-test-results-in-azure-devops) diff --git a/docs_source_files/content/guidelines_and_recommendations/improved_reporting.nl.md b/docs_source_files/content/guidelines_and_recommendations/improved_reporting.nl.md index 3b057225d421..5e464b95ef94 100644 --- a/docs_source_files/content/guidelines_and_recommendations/improved_reporting.nl.md +++ b/docs_source_files/content/guidelines_and_recommendations/improved_reporting.nl.md @@ -18,7 +18,11 @@ reports are popular for importing results to a Continuous Integration for more information regarding report outputs for several languages. [NUnit 3 Console Runner](//github.com/nunit/docs/wiki/Console-Runner) + [NUnit 3 Console Command Line](//github.com/nunit/docs/wiki/Console-Command-Line) + [xUnit getting test results in TeamCity](//xunit.net/docs/getting-test-results-in-teamcity) + [xUnit getting test results in CruiseControl.NET](//xunit.net/docs/getting-test-results-in-ccnet) + [xUnit getting test results in Azure DevOps](//xunit.net/docs/getting-test-results-in-azure-devops) diff --git a/docs_source_files/content/guidelines_and_recommendations/improved_reporting.zh-cn.md b/docs_source_files/content/guidelines_and_recommendations/improved_reporting.zh-cn.md index cba8fcde0e8f..cd65ba1c1c33 100644 --- a/docs_source_files/content/guidelines_and_recommendations/improved_reporting.zh-cn.md +++ b/docs_source_files/content/guidelines_and_recommendations/improved_reporting.zh-cn.md @@ -12,7 +12,11 @@ xUnit报表很受欢迎, 可以将其结果导入到持续集成(CI)服务 [NUnit 3 Console Runner](//github.com/nunit/docs/wiki/Console-Runner) + [NUnit 3 Console Command Line](//github.com/nunit/docs/wiki/Console-Command-Line) + [xUnit getting test results in TeamCity](//xunit.net/docs/getting-test-results-in-teamcity) + [xUnit getting test results in CruiseControl.NET](//xunit.net/docs/getting-test-results-in-ccnet) -[xUnit getting test results in Azure DevOps](//xunit.net/docs/getting-test-results-in-azure-devops) + +[xUnit getting test results in Azure DevOps](//xunit.net/docs/getting-test-results-in-azure-devops) \ No newline at end of file diff --git a/docs_source_files/content/guidelines_and_recommendations/mock_external_services.es.md b/docs_source_files/content/guidelines_and_recommendations/mock_external_services.es.md index a7e22440a50b..41b741039573 100644 --- a/docs_source_files/content/guidelines_and_recommendations/mock_external_services.es.md +++ b/docs_source_files/content/guidelines_and_recommendations/mock_external_services.es.md @@ -3,11 +3,6 @@ title: "Mock de servicios externos" weight: 4 --- -{{% notice info %}} - Page being translated from -English to Spanish. Do you speak Spanish? Help us to translate -it by sending us pull requests! -{{% /notice %}} - -Eliminating the dependencies on external services will greatly improve -the speed and stability of your tests. \ No newline at end of file +Eliminar las dependencias de servicios externos +mejorará en gran medida la velocidad y la estabilidad +de tus pruebas. \ No newline at end of file diff --git a/docs_source_files/content/guidelines_and_recommendations/page_object_models.es.md b/docs_source_files/content/guidelines_and_recommendations/page_object_models.es.md index f7daa8830d5c..a42bb98f661e 100644 --- a/docs_source_files/content/guidelines_and_recommendations/page_object_models.es.md +++ b/docs_source_files/content/guidelines_and_recommendations/page_object_models.es.md @@ -3,76 +3,83 @@ title: "Modelos de objetos de página" weight: 1 --- -{{% notice info %}} - Page being translated from -English to Spanish. Do you speak Spanish? Help us to translate -it by sending us pull requests! -{{% /notice %}} - -Page Object is a Design Pattern which has become popular in test automation for -enhancing test maintenance and reducing code duplication. A page object is an -object-oriented class that serves as an interface to a page of your AUT. The -tests then use the methods of this page object class whenever they need to -interact with the UI of that page. The benefit is that if the UI changes for -the page, the tests themselves don’t need to change, only the code within the -page object needs to change. Subsequently all changes to support that new UI -are located in one place. - -The Page Object Design Pattern provides the following advantages: - -* There is a clean separation between test code and page specific code such as - locators (or their use if you’re using a UI Map) and layout. -* There is a single repository for the services or operations offered by the page - rather than having these services scattered throughout the tests. - -In both cases this allows any modifications required due to UI changes to all -be made in one place. Useful information on this technique can be found on -numerous blogs as this ‘test design pattern’ is becoming widely used. We -encourage the reader who wishes to know more to search the internet for blogs -on this subject. Many have written on this design pattern and can provide -useful tips beyond the scope of this user guide. To get you started, though, -we’ll illustrate page objects with a simple example. - -First, consider an example, typical of test automation, that does not use a -page object: +Page Object (objeto de página) es un patrón de diseño que se ha vuelto popular en +la automatización de pruebas para mejorar el mantenimiento de +las pruebas y reducir la duplicación de código. Un objeto de +página es un clase orientada a objetos que sirve como interfaz +para una página de tu AUT. Las pruebas luego usan los +métodos de esta clase de objeto de página cuando lo necesitan +para interactuar con la interfaz de usuario de esa página. El +beneficio es que si la interfaz de usuario cambia para la +página, las pruebas en sí mismas no necesitan cambiar, solo el +código dentro del objeto de página necesita cambiar. +Posteriormente, todos los cambios para soportar esa nueva +interfaz de usuario están ubicados en un solo lugar. + +El patrón de diseño de objetos de página ofrece las siguientes +ventajas: + +* Existe una separación clara entre el código de prueba y el +código específico de la página, como localizadores (o su uso si +está utilizando un mapa de interfaz de usuario) y diseño. +* Existe un único repositorio para los servicios u operaciones que +ofrece la página en lugar de tener estos servicios dispersos a +lo largo de las pruebas. + +En ambos casos, esto permite cualquier modificación requerida +debido a cambios en la interfaz de usuario puedan hacerse en +un solo lugar. Puedes encontrar buena información sobre esta +técnica en numerosos blogs, ya que este "patrón de diseño de +prueba" se está utilizando ampliamente. Nosotros animamos al +lector que desea saber más a buscar blogs en Internet al respecto. +Muchos han escrito sobre este patrón de diseño y +pueden proporcionar consejos útiles más allá del alcance de esta +guía del usuario. Para empezar, sin embargo, ilustraremos +objetos de página con un ejemplo simple. + +Primero, considere un ejemplo, típico de la automatización de +pruebas, que no utiliza un objeto de página: ```java /*** - * Tests login feature + * Prueba de la funcionalidad de inicio de sesión */ public class Login { public void testLogin() { - // fill login data on sign-in page + // ingresa los datos de inicio de sesión en la página de inicio de sesión driver.findElement(By.name("user_name")).sendKeys("testUser"); driver.findElement(By.name("password")).sendKeys("my supersecret password"); driver.findElement(By.name("sign-in")).click(); - // verify h1 tag is "Hello userName" after login + // verifica que la etiqueta h1 tiene el valor "Hello userName" después de iniciar sesión driver.findElement(By.tagName("h1")).isDisplayed(); assertThat(driver.findElement(By.tagName("h1")).getText(), is("Hello userName")); } } ``` -There are two problems with this approach. +Hay dos problemas con este enfoque. -* There is no separation between the test method and the AUT’s locators (IDs in -this example); both are intertwined in a single method. If the AUT’s UI changes -its identifiers, layout, or how a login is input and processed, the test itself -must change. -* The ID-locators would be spread in multiple tests, in all tests that had to -use this login page. +* No hay separación entre el método de prueba y los +localizadores del AUT (ID en este ejemplo); ambos están +entrelazados en un solo método. Si la UI del AUT cambia sus +identificadores, diseño o cómo se ingresa y procesa un inicio de +sesión, la prueba en sí debe cambiar. +* Los localizadores de ID +se distribuirían en múltiples pruebas, en todas las pruebas que +debían usar esta página de inicio de sesión. -Applying the page object techniques, this example could be rewritten like this -in the following example of a page object for a Sign-in page. +Aplicando las técnicas de objeto de página, este ejemplo podría +reescribirse como en el siguiente ejemplo de un objeto de página +para una página de inicio de sesión. ```java import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; /** - * Page Object encapsulates the Sign-in page. + * El objeto de página encapsula la página de inicio de sesión. */ public class SignInPage { protected static WebDriver driver; @@ -89,7 +96,7 @@ public class SignInPage { } /** - * Login as valid user + * Inicia sesión como un usuario válido * * @param userName * @param password @@ -104,19 +111,19 @@ public class SignInPage { } ``` -and page object for a Home page could look like this. +y el objeto de página para una página de inicio podría verse así. ```java import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; /** - * Page Object encapsulates the Home Page + * El objeto de página encapsula la página de inicio */ public class HomePage { protected static WebDriver driver; - //

Hello userName

+ //

Hola userName

private By messageBy = By.tagName("h1"); public HomePage(WebDriver driver){ @@ -137,20 +144,20 @@ public class HomePage { } public HomePage manageProfile() { - // Page encapsulation to manage profile functionality + // Encapsulación de página para administrar la funcionalidad del perfil return new HomePage(driver); } - /* More methods offering the services represented by Home Page - of Logged User. These methods in turn might return more Page Objects - for example click on Compose mail button could return ComposeMail class object */ + /* Mas métodos que ofrecen los servicios representados por la página de inicio +   del usuario registrado. Estos métodos a su vez podrían devolver más objetos de página, +   por ejemplo hacer clic en el botón Redactar correo podría devolver el objeto de clase ComposeMail */ } ``` -So now, the login test would use these two page objects as follows. +Entonces, la prueba de inicio de sesión usaría estos dos objetos de página de la siguiente manera. ```java /*** - * Tests login feature + * Prueba de la funcionalidad de inicio de sesión de pruebas */ public class TestLogin { @@ -164,31 +171,39 @@ public class TestLogin { } ``` -There is a lot of flexibility in how the page objects may be designed, but -there are a few basic rules for getting the desired maintainability of your -test code. - -Page objects themselves should never make verifications or assertions. This is -part of your test and should always be within the test’s code, never in an page -object. The page object will contain the representation of the page, and the -services the page provides via methods but no code related to what is being -tested should be within the page object. - -There is one, single, verification which can, and should, be within the page -object and that is to verify that the page, and possibly critical elements on -the page, were loaded correctly. This verification should be done while -instantiating the page object. In the examples above, both the SignInPage and -HomePage constructors check that the expected page is available and ready for -requests from the test. - -A page object does not necessarily need to represent an entire page. The Page -Object design pattern could be used to represent components on a page. If a -page in the AUT has multiple components, it may improve maintainability if -there is a separate page object for each component. - -There are other design patterns that also may be used in testing. Some use a -Page Factory for instantiating their page objects. Discussing all of these is -beyond the scope of this user guide. Here, we merely want to introduce the -concepts to make the reader aware of some of the things that can be done. As -was mentioned earlier, many have blogged on this topic and we encourage the -reader to search for blogs on these topics. +Hay mucha flexibilidad en cómo se pueden diseñar los objetos de +página, pero hay algunas reglas básicas para obtener la +mantenibilidad deseada de tu código de prueba. + +Los objetos de página en sí mismos nunca deben hacer +verificaciones o afirmaciones. Esto es parte de tu prueba y +siempre debe estar dentro del código de la prueba, nunca en una +página objeto. El objeto de página contendrá la representación +de la página, y el servicios que proporciona la página a través +de métodos, pero ningún código relacionado con lo que se está +probado debe estar dentro del objeto de la página. + +Hay una verificación única que puede y debe estar dentro del +objeto de página y eso es para verificar que la página, y +posiblemente elementos críticos en la página, se cargaron +correctamente. Esta verificación debe hacerse mientras +se instancia el objeto de la página. En los ejemplos anteriores, +tanto SignInPage como los constructores de HomePage verifican +que la página esperada esté disponible y lista para las solicitudes +de la prueba. + +Un objeto de página no necesariamente necesita representar una +página completa. El patrón de diseño de objetos de pagina podría +usarse para representar componentes en una página. Si la +página en el AUT tiene múltiples componentes, puede mejorar la +mantenibilidad si hay un objeto de página separado para cada +componente. + +Existen otros patrones de diseño que también pueden usarse en +las pruebas. Algunos usan un Page Factory para crear instancias +de sus objetos de página. Discutir todo esto es más allá del +alcance de esta guía del usuario. Aquí, simplemente queremos +presentar los conceptos para que el lector tome conciencia de +algunas de las cosas que se pueden hacer. Como fue mencionado +anteriormente, muchos han blogueado sobre este tema y alentamos +lector para buscar blogs sobre estos temas. diff --git a/docs_source_files/content/guidelines_and_recommendations/test_independency.es.md b/docs_source_files/content/guidelines_and_recommendations/test_independency.es.md index 22e7692a0319..c0c6e2b6da30 100644 --- a/docs_source_files/content/guidelines_and_recommendations/test_independency.es.md +++ b/docs_source_files/content/guidelines_and_recommendations/test_independency.es.md @@ -3,25 +3,22 @@ title: "Independencia en las pruebas" weight: 7 --- -{{% notice info %}} - Page being translated from -English to Spanish. Do you speak Spanish? Help us to translate -it by sending us pull requests! -{{% /notice %}} +Escribe cada prueba como su propia unidad. Escribe las pruebas +de una manera que no dependan de otras pruebas para +completarse: -Write each test as its own unit. Write the tests in a way that will not be -reliant on other tests to complete: +Digamos que hay un sistema de gestión de contenido con el que +puedes crear algún contenido personalizado que luego después +publicar aparece en tu sitio web como un módulo, y puede llevar +algún tiempo sincronizar entre el CMS y y la aplicación. -Let us say there is a content management system with which you can create -some custom content which then appears on your website as a module after -publishing, and it may take some time to sync between the CMS and the -application. +Una forma incorrecta de probar tu módulo es que el contenido +está creado y publicado en una prueba y luego verificando el +módulo en otra prueba. Esta no es factible ya que el contenido +puede no estar disponible de inmediato para otra prueba después +de la publicación. -A wrong way of testing your module is that the content is created and -published in one test, and then checking the module in another test. This -is not feasible as the content may not be available immediately for the -other test after publishing. - -Instead, you can create a stub content which can be turned on and off -within the affected test, and use that for validating the module. However, -for content creation, you can still have a separate test. +En cambio, puedes crear un contenido auxiliar que se puede +activar y desactivar dentro de la prueba afectada y úsarla para +validar el módulo. Sin embargo, para la creación de contenido, +aún puedes tener una prueba por separado. diff --git a/docs_source_files/content/remote_webdriver/_index.es.md b/docs_source_files/content/remote_webdriver/_index.es.md index a49f2e7638d0..28d4f8e82c5d 100644 --- a/docs_source_files/content/remote_webdriver/_index.es.md +++ b/docs_source_files/content/remote_webdriver/_index.es.md @@ -6,7 +6,7 @@ weight: 6 # WebDriver remoto -Puede usar WebDriver de forma remota de la misma manera que lo usarías +Puedes usar WebDriver de forma remota de la misma manera que lo usarías localmente. La principal diferencia es que un WebDriver remoto debe ser configurado para que pueda ejecutar tus pruebas en una máquina diferente. diff --git a/docs_source_files/content/webdriver/js_alerts_prompts_and_confirmations.es.md b/docs_source_files/content/webdriver/js_alerts_prompts_and_confirmations.es.md index 9cf4f7d7031a..708045361642 100644 --- a/docs_source_files/content/webdriver/js_alerts_prompts_and_confirmations.es.md +++ b/docs_source_files/content/webdriver/js_alerts_prompts_and_confirmations.es.md @@ -17,7 +17,7 @@ en la mayoría de los navegadores como OK. También se puede descartar en la mayoría de los navegadores presionando el botón de cerrar, pero esto siempre hará lo mismo que el presionar botón OK. -Esto es una alerta de ejemplo. +Esto es una alerta de ejemplo. WebDriver puede obtener el texto de la ventana emergente y aceptar o descartar estas alertas.