Java + Selenium series of failed operations and call the shots

1, rely on introducing Pom

This dependency has a tool class File, copy files, and the like may be operating

<dependency>
      <groupId>commons-io</groupId>
      <artifactId>commons-io</artifactId>
      <version>2.4</version>
</dependency>

2, defines a method of Theme

Different browsers driver is not the same, it is necessary to save the package and a method of Theme path, the method writes the class BrowserUtil

 

 3, listening to call the shots when the method fails use case

The use TestNg IHookable interface that can dynamically monitor a state of the embodiment, the success or failure, the RUN method mating interface, the frame is encapsulated

 4 , need to configure the listener in the use case execution testng.xml

5, the screenshots embedded inside Allure reports for easy viewing

Allure can view the official explanation, annotation attachments

 

Guess you like

Origin www.cnblogs.com/wanshuang/p/12598098.html