Mockito @ beforeclass @ beforemethod @ beforetest Lifecycle

Source: Internet
Author: User

@ [Email protected]

Class is executed before instantiation. It is mainly used to set environment variables. When used with springtestcontext, note that @ autowire bean has not yet been instantiated.

@ [Email protected]

Before the entire test class starts, the method is executed, the main user is sticky, or the mock (object) initialization is performed. This method runs only once.

@ [Email protected]

Call each test method before execution. The main difference with @ beforetest is that if you need to clear some of the test context each time, you need to use it with @ aftermethod.

 

Leave a message if you have any questions!

Mockito @ beforeclass @ beforemethod @ beforetest Lifecycle

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.