Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: TMS-28784: support filters from the testit-cli package. #168

Merged
merged 2 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version=2.4.2
version=2.4.3

org.gradle.daemon=true
org.gradle.parallel=true
Expand Down
29 changes: 29 additions & 0 deletions testit-adapter-cucumber4/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,35 @@ If you want to enable debug mode then see [How to enable debug logging?](https:/

If you want to add attachment for a failed test then see [How to add an attachment for a failed test?](https://github.com/testit-tms/adapters-java/tree/main/testit-java-commons)

#### Run with filter
To create filter by autotests you can use the Test IT CLI (use adapterMode 1 for run with filter):

##### Gradle
```
$ export TMS_TOKEN=<YOUR_TOKEN>
$ testit autotests_filter
--url https://tms.testit.software \
--configuration-id 5236eb3f-7c05-46f9-a609-dc0278896464 \
--testrun-id 6d4ac4b7-dd67-4805-b879-18da0b89d4a8 \
--framework gradle-cucumber \
--output tmp/filter.txt

$ gradle test -DtmsTestRunId=6d4ac4b7-dd67-4805-b879-18da0b89d4a8 -DtmsAdapterMode=1 -Dcucumber.filter.name="$(cat tmp/filter.txt)"
```

##### Maven
```
$ export TMS_TOKEN=<YOUR_TOKEN>
$ testit autotests_filter
--url https://tms.testit.software \
--configuration-id 5236eb3f-7c05-46f9-a609-dc0278896464 \
--testrun-id 6d4ac4b7-dd67-4805-b879-18da0b89d4a8 \
--framework maven-cucumber \
--output tmp/filter.txt

$ maven test -DtmsTestRunId=6d4ac4b7-dd67-4805-b879-18da0b89d4a8 -DtmsAdapterMode=1 -Dcucumber.filter.name="$(cat tmp/filter.txt)"
```

### Tags

Use tags to specify information about autotest.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ private void testStarted(final TestCaseStarted event) {

final String featureName = feature.getName();
final String uuid = getTestCaseUuid(currentTestCase.get());
final String scenarioName = currentTestCase.get().getName();

final TestResult result = new TestResult()
.setUuid(uuid)
Expand All @@ -117,7 +118,8 @@ private void testStarted(final TestCaseStarted event) {
.setClassName(featureName)
.setLabels(tagParser.getScenarioLabels())
.setLinkItems(tagParser.getScenarioLinks())
.setParameters(parameters);
.setParameters(parameters)
.setExternalKey(scenarioName);

final String description = Stream.of(feature.getDescription(), scenarioDefinition.getDescription())
.filter(Objects::nonNull)
Expand Down
29 changes: 29 additions & 0 deletions testit-adapter-cucumber5/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,35 @@ If you want to enable debug mode then see [How to enable debug logging?](https:/

If you want to add attachment for a failed test then see [How to add an attachment for a failed test?](https://github.com/testit-tms/adapters-java/tree/main/testit-java-commons)

#### Run with filter
To create filter by autotests you can use the Test IT CLI (use adapterMode 1 for run with filter):

##### Gradle
```
$ export TMS_TOKEN=<YOUR_TOKEN>
$ testit autotests_filter
--url https://tms.testit.software \
--configuration-id 5236eb3f-7c05-46f9-a609-dc0278896464 \
--testrun-id 6d4ac4b7-dd67-4805-b879-18da0b89d4a8 \
--framework gradle-cucumber \
--output tmp/filter.txt

$ gradle test -DtmsTestRunId=6d4ac4b7-dd67-4805-b879-18da0b89d4a8 -DtmsAdapterMode=1 -Dcucumber.filter.name="$(cat tmp/filter.txt)"
```

##### Maven
```
$ export TMS_TOKEN=<YOUR_TOKEN>
$ testit autotests_filter
--url https://tms.testit.software \
--configuration-id 5236eb3f-7c05-46f9-a609-dc0278896464 \
--testrun-id 6d4ac4b7-dd67-4805-b879-18da0b89d4a8 \
--framework maven-cucumber \
--output tmp/filter.txt

$ maven test -DtmsTestRunId=6d4ac4b7-dd67-4805-b879-18da0b89d4a8 -DtmsAdapterMode=1 -Dcucumber.filter.name="$(cat tmp/filter.txt)"
```

### Tags

Use tags to specify information about autotest.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ private void testStarted(final TestCaseStarted event) {

final String featureName = feature.getName();
final String uuid = getTestCaseUuid(currentTestCase.get());
final String scenarioName = currentTestCase.get().getName();

final TestResult result = new TestResult()
.setUuid(uuid)
Expand All @@ -117,7 +118,8 @@ private void testStarted(final TestCaseStarted event) {
.setClassName(featureName)
.setLabels(tagParser.getScenarioLabels())
.setLinkItems(tagParser.getScenarioLinks())
.setParameters(parameters);
.setParameters(parameters)
.setExternalKey(scenarioName);

final String description = Stream.of(feature.getDescription(), scenarioDefinition.getDescription())
.filter(Objects::nonNull)
Expand Down
29 changes: 29 additions & 0 deletions testit-adapter-cucumber6/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,35 @@ If you want to enable debug mode then see [How to enable debug logging?](https:/

If you want to add attachment for a failed test then see [How to add an attachment for a failed test?](https://github.com/testit-tms/adapters-java/tree/main/testit-java-commons)

#### Run with filter
To create filter by autotests you can use the Test IT CLI (use adapterMode 1 for run with filter):

##### Gradle
```
$ export TMS_TOKEN=<YOUR_TOKEN>
$ testit autotests_filter
--url https://tms.testit.software \
--configuration-id 5236eb3f-7c05-46f9-a609-dc0278896464 \
--testrun-id 6d4ac4b7-dd67-4805-b879-18da0b89d4a8 \
--framework gradle-cucumber \
--output tmp/filter.txt

$ gradle test -DtmsTestRunId=6d4ac4b7-dd67-4805-b879-18da0b89d4a8 -DtmsAdapterMode=1 -Dcucumber.filter.name="$(cat tmp/filter.txt)"
```

##### Maven
```
$ export TMS_TOKEN=<YOUR_TOKEN>
$ testit autotests_filter
--url https://tms.testit.software \
--configuration-id 5236eb3f-7c05-46f9-a609-dc0278896464 \
--testrun-id 6d4ac4b7-dd67-4805-b879-18da0b89d4a8 \
--framework maven-cucumber \
--output tmp/filter.txt

$ maven test -DtmsTestRunId=6d4ac4b7-dd67-4805-b879-18da0b89d4a8 -DtmsAdapterMode=1 -Dcucumber.filter.name="$(cat tmp/filter.txt)"
```

### Tags

Use tags to specify information about autotest.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ private void testStarted(final TestCaseStarted event) {
}

final TagParser tagParser = new TagParser(feature, currentTestCase.get(), tags, parameters);
final String scenarioName = currentTestCase.get().getName();

final TestResult result = new TestResult()
.setUuid(uuid)
Expand All @@ -122,7 +123,8 @@ private void testStarted(final TestCaseStarted event) {
.setClassName(featureName)
.setLabels(tagParser.getScenarioLabels())
.setLinkItems(tagParser.getScenarioLinks())
.setParameters(parameters);
.setParameters(parameters)
.setExternalKey(scenarioName);

final String description = Stream.of(feature.getDescription(), scenarioDefinition.getDescription())
.filter(Objects::nonNull)
Expand Down
29 changes: 29 additions & 0 deletions testit-adapter-cucumber7/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,35 @@ If you want to enable debug mode then see [How to enable debug logging?](https:/

If you want to add attachment for a failed test then see [How to add an attachment for a failed test?](https://github.com/testit-tms/adapters-java/tree/main/testit-java-commons)

#### Run with filter
To create filter by autotests you can use the Test IT CLI (use adapterMode 1 for run with filter):

##### Gradle
```
$ export TMS_TOKEN=<YOUR_TOKEN>
$ testit autotests_filter
--url https://tms.testit.software \
--configuration-id 5236eb3f-7c05-46f9-a609-dc0278896464 \
--testrun-id 6d4ac4b7-dd67-4805-b879-18da0b89d4a8 \
--framework gradle-cucumber \
--output tmp/filter.txt

$ gradle test -DtmsTestRunId=6d4ac4b7-dd67-4805-b879-18da0b89d4a8 -DtmsAdapterMode=1 -Dcucumber.filter.name="$(cat tmp/filter.txt)"
```

##### Maven
```
$ export TMS_TOKEN=<YOUR_TOKEN>
$ testit autotests_filter
--url https://tms.testit.software \
--configuration-id 5236eb3f-7c05-46f9-a609-dc0278896464 \
--testrun-id 6d4ac4b7-dd67-4805-b879-18da0b89d4a8 \
--framework maven-cucumber \
--output tmp/filter.txt

$ maven test -DtmsTestRunId=6d4ac4b7-dd67-4805-b879-18da0b89d4a8 -DtmsAdapterMode=1 -Dcucumber.filter.name="$(cat tmp/filter.txt)"
```

### Tags

Use tags to specify information about autotest.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ private void testStarted(final TestCaseStarted event) {
final TagParser tagParser = new TagParser(feature, currentTestCase.get(), tags, parameters);

final String uuid = getTestCaseUuid(currentTestCase.get());
final String scenarioName = currentTestCase.get().getName();

final TestResult result = new TestResult()
.setUuid(uuid)
Expand All @@ -120,7 +121,8 @@ private void testStarted(final TestCaseStarted event) {
.setClassName(tagParser.getClassName())
.setLabels(tagParser.getScenarioLabels())
.setLinkItems(tagParser.getScenarioLinks())
.setParameters(parameters);
.setParameters(parameters)
.setExternalKey(scenarioName);

final String description = Stream.of(feature.getDescription(), scenarioDefinition.getDescription())
.filter(Objects::nonNull)
Expand Down
29 changes: 29 additions & 0 deletions testit-adapter-junit4/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,35 @@ see [How to enable debug logging?](https://github.com/testit-tms/adapters-java/t
If you want to add attachment for a failed test then
see [How to add an attachment for a failed test?](https://github.com/testit-tms/adapters-java/tree/main/testit-java-commons)

#### Run with filter
To create filter by autotests you can use the Test IT CLI (use adapterMode 1 for run with filter):

##### Gradle
```
$ export TMS_TOKEN=<YOUR_TOKEN>
$ testit autotests_filter
--url https://tms.testit.software \
--configuration-id 5236eb3f-7c05-46f9-a609-dc0278896464 \
--testrun-id 6d4ac4b7-dd67-4805-b879-18da0b89d4a8 \
--framework gradle-junit4 \
--output tmp/filter.txt

$ gradle test -DtmsTestRunId=6d4ac4b7-dd67-4805-b879-18da0b89d4a8 -DtmsAdapterMode=1 $(cat tmp/filter.txt)
```

##### Maven
```
$ export TMS_TOKEN=<YOUR_TOKEN>
$ testit autotests_filter
--url https://tms.testit.software \
--configuration-id 5236eb3f-7c05-46f9-a609-dc0278896464 \
--testrun-id 6d4ac4b7-dd67-4805-b879-18da0b89d4a8 \
--framework maven-junit4 \
--output tmp/filter.txt

$ maven test -DtmsTestRunId=6d4ac4b7-dd67-4805-b879-18da0b89d4a8 -DtmsAdapterMode=1 $(cat tmp/filter.txt)
```

### Annotations

Use annotations to specify information about autotest.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ public void testFinished(final Description description) {
protected void startTestCase(Description method, final String uuid) {
String fullName = method.getClassName();
int index = fullName.lastIndexOf(".");
String testNode = fullName + "." + method.getMethodName();

final TestResult result = new TestResult()
.setUuid(uuid)
Expand All @@ -119,7 +120,8 @@ protected void startTestCase(Description method, final String uuid) {
.setClassName(Utils.extractClassname(method, (index != -1) ? fullName.substring(index + 1) : fullName))
.setSpaceName(Utils.extractNamespace(method, (index != -1) ? fullName.substring(0, index) : null))
.setLinkItems(Utils.extractLinks(method))
.setDescription(Utils.extractDescription(method));
.setDescription(Utils.extractDescription(method))
.setExternalKey(testNode);

adapterManager.scheduleTestCase(result);
adapterManager.startTestCase(uuid);
Expand Down
29 changes: 29 additions & 0 deletions testit-adapter-junit5/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,35 @@ see [How to enable debug logging?](https://github.com/testit-tms/adapters-java/t
If you want to add attachment for a failed test then
see [How to add an attachment for a failed test?](https://github.com/testit-tms/adapters-java/tree/main/testit-java-commons)

#### Run with filter
To create filter by autotests you can use the Test IT CLI (use adapterMode 1 for run with filter):

##### Gradle
```
$ export TMS_TOKEN=<YOUR_TOKEN>
$ testit autotests_filter
--url https://tms.testit.software \
--configuration-id 5236eb3f-7c05-46f9-a609-dc0278896464 \
--testrun-id 6d4ac4b7-dd67-4805-b879-18da0b89d4a8 \
--framework gradle-junit5 \
--output tmp/filter.txt

$ gradle test -DtmsTestRunId=6d4ac4b7-dd67-4805-b879-18da0b89d4a8 -DtmsAdapterMode=1 $(cat tmp/filter.txt)
```

##### Maven
```
$ export TMS_TOKEN=<YOUR_TOKEN>
$ testit autotests_filter
--url https://tms.testit.software \
--configuration-id 5236eb3f-7c05-46f9-a609-dc0278896464 \
--testrun-id 6d4ac4b7-dd67-4805-b879-18da0b89d4a8 \
--framework maven-junit5 \
--output tmp/filter.txt

$ maven test -DtmsTestRunId=6d4ac4b7-dd67-4805-b879-18da0b89d4a8 -DtmsAdapterMode=1 $(cat tmp/filter.txt)
```

### Annotations

Use annotations to specify information about autotest.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,8 @@ public void interceptTestMethod(
}

protected void startTestCase(Method method, final String uuid, Map<String, String> parameters) {
String testNode = method.getDeclaringClass().getCanonicalName() + "." + method.getName();

final TestResult result = new TestResult()
.setUuid(uuid)
.setLabels(Utils.extractLabels(method, parameters))
Expand All @@ -233,7 +235,8 @@ protected void startTestCase(Method method, final String uuid, Map<String, Strin
)
.setLinkItems(Utils.extractLinks(method, parameters))
.setDescription(Utils.extractDescription(method, parameters))
.setParameters(parameters);
.setParameters(parameters)
.setExternalKey(testNode);

adapterManager.scheduleTestCase(result);
adapterManager.startTestCase(uuid);
Expand Down
29 changes: 29 additions & 0 deletions testit-adapter-testng/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,35 @@ see [How to enable debug logging?](https://github.com/testit-tms/adapters-java/t
If you want to add attachment for a failed test then
see [How to add an attachment for a failed test?](https://github.com/testit-tms/adapters-java/tree/main/testit-java-commons)

#### Run with filter
To create filter by autotests you can use the Test IT CLI (use adapterMode 1 for run with filter):

##### Gradle
```
$ export TMS_TOKEN=<YOUR_TOKEN>
$ testit autotests_filter
--url https://tms.testit.software \
--configuration-id 5236eb3f-7c05-46f9-a609-dc0278896464 \
--testrun-id 6d4ac4b7-dd67-4805-b879-18da0b89d4a8 \
--framework gradle-testng \
--output tmp/filter.txt

$ gradle test -DtmsTestRunId=6d4ac4b7-dd67-4805-b879-18da0b89d4a8 -DtmsAdapterMode=1 $(cat tmp/filter.txt)
```

##### Maven
```
$ export TMS_TOKEN=<YOUR_TOKEN>
$ testit autotests_filter
--url https://tms.testit.software \
--configuration-id 5236eb3f-7c05-46f9-a609-dc0278896464 \
--testrun-id 6d4ac4b7-dd67-4805-b879-18da0b89d4a8 \
--framework maven-testng \
--output tmp/filter.txt

$ maven test -DtmsTestRunId=6d4ac4b7-dd67-4805-b879-18da0b89d4a8 -DtmsAdapterMode=1 $(cat tmp/filter.txt)
```

### Annotations

Use annotations to specify information about autotest.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ public void onTestStart(final ITestResult testResult) {
protected void startTestCase(final ITestResult testResult,
final String uuid) {
Map<String, String> parameters = getParameters(testResult);
String testNode = testResult.getInstanceName() + "." + testResult.getName();

Method method = testResult.getMethod().getConstructorOrMethod().getMethod();
final TestResult result = new TestResult()
Expand All @@ -118,7 +119,8 @@ protected void startTestCase(final ITestResult testResult,
parameters))
.setLinkItems(Utils.extractLinks(method, parameters))
.setDescription(Utils.extractDescription(method, parameters))
.setParameters(parameters);
.setParameters(parameters)
.setExternalKey(testNode);

adapterManager.scheduleTestCase(result);
adapterManager.startTestCase(uuid);
Expand Down
Loading
Loading