Skip to content

Commit

Permalink
User documentation for TestNG contributors
Browse files Browse the repository at this point in the history
Closes #2597

Following was done:

1. Added the “idea” plugin
2. Created module specific build files for ease
of working in a multi module project.
3. Added some basic user facing documentation into
“CONTRIBUTING.md”
  • Loading branch information
krmahadevan committed Aug 23, 2021
1 parent e9427d0 commit 3556509
Show file tree
Hide file tree
Showing 18 changed files with 61 additions and 2 deletions.
50 changes: 50 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Need help?
Before opening a new issue, did you ask your question on

* [Google group](https://groups.google.com/group/testng-users)
* [StackOverflow](https://stackoverflow.com/questions/tagged/testng)

Expand All @@ -9,6 +10,7 @@ If you posted on both sites, please provide the link to the other question to av
Before posting the issue, try to reproduce the issue in [a shell window](https://testng.org/doc/documentation-main.html#running-testng).

If the problem does not exist with the shell, first check if the issue exists on the bugtracker of the runner, and open an issue there first:

* Eclipse: https://github.com/cbeust/testng-eclipse/issues
* IntelliJ: [https://youtrack.jetbrains.com/issues](https://youtrack.jetbrains.com/issues?q=%23%7BUnit%20Testing.%20TestNG%7D%20)
* Maven: https://issues.apache.org/jira/browse/SUREFIRE
Expand All @@ -18,6 +20,7 @@ If the problem does not exist with the shell, first check if the issue exists on
Always make sure your issue is happening on the latest TestNG version. Bug reports occurring on older versions will not be looked at quickly.

# Have you considered sending a pull request instead of filing an issue?

The best way to report a bug is to provide the TestNG team with a full test case reproducing the issue.
Maybe you can write a runnable test case (check the `src/test/` folder for examples) and propose it in a pull request
Don't worry if the CI fails because it is the expected behavior.
Expand All @@ -30,3 +33,50 @@ This pull request will be a perfect start to find the fix :)

If your pull request involves fixing SonarQube issues then we would suggest that you please discuss this with the
[TestNG-dev](https://groups.google.com/forum/#!forum/testng-dev) before you spend time working on it.

# Working with the codebase

### List all tasks

After cloning the project, run `./gradlew tasks` to list out all the tasks that are available.

### Importing into IntelliJ

To import the TestNG project into IntelliJ run `./gradlew openIdea`

### Running all tests

To run all the test cases (build the code) run `./gradlew test`

### Running tests that belong to a specific module

* First list the sub-modules that are available in the TestNG codebase by running `./gradlew projects`
* Now you can run tests that belong to any specific module by running `./gradlew :<moduleNameGoesHere>:test`. For e.g., to run tests under the sub-module **testng-asserts** run the command : `./gradlew :testng-asserts:test`

The codebase makes use of [autostyle](https://github.com/autostyle/autostyle) to enforce code formatting and also fixing code formatting.

To check if there are any code formatting/styling issues (Its best to run this before every pull request), run `./gradlew autostyleCheck`

To automatically fix any styling issues run `./gradlew autostyleApply`

**Tip:**

In order to automatically have the formatting applied as and when you commit code, you can do the following:

1. Create a new file under `.git/hooks/pre-commit`
2. Now add the below contents to this file and save it.

```
# run the auto style applying on the code
./gradlew autostyleApply
# store the last exit code in a variable
RESULT=$?
# return the './gradlew autostyleApply' exit code
exit $RESULT
```

This will cause git to trigger the code styling automatically right before commiting your changes locally.

After that you can quickly check if there were any formatting that was applied using `git status`
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
### Actual behavior


### Is the issue reproductible on runner?
### Is the issue reproducible on runner?

- [ ] Shell
- [ ] Maven
Expand All @@ -19,4 +19,4 @@


### Test case sample
> Please, share the test case (as small as possible) which shows the issue
> Please, share the test case (as small as possible) which shows the issue
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
.classpath
.gradle
.idea
*.ipr
*.iws
*.iml
.project
.settings
Expand Down
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
id("testng.repositories")
id("com.github.vlsi.stage-vote-release")
id("idea")
}

val String.v: String get() = rootProject.extra["$this.version"] as String
Expand Down
6 changes: 6 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,9 @@ include(":testng-test-osgi")

enableFeaturePreview("VERSION_CATALOGS")
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")

for (project in rootProject.children) {
project.apply {
buildFileName = "${project.name}-build.gradle.kts"
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 3556509

Please sign in to comment.