如何通过IntelliJ或GitLab统计季度新增Cucumber自动化特性文件数量?
Absolutely! You’ve got a few solid options here using Git (which plays nice with both IntelliJ and GitLab) and direct GitLab UI tools. Let’s break down the easiest, most reliable ways to count those new Cucumber .feature files from the last quarter:
This is the gold standard because Git tracks every file’s creation history directly. Open up a terminal (either in IntelliJ’s built-in terminal, GitLab’s web terminal, or your local machine) and run this command, adjusting the date range to match your quarter:
git log --since="2024-01-01" --until="2024-03-31" --diff-filter=A --name-only -- '*.feature' | sort | uniq | wc -l
Let’s break down what each part does so you can tweak it:
--since/--until: Lock in your quarter’s start and end dates (use YYYY-MM-DD format for consistency)--diff-filter=A: Only show files that were added (no edits or deletions)--name-only: Skip all commit messages, just output the file paths'*.feature': Target only Cucumber feature files (no other file types)sort | uniq: Remove duplicate entries (rare, but safe if a file was re-added accidentally)wc -l: Counts the number of lines (each line is a unique new file)
Pro tip: If all your feature files live in a specific folder (like src/test/resources/features), narrow the search to that path for extra precision:
git log --since="2024-01-01" --until="2024-03-31" --diff-filter=A --name-only -- 'src/test/resources/features/*.feature' | sort | uniq | wc -l
Great for team members who prefer a GUI. Here’s how to do it:
- Go to your GitLab project and click Repository > Files in the left sidebar
- Click the Filter button at the top of the file list
- Under the "Created" dropdown, select your quarter’s start and end dates
- In the file search bar, type
*.featureto filter only Cucumber files - Look at the top-right corner of the results—GitLab will show you the total number of matching files (e.g., "12 results")
Note: This counts files first created in the date range, which is exactly what you want for tracking new features.
If you’re working locally in IntelliJ, you’ve got two options:
3.1 Using Git Log in IntelliJ
For precise counts tied to your Git history:
- Open the Git Log tool by pressing
Alt+9(or go to Git > Log in the menu bar) - Click the Filter icon (funnel shape) at the top of the log panel
- Set your date range under "Date Range"
- In the "Path Filter" field, type
*.feature - To get the count, you can either run the Git command from IntelliJ’s terminal (as in Section 1) or manually tally the unique new files shown in the diffs. The terminal method is way faster for large datasets.
3.2 Using Local History (For Local Changes Only)
If you want to track files you’ve added locally (not yet pushed to GitLab):
- Right-click your project root or features folder
- Select Local History > Show History
- Use the calendar icon in the history panel to set your quarter’s date range
- Search for
.featurein the history search bar - New files will be marked with a green icon—select all of them, and IntelliJ will show the total count in the bottom status bar.
内容的提问来源于stack exchange,提问作者gppanter

