Skip to content
This repository has been archived by the owner on Feb 22, 2019. It is now read-only.

webtest

Pavel Vlasov edited this page Aug 2, 2014 · 23 revisions

WebTest

Nasdanika WebTest is a Web UI automated testing and documentation generation framework built on Selenium WebDriver and JUnit.

The framework provides JUnit test runner class and test suite runner classes which generate an HTML report with detailed screenshots after test/suite execution. Screenshots are collected transparently by intercepting invocations of test, actor, and page methods.

The framework encourages separation of actor/page specification and implementation. Such separation enables parallelization of development of tests and actor/page implementations against page specifications. It also allows to write page/actor implementation-independent tests and run them against different implementations.

The framework also provides several annotations which allow to customize test execution and report generation.

Concepts

  • Test case - a JUnit 4 test case class which implements WebTest interface and runs with NasdanikaTestRunner. The test case shall obtain an instance of WebDriver in @Before method and also create proxies of actor and page factories by invoking NasdanikaTestRunner.proxyActorFactory() and NasdanikaTestRunnar.proxyPageFactory(). It also shall quit the driver in @After method.
  • Test method - a JUnit test method, NasdanikaTestRunner take a screenshot before and after test method execution. Test methods may operate with web driver directly, but it is recommended to use actor and page layers of abstraction.
  • Page - an interface/class pair which provides a facade for test/actor code to interact with a Web page. It abstracts test/actor code from details of the page implementation. For WebTest to be able to record page method invocations and take snapshots, pages must be defined as interfaces extending Page interface. See Page Object for additional information.
  • PageFactory - a factory interface for creating pages.
  • Actor - an interface/class pair which groups fine-grained operations on a page or a group of pages into coarse-grained business methods.
  • ActorFactory - a factory interface for creating actors.

Annotations

  • Report - can be applied to a test class - case or suite - to customize report generation.
  • Title - applies to test/actor/page classes and methods to customize how given class/method appears in the report. If this annotation is not provided the title is constructed from class/method name by splitting class/method name by camel case character class, capitalizing the first word and lower-casing the others. E.g. a title for myVeryComplexTest() method would be My very complex test.
  • Description - allows to attach a description to class/method to appear in the report.
  • Pending - test methods with this annotation are not executed but included into the report.

Usage scenarios

Single application

Software product lines

Consistent experience through reuse.

Parallel development of tests/actor libs and page implementations against page specs.

Multiple page and actor libraries, independence of tests from implementations - services/extensions

Integration

If WebServices/RESTful are not available - share you actor/page libs with your partners.

Clone this wiki locally