Appium related Learning (ii) The Assert class in testng

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.