Skip to content

s2oBCN/test-academy-selenium

Repository files navigation

demo-Web-testing-with-Selenium

Project to test Serenity with Selenium and Cucumber

  • Demo project to know how to architecture a test project which has some complexity.
  • The project is following the Page Object pattern. Where a class express the interface of a page and nothing related to a test can be inside the class. So:
    • No webElement should be exposed from a page object.
    • No assert can be done inside a page object. So, be careful if you write a mehtod to verify anything in a page class, ie returns a boolean, that your are not coupled to a test.

Responsible

Sergio Sacristan [email protected]

Getting started

You can improve everything in the project with a PR:

  • You need to create a git branch, following the naming convention feature/whatever
  • Make a pull request!
  • Thank you in advance for your contribution!!!!

Requirements

Structure

Application mirror

  • src/main/java.../domain: DTO objects (for the data interface of every page)
  • src/main/java.../pages: Page objects

Application tests

  • src/test/resources/features: create a structure in order to have all the features of a page in the same folder.
  • src/test/java/,,,/builders: use the patter Builder and Data Builder in order to encapsulate the managemenet of the data needed for the tests.
  • src/test/java/,,,/domain: DTO to access the API of the AUT (application under test).
  • src/test/java/,,,/services: use the pattern Facade to encapsulate the initialization of the data scenario. This initialization should be done be calling the API services of the AUT or DB (using a DAO), but never initialize the data calling another pages of the AUT.
  • src/test/java/,,,/stepsdefs: create a StepDef per Feature, and follow the same package structure as the related feature
    • For commonn steps to different stepDef, but within the same folder, create a CommonStepDef
    • Use Serenity.getCurrentSession().put/get to share common data between related steps definitions classes
  • src/test/java/,,,/tests: here you have the classes to run the tests

Configuration

  • This is a gradle project, you can import it from your favorite IDE as Gradle project.
  • To verify that all is up to date with dependencies and test compilation, execute the gradle task: testClasses
    gradlew.bat testClasses

Compilation

Execution

  • From gradle:
gradle test -Dcucumber.options="--tags @something"
  • From junit class: src/test/java/es/s2o/selenium/tests/reservations/ReservationTest.java
  • See the reports in target/site/serenity/index.html

CI

$ zalenium/docker-compose up -d

Práctica

Utilizando los patrones aprendidos y frameworks Open Source. Implementar el siguiente escenario: En la web de Vueling, verificar que existen vuelos para la siguiente búsqueda: ■ Origen ‘Madrid’ ■ Destino ‘Barcelona’, ■ Fecha ‘1 Junio’ ■ Solo ida ■ Un único pasajero-Se puede implementar en cualquier lenguaje.-El entregable debe contener: ■ Código fuente del proyecto (sin el compilado) ■ Un README con las instrucciones necesarias para la ejecución del test. ■ Un report con el resultado de la ejecución

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published