skip to content

In ReportPortal a test item's metadata is an `ItemAttribute` with a `key`, a `value` and a `system` flag, while an Allure `Label` is always a name and a value. What can the first shape express that the second cannot?

level: seniorimportance: nice to knowfreq 32%

answer

  1. one shape has an optional half
  2. a flag for who wrote it
  3. it can attach above the test item
  4. Allure labels record no provenance

basics

~20 s

Three things: a bare value with no key, since ReportPortal constrains the value but not the key; a system flag separating attributes the server set from ones a person typed; and attachment to a whole launch, not only to one test item.

solid answer

~40 s

`ItemAttribute` holds a `key`, a `value` and a boolean `system`, and it can hang off either a test item or a launch. The API resource declares `value` as not-blank but puts no such constraint on `key`, so a keyless attribute is legal -- a bare marker rather than a named dimension. `system` records that ReportPortal set the attribute itself, which lets the product keep its own bookkeeping apart from something a person typed. An Allure `Label` is always a `name` plus a `value`, always attached to one result, and carries no marker of who set it: a label written by the adaptor and one written by hand are identical in the file. Consolidate results from both and the keyless attributes, the `system` flag and the launch-level scope are the parts with nowhere to land.

go deeper

for a junior

Recall that both products hang small string pairs on a test as metadata, and that the names differ: Allure calls them labels, ReportPortal calls them attributes.

for a middle

State the field lists precisely -- key, value and system on one side, name and value on the other -- and note which half is the optional one.

for a senior

When merging results from both, settle up front what happens to a keyless attribute, to a server-set one and to a launch-level one, rather than discovering it in a broken filter later.

for a principal

Own what the merged metadata means: if one source can record provenance and scope and the other cannot, be able to say what a consolidated filter is actually filtering on.

## Two shapes for the same idea Both products attach small pieces of metadata to a test so that a report can group and filter by them. The shapes are close enough that people assume they are the same idea under two names, and different enough that a merge between them loses something. | | Allure `Label` | ReportPortal `ItemAttribute` | |---|---|---| | fields | `name`, `value` | `key`, `value`, `system` | | optional half | neither | the `key` | | provenance marker | none | the `system` flag | | attaches to | one test result | a test item **or** a launch | ## The optional key In ReportPortal's API resource the `value` is the constrained field -- it is declared not-blank, with a minimum length -- while `key` carries no such constraint. A keyless attribute is therefore a legal, ordinary thing: a **bare value**, a plain tag, with nothing on the left-hand side. That matters more than it looks. It means the model supports two different uses at once: - **A keyed attribute** is a named dimension: something like a browser attribute whose value is the browser's name. It is what you group by. - **A keyless attribute** is a flat marker: it says a test is *in a set*, without saying which dimension the set belongs to. An Allure `Label` cannot express the second form. Every label has a `name`, so the closest equivalent is a label whose name is a convention agreed out of band and whose value is the marker -- which works but records something structurally different: it asserts a dimension that may not exist. ## The provenance flag `system` is a boolean on the attribute saying it was set by the product itself rather than typed by a person. It exists because a server that writes bookkeeping onto a launch as it processes one needs a way to tell its own writes apart from a user's afterwards -- when displaying them, when filtering on them, and when deciding whether an edit may remove them. Allure has nothing corresponding. A label written automatically by the adaptor and a label written by hand in an annotation are byte-identical in the result file: both are a `name` and a `value`. You can often *guess* which is which from the name -- `suite` labels are usually derived, `epic` labels are usually declared -- but the file does not record it, and a guess is not something a tool can act on. ## Scope An `ItemAttribute` can hang off a launch as well as off an individual test item, so a fact that is true of the whole run is recorded once, in one place, at the level it is actually true of. An Allure `Label` lives on a single result; a fact about a whole run has to be repeated onto every result the run produced, and the report has no way to know the repetition was one decision rather than many. ## What all this costs when results are consolidated This is the part worth being able to argue, because the losses are structural rather than encoding problems, and each has to be decided rather than converted: 1. **A keyless attribute needs a key or it is dropped.** Inventing one -- `tag`, say -- is the usual choice, but it fabricates a dimension the original data deliberately did not assert. 2. **The `system` flag has nowhere to land.** Once it is gone, machine-written bookkeeping is indistinguishable from a human's annotation, and any filter built on the merged metadata is quietly filtering over both. 3. **Launch-level attributes have to be pushed down or lost.** Copying one onto every result works, but the merged data can no longer say the value was asserted once for the run. 4. **Nothing in either shape is validated.** Both sides are string pairs with no closed vocabulary, so the merged set is only as coherent as the conventions that produced it -- and there is no place in either format to record what those conventions were. ## Reading the difference the right way round Neither shape is better. The extra fields exist because the products sit in different places: one writes files that a generator later reads, the other is a server receiving a live stream and keeping its own state alongside what clients send it. A server has bookkeeping to keep separate from user data and a run-level object to attach things to; a file writer has neither. The useful takeaway for an interview is not the field lists but the consequence: **when you merge metadata from two models, the fields with no counterpart are the whole story**, and deciding what happens to them belongs at the front of the design, not at the end.

  • Why would a product mark some attributes as system-set at all?
    So its own bookkeeping is separable from what a user typed. Attributes the server writes while processing a launch can then be told apart from user-supplied ones when they are displayed, filtered on, or updated -- without needing a second storage mechanism alongside the ordinary attributes.
  • Both shapes are just string pairs. Why does consolidating them still lose information?
    Because the losses sit in the parts with no counterpart. A keyless attribute has to be given an invented key or dropped; the `system` flag disappears once labels carry no provenance; and an attribute asserted once on a launch has to be copied onto every result or lost. None of that is a string-encoding problem.

saying these in an interview costs you the question

  • Calls the two shapes the same thing renamed
  • Assumes every attribute must carry a key
  • Thinks Allure labels record who set them
  • Reads a keyless attribute as a client bug