Method Interceptors page: an IMethodInterceptor receives dependency-constrained methods too

Aperta Adatta ai principianti
#86 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
88/100
Tipo di issue
Documentazione
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
java
Ambito
documentation

Direzione di ricerca

Modifica src/main/asciidoc/docs/method_interceptors.adoc; inizia confrontando l’attuale spiegazione in due gruppi con il contratto effettivo di IMethodInterceptor descritto nell’issue. Sostituisci questa impostazione con il comportamento consapevole delle dipendenze e indica upstreamDependencies() e downstreamDependencies(); il lavoro è completato quando la pagina non afferma più che vengono passati solo metodi senza vincoli.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Page

src/main/asciidoc/docs/method_interceptors.adoc — "Method Interceptors"

Problem

The page describes a two-group model that TestNG has not implemented for the whole of the 6.x and 7.x line:

Once TestNG has calculated in what order the test methods will be invoked, these methods are split in two groups:

  • Methods run sequentially. These are all the test methods that have dependencies or dependents. [...]
  • Methods run in no particular order. [...]

In order to give you more control on the methods that belong to the second category, TestNG provides org.testng.IMethodInterceptor

The list of methods passed in parameters are all the methods that can be run in any order.

An IMethodInterceptor is in fact handed every test method of its <test>, the ones taking part in a dependsOnMethods or dependsOnGroups relation included.

This is the documentation half of testng-team/testng#1263, which reported the same claim in the IMethodInterceptor javadoc.

Why the code is not going to change

TestRunner builds the scheduling graph from what the interceptors return — deliberately, so that an interceptor removing methods cannot make the graph wait forever for a method that will never be invoked (the parallel methods lock-up fix). A method withheld from the interceptor would therefore be a method no implementation could ever drop.

Restoring the documented contract would also take from every filtering interceptor the ability to exclude a dependency-constrained test, silently running tests their author believes excluded, with no replacement API.

So the wording is what is wrong, not the behaviour.

What the javadoc now says

testng-team/testng has corrected IMethodInterceptor and ITestNGMethod to describe the actual contract:

  • every test method of the <test> is passed, dependency-constrained ones included, and why;
  • ITestNGMethod.upstreamDependencies() and downstreamDependencies() tell a constrained method from a free one, and are now populated before the interceptors run so an implementation can act on them;
  • where a constrained method runs stays bounded by the graph, so reordering it cannot move it ahead of what it depends upon;
  • dropping a method that another retained method depends upon ends the run with a TestNGException naming the dependency.
Suggested change

Replace the two-group framing with the above, and point readers at upstreamDependencies() / downstreamDependencies() for the distinction the old text promised TestNG would make for them.

Lingua principale
HTML
Stelle
6
Fork
17
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di testng-team/testng-team.github.io

Tutte le issue di testng-team/testng-team.github.io

Issue simili

Altre issue su Documentation

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.