Skip to content

Commit f8df0c7

Browse files
Deploy
0 parents  commit f8df0c7

File tree

19 files changed

+1213
-0
lines changed

19 files changed

+1213
-0
lines changed

β€Ž.github/workflows/macos.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: MacOS
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
build:
11+
runs-on: macos-latest
12+
13+
steps:
14+
- uses: actions/checkout@v2
15+
- name: Set up JDK 11
16+
uses: actions/setup-java@v1
17+
with:
18+
java-version: 11
19+
- name: Build with Maven and generate coverage report
20+
env:
21+
GITHUB_USERNAME: williamniemiec
22+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23+
run: mvn --file pom.xml jacoco:prepare-agent resources:testResources install jacoco:report
24+
- uses: codecov/codecov-action@v1
25+
with:
26+
file: ./**/target/site/jacoco/jacoco.xml
27+
name: codecov
28+

β€Ž.github/workflows/ubuntu.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Ubuntu
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v2
15+
- name: Set up JDK 11
16+
uses: actions/setup-java@v1
17+
with:
18+
java-version: 11
19+
- name: Build with Maven and generate coverage report
20+
env:
21+
GITHUB_USERNAME: williamniemiec
22+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23+
run: mvn --file pom.xml jacoco:prepare-agent resources:testResources install jacoco:report
24+
- uses: codecov/codecov-action@v1
25+
with:
26+
file: ./**/target/site/jacoco/jacoco.xml
27+
name: codecov
28+

β€Ž.github/workflows/windows.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Windows
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
build:
11+
runs-on: windows-latest
12+
13+
steps:
14+
- uses: actions/checkout@v2
15+
- name: Set up JDK 11
16+
uses: actions/setup-java@v1
17+
with:
18+
java-version: 11
19+
- name: Build with Maven and generate coverage report
20+
env:
21+
GITHUB_USERNAME: williamniemiec
22+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23+
run: mvn --file pom.xml jacoco:prepare-agent resources:testResources install jacoco:report
24+
- uses: codecov/codecov-action@v1
25+
with:
26+
file: ./**/target/site/jacoco/jacoco.xml
27+
name: codecov
28+

β€Ž.gitignore

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Project
2+
.settings/
3+
.vscode
4+
.project
5+
.classpath
6+
.idea
7+
.iml
8+
9+
# Maven
10+
target/
11+
pom.xml.tag
12+
pom.xml.releaseBackup
13+
pom.xml.versionsBackup
14+
pom.xml.next
15+
release.properties
16+
dependency-reduced-pom.xml
17+
buildNumber.properties
18+
.mvn/timing.properties
19+
.mvn/wrapper/maven-wrapper.jar
20+
21+

