Testing process:
1. Start Appium server. Start with the Appium command.
2, configure Appium client. Appium The parameter configuration of the client.
3. Execute the call through Webdriver.
First, extend the Assertresult class
The main extension function, when the assertion fails, automatically save, at this time need to rewrite the Assertresult onassertfailure method, rewrite the code as follows:
Public classAssertresultextendsassertion{@Override Public voidonassertfailure (Iassert assertcommand) {System.out.println ("Assertion failed, being ..."); Try { //Executionscreenshot (); } Catch(malformedurlexception e) {//TODO auto-generated Catch blockE.printstacktrace (); System.out.println ("Get Failed"); } }}
Call Method: Change the original use Assert call to Assertresult object call
New Assertresult (). Assertequals (Wbcontactname.gettext (), "dddd", "assertion failed");
At this point, if the assertion fails, the file is created by default under the Temp folder of the system's current user, in PNG format
Appium related Learning (ii) The Assert class in testng