Javaweb Learning Summary One (Eclipse common shortcut keys, debug debugging, and JUnit test framework)

Source: Internet
Author: User

One: The development trend of the Web
1:C/S (client/server) structure to B/s (browser/server) structure development, the future of the computer only need operating system and browser.
All services are stored on the server side, only need to log in after the user to synchronize data from the service, for example: see the movie does not need to download PPS, PPTV, etc.

Client software, just open the Web page, watch on the page; Write articles can be directly on the page (blog), do not need to download word software

, in the client software editing, e-mail directly on the page, do not need to download Foxmail, Outlook and other client software, the current trend

has been presented, but there are still a lot of constraints. Such as

A: Bandwidth constraints, resulting in no speed.

B: The functionality of the browser is not that powerful yet.

2: The advent of mobile devices has led to the development of decades of traditional software refactoring, people doing some learning or working activities are through the mobile device

, many programmers will need to port the previous PC-capable programs to mobile devices, which makes Android engineers brilliant.

3: The advent of the cloud and the popularity of B/s, resulting in the subsequent server-side programming will be very fire, the code will appear refactoring.

Second: Common Eclipse Breakpoint debugging
1:f5:step into Enter method F6:step over skip F7:step return jump
The symbol behind the 2:F7 jumps to the first line of the method step to resume:

3: Green triangle release Breakpoint or skip to next breakpoint

4: Select variable Right---watch: View the value of the variable
5: The endpoint of debug should be cleaned up in time before the view switch

Three: Eclipse common quick action
ALT + Before and after, tracking code

alt+/: Content Assistant
ctrl+shift+/: Notes
Ctrl+shift+\: Remove Comments
Ctrl+shift+g: See who calls the method
Ctrl+shift+o: Guide Pack
Ctrl+l: Navigates to a row in a file
Ctrl+shift+r: Finding Files
Ctrl+h: Find what's contained in a file

Ctrl+shift+f: Formatting code

Custom shortcut key: window--preferences--Enter keys to customize the binding shortcut.

Four: JUnit framework, Unit testing
1: Test method above annotated @test, remember to introduce JUNIT Framework and guide package


2: @before @after before and after the test method execution, you can load and close some resources

1 privateString Driverclassname; 2 PrivateString URL; 3 PrivateString username; 4 private String password; 5 private  Connection Conn; 6 7  @Before 8 public void  before () {9 DRIVERCL Assname = "Com.mysql.jdbc.Driver" ; url = "Jdbc:mysql://localhost:3306/test" ; username = "root" ; Password = "root" ; }14  @Test16/**17 * Test Get database connection */19 public void testgetconnection () throws  SQLException {DataSource ds = new  DataSource (driverclassname, URL, username, password), conn =  ds. Getconnection (); SYSTEM.OUT.PRINTLN ("conn:" +  conn); }25- @After27 public void  after () {Conn! = null ] {$ try  {$  conn.close (); System.out.println ("Close succeeded! ""); catch  (SQLException e) {e.printstacktrace }35 }36}    /span>                

3: @beforeClass @afterClass executes before and after class loading, and is also used to load and close resources
The 4:assert API has some methods to assert whether the resulting values are equal to the expected value.

If the test succeeds, a green progress bar appears, and a brown progress bar appears for failure!

Javaweb Learning Summary One (Eclipse common shortcut keys, debug debugging, and JUnit test framework)

Related Article

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.