AndrewSynkov
AndrewSynkov

Reputation: 93

How to add @AllureId annotation to tests in source code using cli?

Our application is spring boot based project written with kotlin. There is great plugin for JetBrains IntelliJ IDEA for Allure support. The plugin provide a possibility to generate test reports, upload them to Allure TestOps and link tests from source code to test launch (tree of all tests) in Allure TestOps. Linking is achieved through adding @AllureId annotation to tests in source code.

My goal is automate this process inside build pipelines. Allure has allurectl tool which allows to upload test reports to Allure TestOps. But as far as I concerned it doesn't have a feature to assign @AllureId annotations.

Is there any option to assign @AllureId to tests from source code using command line?

Upvotes: 0

Views: 1784

Answers (3)

Cheshi Mantu
Cheshi Mantu

Reputation: 41

Important thing is the AllureID must exist in Allure TestOps. The link between your code and test case created in Allure TestOps is method's full signature displayed on your test case panel in Allure TestOps. The standard designed workflow is described here: https://docs.qameta.io/allure-testops/ecosystem/ide-plugins/#link-tests-in-ide-to-tests-cases-in-allure-testops-via-allureid Generally, you need to assign AllureID either when you create a new test in Jetbrains' IDE (made automatically) or if you are altering something in the existing test (name of the package, class name, method's name)/.

Upvotes: 0

Danila Polevshchikov
Danila Polevshchikov

Reputation: 2278

I've find out that adding a label's node with name "as_id" to generated json report works as a way to set allureId. Tested with upload to Allure TestOps, it works.

Some details are here and in related PR:https://github.com/Tinkoff/Allure.XUnit/issues/25

Upvotes: 0

Ruslan Akhmetzianov
Ruslan Akhmetzianov

Reputation: 11

You are generally right - allurectl does not have this feature. It is supported in the Allure IDEA plugin only.

The reason is that automated test-case linking feature in the plugin is implemented via the IntelliJ engine, so we'd have to write our own engine for the allurectl to make it work.

Upvotes: 1

Related Questions