-
-
Notifications
You must be signed in to change notification settings - Fork 83
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
Add ability import automated tests to zephyr #2319
Open
TatianaTochko
wants to merge
4
commits into
vividus-framework:master
Choose a base branch
from
TatianaTochko:add-ability-import-to-zephyr
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
6419dc1
[vividus-to-zephyr-exporter] Add ability import automated tests to ze…
TatianaTochko 6fd3666
Add story scenario export execution
dzmitryasonau c36759b
Add export execution fixes
dzmitryasonau 92d82b5
Updated zephyr exporter via comments
TatianaTochko File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
|
@@ -4,6 +4,8 @@ Zephyr Exporter is a tool used for exporting test execution results into Jira Ze | |
|
||
Features: | ||
|
||
* Create test cases | ||
* Update test cases | ||
* Create test executions | ||
* Set test execution statuses | ||
|
||
|
@@ -18,19 +20,35 @@ include::partial$jira-configuration.adoc[] | |
|Required | ||
|Description | ||
|
||
|`zephyr.exporter.jira-instance-key` | ||
|`zephyr-exporter.export-results` | ||
|true | ||
|Property regulates if test entity export is needed | ||
|
||
|`zephyr-exporter.test-entity` | ||
|false | ||
|Test entity export level. STORY or SCENARIO level | ||
|
||
|`zephyr-exporter.jira-instance-key` | ||
|false | ||
|The key of the configured JIRA instance, in case of missing value it will be evaluated automatically based on issue keys being exported | ||
|
||
|`zephyr.exporter.source-directory` | ||
|`zephyr-exporter.source-directory` | ||
|true | ||
|Path to directory with test execution JSON results. | ||
|Path to directory with test execution JSON results and test entity. | ||
|
||
|`zephyr.exporter.update-execution-statuses-only` | ||
|`zephyr-exporter.update-execution-statuses-only` | ||
|false | ||
|Property for update existing executions statuses only. | ||
|
||
|`zephyr.exporter.statuses-of-test-cases-to-add-to-execution` | ||
|`zephyr-exporter.update-test-cases` | ||
|false | ||
|Property to update existing test cases. User with update status permissions required in order to work. | ||
|
||
|`zephyr-exporter.status-for-updated-test-cases` | ||
|false | ||
|Property defines status which will be set for all updated tests ("Backlog" by default). | ||
|
||
|`zephyr-exporter.statuses-of-test-cases-to-add-to-execution` | ||
|false | ||
|List of test case statuses for adding to execution. | ||
|
||
|
@@ -52,6 +70,26 @@ include::partial$jira-configuration.adoc[] | |
|
||
|=== | ||
|
||
== Jira Fields Mapping | ||
|
||
The Zephyr is a Jira plugin that uses custom Jira fields for it's data, one of the ways to find out custom field names for particular field used by Zephyr on Jira UI (if access to Jira configuration is prohibited) is to request description of some issue. | ||
|
||
=== Test Case Properties | ||
|
||
image::zephyr.png[] | ||
[cols="1,2", options="header"] | ||
|=== | ||
|
||
|Property | ||
|Description | ||
|
||
|`jira.<jira-instance-key>.fields-mapping.story-type` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not clear |
||
|Key of a custom field which contains story type (Task) | ||
|
||
|=== | ||
|
||
include::partial$authentication.adoc[] | ||
|
||
== Zephyr Execution Status Mapping | ||
|
||
The Zephyr plugin for Jira has own configurable execution statuses. testExecutionStatus endpoint is used to get the detailed information about the statuses, like: https://jira.example.com/rest/zapi/latest/util/testExecutionStatus. The following properties are used to setup a mapping between Vividus and Zephyr execution statuses. | ||
|
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
100 changes: 100 additions & 0 deletions
100
vividus-engine/src/main/java/org/vividus/model/jbehave/HasMeta.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,100 @@ | ||
/* | ||
* Copyright 2019-2022 the original author or authors. | ||
* | ||
* 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 org.vividus.model.jbehave; | ||
|
||
import java.util.Collection; | ||
import java.util.LinkedHashSet; | ||
import java.util.List; | ||
import java.util.Optional; | ||
import java.util.Set; | ||
import java.util.stream.Collectors; | ||
import java.util.stream.Stream; | ||
|
||
import org.apache.commons.lang3.StringUtils; | ||
|
||
public interface HasMeta | ||
{ | ||
char META_VALUES_SEPARATOR = ';'; | ||
|
||
List<Meta> getMeta(); | ||
|
||
/** | ||
* Get unique <b>meta</b> value | ||
* | ||
* <p>If the <b>meta</b> does not exist or has no value, an empty {@link Optional} will be returned | ||
* | ||
* <p><i>Notes</i> | ||
* <ul> | ||
* <li><b>meta</b> value is trimmed upon returning</li> | ||
* <li><i>;</i> char is used as a separator for <b>meta</b> with multiple values</li> | ||
* </ul> | ||
* | ||
* @param metaName the meta name | ||
* @return the meta value | ||
* @throws NotUniqueMetaValueException if the <b>meta</b> has more than one value | ||
*/ | ||
default Optional<String> getUniqueMetaValue(String metaName) throws NotUniqueMetaValueException | ||
{ | ||
Set<String> values = getMetaValues(metaName); | ||
if (values.size() > 1) | ||
{ | ||
throw new NotUniqueMetaValueException(metaName, values); | ||
} | ||
return values.isEmpty() ? Optional.empty() : Optional.of(values.iterator().next()); | ||
} | ||
|
||
/** | ||
* Get all <b>meta</b> values | ||
* | ||
* <p><i>Notes</i> | ||
* <ul> | ||
* <li><b>meta</b>s without value are ignored</li> | ||
* <li><b>meta</b> values are trimmed upon returning</li> | ||
* <li><i>;</i> char is used as a separator for <b>meta</b> with multiple values</li> | ||
* </ul> | ||
* | ||
* @param metaName the meta name | ||
* @return the meta values | ||
*/ | ||
default Set<String> getMetaValues(String metaName) | ||
{ | ||
return getMetaStream().filter(m -> metaName.equals(m.getName())) | ||
.map(Meta::getValue) | ||
.filter(StringUtils::isNotEmpty) | ||
.map(String::trim) | ||
.map(value -> StringUtils.splitPreserveAllTokens(value, META_VALUES_SEPARATOR)) | ||
.flatMap(Stream::of) | ||
.map(String::trim) | ||
.collect(Collectors.toCollection(LinkedHashSet::new)); | ||
} | ||
|
||
/** | ||
* Determine if scenario has <b>meta</b> with the name | ||
* | ||
* @param metaName the meta name | ||
* @return {@code true} if scenario has meta with the name | ||
*/ | ||
default boolean hasMetaWithName(String metaName) | ||
{ | ||
return getMetaStream().anyMatch(m -> metaName.equals(m.getName())); | ||
} | ||
|
||
private Stream<Meta> getMetaStream() | ||
{ | ||
return Optional.ofNullable(getMeta()).stream().flatMap(Collection::stream); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -1,5 +1,5 @@ | ||||||||||||||||||
/* | ||||||||||||||||||
* Copyright 2019-2021 the original author or authors. | ||||||||||||||||||
* Copyright 2019-2022 the original author or authors. | ||||||||||||||||||
* | ||||||||||||||||||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||||||||||||||||||
* you may not use this file except in compliance with the License. | ||||||||||||||||||
|
@@ -24,11 +24,12 @@ | |||||||||||||||||
import com.google.common.collect.Iterables; | ||||||||||||||||||
import com.google.common.collect.Lists; | ||||||||||||||||||
|
||||||||||||||||||
public class Story | ||||||||||||||||||
public class Story implements HasMeta | ||||||||||||||||||
{ | ||||||||||||||||||
private String path; | ||||||||||||||||||
private Lifecycle lifecycle; | ||||||||||||||||||
private List<Scenario> scenarios; | ||||||||||||||||||
private List<Meta> meta; | ||||||||||||||||||
Comment on lines
29
to
+32
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||
|
||||||||||||||||||
public String getPath() | ||||||||||||||||||
{ | ||||||||||||||||||
|
@@ -60,6 +61,17 @@ public void setScenarios(List<Scenario> scenarios) | |||||||||||||||||
this.scenarios = scenarios; | ||||||||||||||||||
} | ||||||||||||||||||
|
||||||||||||||||||
@Override | ||||||||||||||||||
public List<Meta> getMeta() | ||||||||||||||||||
{ | ||||||||||||||||||
return meta; | ||||||||||||||||||
} | ||||||||||||||||||
|
||||||||||||||||||
public void setMeta(List<Meta> meta) | ||||||||||||||||||
{ | ||||||||||||||||||
this.meta = meta; | ||||||||||||||||||
} | ||||||||||||||||||
|
||||||||||||||||||
/** | ||||||||||||||||||
* Get unique scenarios. | ||||||||||||||||||
* | ||||||||||||||||||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please provide more details what will be updated