https://github.com/smartbear/zephyr-scale-junit-integration
https://github.com/smartbear/zephyr-scale-junit-integration
open-source zephyr-scale
Last synced: over 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/smartbear/zephyr-scale-junit-integration
- Owner: SmartBear
- License: other
- Created: 2021-09-21T20:10:01.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2024-11-05T08:41:43.000Z (over 1 year ago)
- Last Synced: 2025-03-23T07:12:07.425Z (over 1 year ago)
- Topics: open-source, zephyr-scale
- Language: Java
- Homepage:
- Size: 45.9 KB
- Stars: 3
- Watchers: 14
- Forks: 4
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
[  ](https://bintray.com/avst/TM4J/tm4j-junit-integration/_latestVersion)
# Zephyr Scale Junit Integration
This project is a Zephyr Scale JUnit Integration which aims to generate a file describing the test execution result for each Test Case.
In order to achieve that, you need to annotate the JUnit methods with `@TestCase(key = "JQA-T2")` or `@TestCase(name = "")`.
JUnit methods which are not annotated with `@TestCase` will also be added to the JSON file, but without the Test Case Key property.
JUnit methods which are not annotated with `@TestCase(name = "")` will also be added to the JSON file, but without the Test Case Name property.
## Usage
You can have a look at this [Zephyr Scale JUnit Integration Example](https://github.com/SmartBear/zephyr-scale-junit-integration-example) repository.
You need to add the dependency to your pom file.
```
com.smartbear
zephyrscale-junit-integration
2.0.0
test
```
Also, you'll need to register the Zephyr Scale JUnit Listener.
```
org.apache.maven.plugins
maven-surefire-plugin
2.22.0
listener
com.smartbear.zephyrscale.junit.ExecutionListener
```
The next step is to annotate your JUnit tests with `@TestCase` or don't annotate at all, if the Test Case doesn't exist yet.
```
public class CalculatorSumTest {
@Test
@TestCase(key = "JQA-T1")
public void sumTwoNumbersAndPass() {
Calculator calculator = new Calculator();
assertEquals(1, calculator.sum(1, 2));
}
@Test
@TestCase(key = "JQA-T2")
public void sumTwoNumbersAndFail() {
Calculator calculator = new Calculator();
assertNotEquals(2, calculator.sum(1, 2));
}
@Test
public void notMappedToTestCaseAndPass() {
Calculator calculator = new Calculator();
assertEquals(1, calculator.sum(1, 2));
}
@Test
@TestCase(name = "Mapped to Test Case Name and Pass")
public void mappedToTestCaseNameAndPass() {
Calculator calculator = new Calculator();
assertEquals(1, calculator.sum(1, 2));
}
}
```
Now, you can run your tests with `mvn test` and the Zephyr Scale test execution result file will be generated in the same execution folder.
### zephyrscale_result.json
```
{
"version": 1,
"executions":[
{
"source":"CalculatorSumTest.sumTwoNumbersAndPass",
"result":"Passed",
"testCase": {
"key": "JQA-T1"
}
},
{
"source":"CalculatorSumTest.sumTwoNumbersAndFail",
"result":"Failed",
"testCase": {
"key": "JQA-T2"
}
},
{
"source":"CalculatorSumTest.notMappedToTestCaseAndPass",
"result":"Passed"
},
{
"source":"CalculatorSumTest.mappedToTestCaseNameAndPass",
"result":"Passed",
"testCase": {
"name": "Mapped to Test Case Name and Pass"
}
}
]
}
```
## Support
For any issues or enquiries please get in touch with the Zephyr Scale team at SmartBear using the [support portal](https://support.smartbear.com/zephyr-scale/).