β€ŽCONTRIBUTING.md

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
# JDB - Contributing Guide
2+
3+
- [Issues](#issues)
4+
- [Pull Request - Guide](#pull-request-guide)
5+
- [Setting up development environment](#development-setup)
6+
- [Code style guide](#code-style)
7+
- [Documentation standard](#doc-standard)
8+
- [Jar generation](#jar-generation)
9+
- [Creating branches](#new-branch)
10+
- [Creating tags](#new-tag)
11+
12+
13+
## <a name="issues"></a> Issues
14+
15+
- If there is a problem or question while editing the project, create an [issue](https://github.com/wniemiec-component-java/junit4-runner/pulls) detailing the problem or question.
16+
17+
18+
## <a name="pull-request-guide"></a> Pull Request - Guide
19+
20+
### Branch
21+
- If the changes made do not change the structure of the application or the way to use any functionality, use the current branch; otherwise, [creates a new branch](#new-branch) in the following format:
22+
23+
> If the current branch is `N.x`, the new branch should be called `(N + 1).x` (without parentheses), where N is a number
24+
25+
<b>Attention:</b> Do not make any changes using the `master` branch, as it will be the result of the merge with the latest version released.
26+
27+
### Tag
28+
- Always create a tag before creating a pull request
29+
- Only create the tag at the end of your changes
30+
- only one tag per pull request must be created
31+
- Choose a different tag from the current tag. If the current tag is X.Y.Z, where X, Y and Z are numbers, [create a new tag](#new-tag) using the following criteria:
32+
- If the changes made are minor, that is, small modifications that do not change the way of using a feature or even for bug fixes, create the tag `X.Y.(Z + 1)` (without parentheses)
33+
- If new features are added, create the `X.(Y + 1).0` tag (without parentheses)
34+
- If the way of using one or more features is changed, or even if a feature is deleted, create a new branch with the name `(X + 1).x` and create a new tag with the name `(X + 1).0.0` (without parentheses)
35+
36+
<b>Attention:</b> Tag creation should be `Annotated Tags` type.
37+
38+
39+
- Released versions should be placed in the `dist/X.Y` directory, where X and Y are the released version numbers
40+
- Try whenever possible to add tests on each added feature. If a feature is edited, make sure the tests related to it continue to work.
41+
- Before adding a new functionality, it is recommended to create an issue describing the new functionality and a justification of why it would be useful to the application.
42+
43+
If the contribution is to correct a bug, the commit should be: `bug fix # xyzw`, where #xyzw is the issue id that quotes the bug. If not, the commit should be `bug fix <DESCRIPTION>`, where \<DESCRIPTION\> is a brief description of the bug that has been fixed.
44+
45+
### <a name="pull-request-submit"></a> Pull request submit
46+
After making changes to the project, create a pull request with the project you have modified. Try to add a detailed description of what you changed from the original project. Avoid changing the structure of the project as much as possible to avoid breaking code.
47+
48+
<b> Attention: </b> Before making the pull request, make sure that:
49+
* Generate the version jar in the following format: `junit4-runner-X.Y.Z.jar`, where X, Y and Z are the numbers corresponding to the tag that will contain the changes made;
50+
* Document the changes according to the [documentation standard mentioned above](#doc-standard).
51+
52+
## <a name="development-setup"></a> Setting up development environment
53+
54+
To work on the project, any IDE with support for JDB can be used (to execute the project tests).
55+
56+
### <a name="output-dir"></a>Output directory
57+
The output directory of the project, that is, the directory where the compiled files will be placed must be `bin`, which must be at the root of the project. It is worth mentioning that this directory should not be submitted to the repository (`.gitignore` will ignore this directory).
58+
59+
## <a name="code-style"></a>Code style guide
60+
The project uses the [code style recommended by Oracle](https://www.oracle.com/java/technologies/javase/codeconventions-contents.html), with one exception: structures `if-then-else`, `try-catch-finally` and the like should not have a closed curly bracket (`}`) to the left of the keyword.
61+
62+
### Example
63+
#### Good
64+
<pre>
65+
if (x == 2) {
66+
return "two";
67+
}
68+
else if (x == 3) {
69+
return "three"
70+
}
71+
</pre>
72+
73+
#### Bad
74+
<pre>
75+
if (x == 2) {
76+
return "two";
77+
} else if (x == 3) {
78+
return "three"
79+
}
80+
</pre>
81+
82+
83+
## <a name="doc-standard"></a>Documentation standard
84+
All classes, public methods and some variables use [javadoc](https://docs.oracle.com/javase/8/docs/technotes/tools/windows/javadoc.html) to explain its functionality.
85+
86+
87+
### <a name="doc-standard-class-enum"></a>Classes, inner classes and enumerations
88+
Classes should use the following pattern:
89+
90+
<pre>
91+
/**
92+
* Class description.
93+
*
94+
* @since A.B.C
95+
*/
96+
</pre>
97+
98+
Where X, Y and Z are numbers relative to the version of the application in which the class was last modified and A, B and C identify the version of the application in which the class was created. The annotation is separated from the content with 2 tabs. In addition, internally, the class should be divided into sections, which are identified with the following pattern:
99+
100+
<pre>
101+
//-------------------------------------------------------------------------
102+
// [section_name]
103+
//-------------------------------------------------------------------------
104+
</pre>
105+
106+
Where [section_name] can be:
107+
* Attributes
108+
* Constructor(s)
109+
* Methods
110+
* Getters
111+
* Getters & Setters
112+
* Setters
113+
* Initialization block
114+
* Tests
115+
* Test hooks
116+
* Serialization and deserialization methods
117+
* Enumerations
118+
* Inner classes
119+
120+
121+
### <a name="doc-standard-methods"></a> Methods
122+
Public methods must be documented using javadoc.
123+
124+
## Appendix
125+
126+
### <a name="new-branch"></a> Creating branches
127+
Create a new branch:
128+
129+
<pre>
130+
git checkout -b branch_name
131+
</pre>
132+
133+
Add to the remote repository:
134+
135+
<pre>
136+
git push -u origin branch_name
137+
</pre>
138+
139+
#### Example
140+
<pre>
141+
git checkout -b v1.x
142+
git push -u origin v1.x
143+
</pre>
144+
145+
See more [here](https://git-scm.com/book/en/v2/Git-Branching-Basic-Branching-and-Merging).
146+
147+
### <a name="new-tag"></a> Creating tags
148+
<pre>
149+
git tag -a tag_name -m description
150+
</pre>
151+
152+
Add to the remote repository:
153+
154+
<pre>
155+
git push -u origin tag_name
156+
</pre>
157+
158+
#### Example
159+
<pre>
160+
git tag -a v1.0.1 -m "Performance improvement"
161+
git push -u origin v1.0.1
162+
</pre>
163+
164+
See more [here](https://git-scm.com/book/en/v2/Git-Basics-Tagging).

β€ŽLICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021 William Niemiec
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

β€ŽREADME.md

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
![](https://github.com/wniemiec-component-java/junit4-runner/blob/master/docs/img/logo/logo.jpg)
2+
3+
<h1 align='center'>JUnit 4 Runner</h1>
4+
<p align='center'>Component for running JUnit 4 tests in code.</p>
5+
<p align="center">
6+
<a href="https://github.com/wniemiec-component-java/junit4-runner/actions/workflows/windows.yml"><img src="https://github.com/wniemiec-component-java/junit4-runner/actions/workflows/windows.yml/badge.svg" alt=""></a>
7+
<a href="https://github.com/wniemiec-component-java/junit4-runner/actions/workflows/macos.yml"><img src="https://github.com/wniemiec-component-java/junit4-runner/actions/workflows/macos.yml/badge.svg" alt=""></a>
8+
<a href="https://github.com/wniemiec-component-java/junit4-runner/actions/workflows/ubuntu.yml"><img src="https://github.com/wniemiec-component-java/junit4-runner/actions/workflows/ubuntu.yml/badge.svg" alt=""></a>
9+
<a href="https://codecov.io/gh/wniemiec-component-java/junit4-runner"><img src="https://codecov.io/gh/wniemiec-component-java/junit4-runner/branch/master/graph/badge.svg?token=R2SFS4SP86" alt="Coverage status"></a>
10+
<a href="http://java.oracle.com"><img src="https://img.shields.io/badge/java-8+-D0008F.svg" alt="Java compatibility"></a>
11+
<a href="https://mvnrepository.com/artifact/io.github.wniemiec-component-java/junit4-runner"><img src="https://img.shields.io/maven-central/v/io.github.wniemiec-component-java/junit4-runner" alt="Maven Central release"></a>
12+
<a href="https://github.com/wniemiec-component-java/junit4-runner/blob/master/LICENSE"><img src="https://img.shields.io/github/license/wniemiec-component-java/junit4-runner" alt="License"></a>
13+
</p>
14+
<hr />
15+
16+
## ❇ Introduction
17+
Simple component for running JUnit 4 tests in a simplified way in code.
18+
## ❓ How to use
19+
1. Add one of the options below to the pom.xml file:
20+
21+
#### Using Maven Central (recomended):
22+
```
23+
<dependency>
24+
<groupId>io.github.wniemiec-component-java</groupId>
25+
<artifactId>junit4-runner</artifactId>
26+
<version>LATEST</version>
27+
</dependency>
28+
```
29+
30+
#### Using GitHub Packages:
31+
```
32+
<dependency>
33+
<groupId>wniemiec.component.java</groupId>
34+
<artifactId>junit4-runner</artifactId>
35+
<version>LATEST</version>
36+
</dependency>
37+
```
38+
39+
2. Run
40+
```
41+
$ mvn install
42+
```
43+
44+
3. Use it
45+
```
46+
[...]
47+
48+
import wniemiec.component.java.JUnit4Runner;
49+
50+
[...]
51+
52+
Path workingDirectory = Path.of(".", "bin").toAbsolutePath().normalize();
53+
Path stringUtilsClassPath = workingDirectory.resolve(
54+
Path.of("api", "util", "StringUtilsTest.class")
55+
);
56+
List&lt;Path> classpaths = List.of(
57+
workingDirectory.resolve(stringUtilsClassPath)
58+
);
59+
60+
JUnit4Runner junit4runner = new JUnit4Runner.Builder()
61+
.workingDirectory(workingDirectory)
62+
.classPath(classpaths)
63+
.classSignature(classSignature)
64+
.build();
65+
66+
junit4runner.run();
67+
68+
[...]
69+
```
70+
71+
## πŸ“– Documentation
72+
| Property |Parameter type|Return type|Description|Default parameter value|
73+
|----------------|-------------------------------|-----|------------------------|--------|
74+
|run |`void`|`JUnit4Runner`|Initializes JUnit 4 Runner in a new process| - |
75+
|quit |`void`|`void`|Stops JUnit 4 Runner process| - |
76+
|isRunning | `void`|`boolean`|Checks whether JUnit 4 Runner is running| - |
77+
|getTotalTests | `void`|`int`|Gets the total tests from the executed test set | - |
78+
79+
## 🚩 Changelog
80+
Details about each version are documented in the [releases section](https://github.com/williamniemiec/wniemiec-component-java/junit4-runner/releases).
81+
82+
## 🀝 Contribute!
83+
See the documentation on how you can contribute to the project [here](https://github.com/wniemiec-component-java/junit4-runner/blob/master/CONTRIBUTING.md).
84+
85+
## πŸ“ Files
86+
87+
### /
88+
| Name |Type|Description|
89+
|----------------|-------------------------------|-----------------------------|
90+
|dist |`Directory`|Released versions|
91+
|docs |`Directory`|Documentation files|
92+
|src |`Directory`| Source files|
93+
94+
## See more
95+
* [JUnit 4](https://junit.org/junit4/)
96+
* [JUnit](https://junit.org/)

β€Ždist/1.x/junit4-1.0.0.jar

9.62 KB
Binary file not shown.

β€Ždist/1.x/junit4-1.0.1.jar

9.93 KB
Binary file not shown.

β€Ždist/1.x/junit4-1.0.2.jar

9.94 KB
Binary file not shown.

0 commit comments

Comments
Β (0)