Skip to content

Commit

Permalink
Add metadata annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
HardNorth committed Feb 13, 2024
1 parent 131f010 commit 25a1ba9
Show file tree
Hide file tree
Showing 5 changed files with 155 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
## [5.2.5]
### Added
- `Utils.copyFiles` static method to use in examples, by @HardNorth
- `Description` annotation, by @HardNorth
- `DisplayName` annotation, by @HardNorth
- `TmsLink` annotation, by @HardNorth
- `TmsLinks` annotation, by @HardNorth

## [5.2.4]
### Changed
Expand Down
38 changes: 38 additions & 0 deletions src/main/java/com/epam/reportportal/annotations/Description.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Copyright 2024 EPAM Systems
*
* 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
*
* https://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 com.epam.reportportal.annotations;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
* If put on a method or constructor, or class, overrides or set corresponding Test Item description on ReportPortal.
* This annotation should be handled in priority to other mechanisms of existing test frameworks.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.METHOD, ElementType.CONSTRUCTOR, ElementType.TYPE })
public @interface Description {

/**
* Test Item description as a simple String.
*
* @return new description for a Test Item
*/
String value();
}
38 changes: 38 additions & 0 deletions src/main/java/com/epam/reportportal/annotations/DisplayName.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Copyright 2024 EPAM Systems
*
* 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
*
* https://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 com.epam.reportportal.annotations;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
* If put on a method or constructor, or class, overrides corresponding Test Item name on ReportPortal.
* This annotation should be handled in priority to other mechanisms of existing test frameworks.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.METHOD, ElementType.CONSTRUCTOR, ElementType.TYPE })
public @interface DisplayName {

/**
* Test Item name as a simple String.
*
* @return new name for a Test Item
*/
String value();
}
45 changes: 45 additions & 0 deletions src/main/java/com/epam/reportportal/annotations/TmsLink.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Copyright 2024 EPAM Systems
*
* 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
*
* https://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 com.epam.reportportal.annotations;

/**
* Add a link to a Test Case located in external Test Management System.
* This annotation appends a hypertext link to a Test Case into the Test Item description.
*/
public @interface TmsLink {

/**
* TMS ticket ID.
*
* @return ID as string
*/
String value();

/**
* Link text pattern, accepts 'tms_id' parameter.
*
* @return formatted link text
*/
String linkTextPattern() default "TMS #{tms_id}";

/**
* Link URL pattern, accepts 'tms_id' parameter.
*
* @return link to a TMS ticket
*/
String urlPattern() default "";
}
30 changes: 30 additions & 0 deletions src/main/java/com/epam/reportportal/annotations/TmsLinks.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Copyright 2024 EPAM Systems
*
* 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
*
* https://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 com.epam.reportportal.annotations;

import java.lang.annotation.*;

/**
* Gathering annotation for {@link TmsLink}/
*/
@Documented
@Inherited
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.METHOD, ElementType.CONSTRUCTOR, ElementType.TYPE })
public @interface TmsLinks {
TmsLink[] value();
}

0 comments on commit 25a1ba9

Please sign in to comment.