forked from allure-framework/allure-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix for allure-framework#893 - param annotation name not coming up in…
… report
- Loading branch information
1 parent
3d361dd
commit 603bd6f
Showing
6 changed files
with
107 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
allure-testng/src/test/java/io/qameta/allure/testng/samples/CustomParameterNamesTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* Copyright 2016-2024 Qameta Software Inc | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package io.qameta.allure.testng.samples; | ||
|
||
import io.qameta.allure.Param; | ||
import org.testng.annotations.DataProvider; | ||
import org.testng.annotations.Test; | ||
|
||
import static io.qameta.allure.Allure.step; | ||
|
||
/** | ||
* @author Sambhav Dave [email protected] | ||
*/ | ||
public class CustomParameterNamesTest { | ||
|
||
@DataProvider | ||
public static Object[][] testDataForParamNames() { | ||
return new Object[][]{ | ||
{1, 1, 2, 5} | ||
}; | ||
} | ||
|
||
@Test(dataProvider = "testDataForParamNames") | ||
public void sumTest( | ||
@Param(name = "First") Integer a, | ||
@Param(name = "Second") Integer b, | ||
@Param(name = "Third") Integer expectedSum, | ||
@Param(name = "Fourth") Integer unusedParam) { | ||
|
||
step("Arrange", () -> step(String.format("Use parameters: First = [%s], Second = [%s], Third = [%s], Fourth = [%s]", | ||
a, b, expectedSum, unusedParam))); | ||
|
||
Integer result = step("Act", () -> { | ||
step(String.format("Add First [%s] and Second [%s]", a, b)); | ||
return a + b; | ||
}); | ||
|
||
step("Assert", () -> { | ||
step(String.format("Compare result [%s] with expected [%s]", result, expectedSum)); | ||
assert result.equals(expectedSum) : "Sum does not match the expected value"; | ||
}); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,11 +15,12 @@ | |
*/ | ||
package io.qameta.allure.testng.samples; | ||
|
||
import io.qameta.allure.Step; | ||
import org.testng.annotations.BeforeMethod; | ||
import org.testng.annotations.DataProvider; | ||
import org.testng.annotations.Test; | ||
|
||
import static io.qameta.allure.Allure.step; | ||
|
||
/** | ||
* @author Egor Borisov [email protected] | ||
*/ | ||
|
@@ -42,9 +43,4 @@ public Object[][] testData() { | |
public void parameterizedTest(String param) { | ||
step(param); | ||
} | ||
|
||
@Step | ||
public void step(String param) { | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" > | ||
|
||
<suite name="Github Issues"> | ||
<test name="gh-893"> | ||
<classes> | ||
<class name="io.qameta.allure.testng.samples.CustomParameterNamesTest"/> | ||
</classes> | ||
</test> | ||
</suite> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters