Cooking the AllureID

Modified on Fri, 28 Apr, 2023 at 8:10 AM

AllureID is the unique identifier of your test in Allure TestOps' database.

This article's intent is to describe why the parameter is important, and how to manage it to avoid troubles.


Problem

Since Allure TestOps uses the database, we need to be sure that a test result we received, is related to a certain test case, moreover, in future we need to link the test result to the same test case.


Inputs

Some test frameworks have and some test frameworks haven't the mechanics to generate a parameter that could uniquely identify a test among the others. If a test framework has this capability, the Allure Report integration uses this parameter and uses it as testCaseId, otherwise the Allure Report integration autonomously generates the testCaseId based on the full signature of the test methods and list of its parameters, something like that: 

testCaseId = md5(fullName, sort(names(parameters))

fullName is the full test method signature, it can contain package name, folder name, class name, file name, method name – not all of them together for it depends on the programming language and test framework used.

When test result is being processed on Allure TestOps side there are two alternative scenarios:

- there is no link between AllureID and testCaseId

- there is existing link between AllureID and testCaseId


No link

If there is no link between AllureID and testCaseId, Allure TestOps creates a new AllureID, i.e. new test case is created, and links AllureID with the testCaseId, and links received test result to AllureID via testCaseId.

Link exists

If the link between AllureID and testCaseId exists, Allure TestOps links received test result to AllureID via testCaseId, so the test case gets another record in the execution history

Implications

Just for recap, the testCaseId is calculated like this:


testCaseId = md5(fullName, sort(names(parameters))

This means the following.

- if the fullName changes, then md5 checksum changes, then testCaseId changes

- if the name of a parameter changes, then md5 checksum changes, then testCaseId changes

- if the number of parameters changes, then md5 checksum changes, then testCaseId changes

and this is very important

When testCaseId changes, the link between your test result and existing AllureID breaks and Allure TestOps creates a new test case. The previous test case with old AllureID gets abandoned.


How to avoid the abandoning of the test cases

If your aim is to continue linking the test results of the updated test (you updated some parameters altering the full method's signature) to the same test case (same AllureID), then you need to make this explicit for Allure TestOps. 

To provide the explicit link between your automated test and the test case created on Allure TestOps side, you need to provide AllureID as a part of test's meta-data.

If Allure TestOps discovers AllureID in a test result, it ignores all the information related to testCaseId and links the test result to a particular test case.

Currently, all the integration with Allure Report allow providing this information to the test results.


Examples

Java (JUnit, TestNG)

public class AuthenticationTests {
    @Test
    @AllureId("111")
    public void successfulAuthUserPassword() {
            step("Do stuff", ()->{
            });
        }
}

JavaScript

test("Authenticated user must be able to create a support request with type Issue", async () => {
    allure.tags("web", "critical", "regress");
    allure.id("111");
    attachMicroservice("Support");
    await createNewEntity("issue");
    await authorize();
  });

python, pytest

 def test_should_delete_user_note(owner, repo, title):
    allure.id("111")
    steps.create_issue_with_title(owner, repo, title)
    steps.close_issue_with_title(owner, repo, title)

Management of the AllureID

  • AllureID is assigned by Allure TestOps as first available ID. 
  • You cannot use in your code an AllureID which does not exist yet. This will make your test result Orphaned and it'll prevent test case creation.
  • AllureID is linked to a Project in Allure TestOps, i.e. if you will provide an AllureID from a different project, then in the current project you will see the test results, but test case won't be updated and won't be displayed in the current project.


Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons

Feedback sent

We appreciate your effort and will try to fix the article