Web UI自动化测试框架搭建之七:代码格式

当代码要共享时,需要规范代码格式,可以去网上搜索好用的代码格式,我找到了下面的google java style


Step 1: Download the Google Java Style guide definition for Eclipse

The definition is here. (https://github.com/google/styleguide/blob/gh-pages/eclipse-java-google-style.xml)

Step 2: Add the Google Style formatter to Eclipse

  1. Opening Eclipse settings varies per OS. For example, on macOS open Eclipse -> Preferences.
  2. In the search bar on the left, type “formatter”, and select the Java -> Code Style -> Formatter menu item.

    Web UI自动化测试框架搭建之七:代码格式_第1张图片

  3. Click “Import” and browse to the XML file you downloaded in Step 1.
  4. Ensure the “GoogleStyle” item is selected in the “Active profile” section.

    Web UI自动化测试框架搭建之七:代码格式_第2张图片

  5. Click “OK”.

Step 3: Configure save actions to automatically format your code when saving

This is a game-changer!

  1. In the Preferences menu (same as in Step 2), type “save actions”, and select Java -> Editor -> Save Actions.

    Web UI自动化测试框架搭建之七:代码格式_第3张图片

  2. Select “Perform the selected actions on save”.
  3. Select “Format source code”.
  4. Click the “Formatter” link and ensure the “GoogleStyle” formatter is selected as active.
  5. Click OK.

你可能感兴趣的:(Web,UI自动化测试框架)