Skip to content

Test case ID

Dmitriy Gumeniuk edited this page Nov 29, 2019 · 11 revisions

Test case ID

Test case ID is a parameter that uniquely defines a test in the Report Portal. In java client it is implemented using @TestCaseId annotation.

  @Test
  @TestCaseID("1223")
  public void myTest(){
     ...
  }

It contains value and parametrized fields.

  @TestCaseId(parameterized = true)
  public void I_wait(int hours) {
     belly.wait(hours);	
  }
  
  @TestCaseId(value = "EPMRPP333") #or
  @TestCaseId("10.15.23.9")
  public void my_belly_should_growl() {
      assertTrue(belly.growl());
  }

Field value of type String allows to explicitly provide Test case ID for a test method/case.

Field parametrized (value of type boolean) enables automatic TestCaseID generation. In that case excplicit values will be ignored. Algorithm of Test case ID auto-generation based on hashCode of test method codeRef(location in code) and test method arguments.

        # Sends "10.15.23.9" as TestCaseID
        @TestCaseId("10.15.23.9")
	public void my_belly_should_growl() {
		assertTrue(belly.growl());
        }

        # Sends "4567898765434567" as TestCaseID
        # assuming that method location in code is "com.test.stwewe.I_wait"
        # assuming that int hours = 10
	@TestCaseId(parameterized = true)
	public void I_wait(int hours) {
		belly.wait(hours);	
	}