All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.qameta.allure.aspects.Allure1Annotations Maven / Gradle / Ivy

/*
 *  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.aspects;

import io.qameta.allure.model.Label;
import io.qameta.allure.model.Link;
import io.qameta.allure.model.Parameter;
import io.qameta.allure.model.TestResult;
import org.aspectj.lang.reflect.MethodSignature;
import ru.yandex.qatools.allure.annotations.Description;
import ru.yandex.qatools.allure.annotations.Features;
import ru.yandex.qatools.allure.annotations.Issue;
import ru.yandex.qatools.allure.annotations.Issues;
import ru.yandex.qatools.allure.annotations.Severity;
import ru.yandex.qatools.allure.annotations.Stories;
import ru.yandex.qatools.allure.annotations.TestCaseId;
import ru.yandex.qatools.allure.annotations.Title;
import ru.yandex.qatools.allure.model.DescriptionType;

import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

import static io.qameta.allure.util.ResultsUtils.createParameter;

/**
 * Allure labels utils.
 */
final class Allure1Annotations {

    private static final String SUITE_LABEL = "suite";

    private final MethodSignature signature;

    private final Object[] args;

    Allure1Annotations(final MethodSignature signature, final Object... args) {
        this.args = Arrays.copyOf(args, args.length);
        this.signature = signature;
    }

    public void updateTitle(final TestResult result) {
        final Method method = getMethod();
        if (method.isAnnotationPresent(Title.class)) {
            final Title title = method.getAnnotation(Title.class);
            result.setName(title.value());
        }
        final Class type = getType();
        if (type.isAnnotationPresent(Title.class)) {
            final Title title = type.getAnnotation(Title.class);
            final List




© 2015 - 2025 Weber Informatics LLC | Privacy Policy