Skip to content

Commit 70fcded

Browse files
committed
Initial implementation
1 parent f21831d commit 70fcded

File tree

80 files changed

+3742
-2
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+3742
-2
lines changed

.github/renovate.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
3+
"extends": [
4+
"github>cucumber/renovate-config",
5+
"github>cucumber/renovate-config:messages-range-strategy-widen"
6+
]
7+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Release GitHub
2+
3+
on:
4+
push:
5+
branches: [release/*]
6+
7+
jobs:
8+
create-github-release:
9+
name: Create GitHub Release and Git tag
10+
runs-on: ubuntu-latest
11+
environment: Release
12+
permissions:
13+
contents: write
14+
steps:
15+
- uses: actions/checkout@v5
16+
- uses: cucumber/[email protected]
17+
with:
18+
github-token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release-mvn.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Release Maven
2+
3+
on:
4+
push:
5+
branches: [release/*]
6+
7+
jobs:
8+
publish-mvn:
9+
name: Publish Maven Package
10+
runs-on: ubuntu-latest
11+
environment: Release
12+
steps:
13+
- uses: actions/checkout@v5
14+
- uses: actions/setup-java@v5
15+
with:
16+
distribution: 'temurin'
17+
java-version: '17'
18+
cache: 'maven'
19+
- uses: cucumber/[email protected]
20+
with:
21+
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
22+
gpg-passphrase: ${{ secrets.GPG_PASSPHRASE }}
23+
nexus-username: ${{ secrets.SONATYPE_USERNAME }}
24+
nexus-password: ${{ secrets.SONATYPE_PASSWORD }}
25+
working-directory: java

.github/workflows/test-java.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: test-java
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- renovate/**
8+
paths:
9+
- java/**
10+
- testdata/**
11+
- .github/**
12+
pull_request:
13+
branches:
14+
- main
15+
paths:
16+
- java/**
17+
- testdata/**
18+
- .github/**
19+
workflow_call:
20+
21+
jobs:
22+
test-java:
23+
runs-on: ${{ matrix.os }}
24+
strategy:
25+
fail-fast: true
26+
matrix:
27+
os:
28+
- ubuntu-latest
29+
java: ['17', '21']
30+
31+
steps:
32+
- uses: actions/checkout@v5
33+
34+
- uses: actions/setup-java@v5
35+
with:
36+
distribution: 'temurin'
37+
java-version: ${{ matrix.java }}
38+
cache: 'maven'
39+
40+
- run: mvn verify
41+
working-directory: java
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: test-testdata
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- testdata/**
9+
pull_request:
10+
branches:
11+
- main
12+
paths:
13+
- testdata/**
14+
15+
jobs:
16+
test-testdata:
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
21+
- uses: actions/checkout@v5
22+
23+
- uses: actions/setup-node@v5
24+
with:
25+
cache: 'npm'
26+
cache-dependency-path: testdata/package-lock.json
27+
28+
- run: npm ci
29+
working-directory: testdata
30+
31+
- name: check repository is not dirty
32+
run: "[[ -z $(git status --porcelain) ]]"
33+
34+
- name: show diff
35+
if: ${{ failure() }}
36+
run: git status --porcelain

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.idea/
2+
*.iml

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The formatter is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [Unreleased]
9+
### Added
10+
- Java implementation ([#1](https://github.com/cucumber/usage-formatter/pull/1) M.P. Korstanje)
11+
12+
[Unreleased]: https://github.com/cucumber/usage-formatter/compare/f21831df98c5e57a53950a92b068df8321e45bce...HEAD

README.md

Lines changed: 76 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,76 @@
1-
# usage-formatter
2-
Prints usage statatistics for step definitions
1+
# Usage Formatter
2+
⚠️ This is an internal package; you don't need to install it in order to use the Usage Formatter.
3+
4+
[![Maven Central](https://img.shields.io/maven-central/v/io.cucumber/usage-formatter.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:io.cucumber%20AND%20a:usage-formatter)
5+
6+
Writes usage statistics for step definitions
7+
8+
## Features
9+
10+
Can render a plain text report showing which step definitions are used by which
11+
steps and some statistics for long each took. The error from the mean is the 95%
12+
confidence interval assuming a normal distribution.
13+
14+
```
15+
Expression/Text Duration Mean ± Error Location
16+
an order for {string} 0.009s 0.001s ± 0.000s samples/multiple-features/multiple-features.ts:3
17+
an order for "eggs" 0.001s samples/multiple-features/multiple-features-1.feature:3
18+
an order for "milk" 0.001s samples/multiple-features/multiple-features-1.feature:6
19+
an order for "bread" 0.001s samples/multiple-features/multiple-features-1.feature:9
20+
an order for "batteries" 0.001s samples/multiple-features/multiple-features-2.feature:3
21+
an order for "light bulbs" 0.001s samples/multiple-features/multiple-features-2.feature:6
22+
4 more
23+
```
24+
25+
The output can also be rendered as a json report.
26+
27+
```json
28+
{
29+
"stepDefinitions": [
30+
{
31+
"sourceReference": {
32+
"uri": "samples/multiple-features/multiple-features.ts",
33+
"location": {
34+
"line": 3
35+
}
36+
},
37+
"duration": {
38+
"sum": {
39+
"seconds": 0,
40+
"nanos": 9000000
41+
},
42+
"mean": {
43+
"seconds": 0,
44+
"nanos": 1000000
45+
},
46+
"moe95": {
47+
"seconds": 0,
48+
"nanos": 0
49+
}
50+
},
51+
"expression": {
52+
"source": "an order for {string}",
53+
"type": "CUCUMBER_EXPRESSION"
54+
},
55+
"matches": [
56+
{
57+
"text": "an order for \"eggs\"",
58+
"duration": {
59+
"seconds": 0,
60+
"nanos": 1000000
61+
},
62+
"uri": "samples/multiple-features/multiple-features-1.feature",
63+
"location": {
64+
"line": 3,
65+
"column": 3
66+
}
67+
},
68+
...
69+
```
70+
71+
72+
## Contributing
73+
74+
Each language implementation validates itself against the examples in the
75+
`testdata` folder. See the [testdata/README.md](testdata/README.md) for more
76+
information.

java/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.idea/
2+
*.iml
3+
target/
4+
pom.xml.versionsBackup

java/pom.xml

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
6+
<parent>
7+
<groupId>io.cucumber</groupId>
8+
<artifactId>cucumber-parent</artifactId>
9+
<version>4.4.0</version>
10+
</parent>
11+
12+
<artifactId>usage-formatter</artifactId>
13+
<version>0.0.1-SNAPSHOT</version>
14+
<packaging>jar</packaging>
15+
<name>Usage Formatter</name>
16+
<description>Writes usage statistics for step definitions</description>
17+
<url>https://github.com/cucumber/usage-formatter</url>
18+
19+
<properties>
20+
<project.Automatic-Module-Name>io.cucumber.usageformatter</project.Automatic-Module-Name>
21+
<project.build.outputTimestamp>1758245480</project.build.outputTimestamp>
22+
</properties>
23+
24+
<scm>
25+
<connection>scm:git:git://github.com/cucumber/usage-formatter.git</connection>
26+
<developerConnection>scm:git:[email protected]:cucumber/usage-formatter.git</developerConnection>
27+
<url>git://github.com/cucumber/usage-formatter.git</url>
28+
<tag>HEAD</tag>
29+
</scm>
30+
31+
<dependencyManagement>
32+
<dependencies>
33+
<dependency>
34+
<groupId>org.junit</groupId>
35+
<artifactId>junit-bom</artifactId>
36+
<version>6.0.0</version>
37+
<type>pom</type>
38+
<scope>import</scope>
39+
</dependency>
40+
41+
<dependency>
42+
<groupId>com.fasterxml.jackson</groupId>
43+
<artifactId>jackson-bom</artifactId>
44+
<version>2.20.0</version>
45+
<type>pom</type>
46+
<scope>import</scope>
47+
</dependency>
48+
49+
<dependency>
50+
<groupId>org.assertj</groupId>
51+
<artifactId>assertj-bom</artifactId>
52+
<version>3.27.6</version>
53+
<type>pom</type>
54+
<scope>import</scope>
55+
</dependency>
56+
</dependencies>
57+
</dependencyManagement>
58+
59+
<dependencies>
60+
<dependency>
61+
<groupId>io.cucumber</groupId>
62+
<artifactId>messages</artifactId>
63+
<version>[29.0.1,31.0.0)</version>
64+
</dependency>
65+
<dependency>
66+
<groupId>io.cucumber</groupId>
67+
<artifactId>query</artifactId>
68+
<version>[14.3.0,15.0.0)</version>
69+
</dependency>
70+
71+
<dependency>
72+
<groupId>com.fasterxml.jackson.core</groupId>
73+
<artifactId>jackson-databind</artifactId>
74+
<scope>test</scope>
75+
</dependency>
76+
77+
<dependency>
78+
<groupId>com.fasterxml.jackson.datatype</groupId>
79+
<artifactId>jackson-datatype-jdk8</artifactId>
80+
<scope>test</scope>
81+
</dependency>
82+
83+
<dependency>
84+
<groupId>com.fasterxml.jackson.module</groupId>
85+
<artifactId>jackson-module-parameter-names</artifactId>
86+
<scope>test</scope>
87+
</dependency>
88+
89+
<dependency>
90+
<groupId>org.assertj</groupId>
91+
<artifactId>assertj-core</artifactId>
92+
<scope>test</scope>
93+
</dependency>
94+
95+
<dependency>
96+
<groupId>org.junit.jupiter</groupId>
97+
<artifactId>junit-jupiter</artifactId>
98+
<scope>test</scope>
99+
</dependency>
100+
</dependencies>
101+
</project>

0 commit comments

Comments
 (0)