Issue with Name format assignment in 3.12
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- csharp
- Ambito
- documentation, testing
Direzione di ricerca
Iniziare dalla documentazione di SetName e TestCaseData e dalla riproduzione fornita con DemoTestClass; confrontare il comportamento del formato documentato con i nomi dei test osservati in NUnit e nei test runner indicati. Il lavoro è completato quando si determina se la documentazione o il comportamento sono errati e si aggiorna la documentazione pertinente per descrivere accuratamente il comportamento di {m} e l'impatto dei nomi duplicati.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
According to the documentation for the "SetName" property:
"The SetName property of TestCaseData allow setting the format string for the individual test case. So long as no format specifiers are used in the name, there will be no change in how this works."
With a name being assigned as "String name", we would expect no hierarchical change in the name of the test. However, the {m} section is being removed regardless. We can manually add the {m} format specifier in each case, however this conflicts with provided documentation.
There is an additional issue can resulted as part of this problem, when test case data is shared across multiple tests. If multiple items end up sharing the same name (due to the {m} being missing) it causes the remaining test information to become statically listed within MSTest, and several other Test Runners (including the Resharper test runner).
Code to replicate is included:
[TestFixture]
public class DemoTestClass
{
[Test, TestCaseSource(nameof(GetTestCases))]
public string objectUsedAsParamImpactsName(TestObjectClass obj)
{
Console.Write(obj.id);
return obj.name;
}
private static IEnumerable<TestCaseData> GetTestCases()
{
var data = new TestObjectClass() {name = "Test Name", id = 1};
var testCase = new TestCaseData(data);
testCase.SetName("String used as name");
testCase.Returns("Test Name");
yield return testCase;
}
[Test, TestCaseSource(nameof(GetStringTestCasesData))]
public string stringUsedAsParamShowsCorrectname(string str)
{
return str;
}
private static IEnumerable<TestCaseData> GetStringTestCasesData()
{
var testCase = new TestCaseData("Test Name");
testCase.SetName("String used as name");
testCase.Returns("Test Name");
yield return testCase;
}
public class TestObjectClass
{
public string name;
public int id;
}
}
- Lingua principale
- Dockerfile
- Stelle
- 601
- Fork
- 159
- Merge medio
- 22h 18m
- PR unite (30g)
- 6
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di nunit/docs
-
area:adapter type:newpage
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
-
Document why output from ASP.NET Core handlers (WebApplicationFactory) is not captured, and the workaroundsForse già presa @SeanKilleen l’ha presa 36 giorni fa. Apertaarea:framework type:update
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
-
type:newpage
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
Dependency DashboardAperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 15/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
audacity/audacity.github.io#118 ·
-
bug improve content
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
opensafely/documentation#2102 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 75/100
agentregistry-dev/website#69 ·
-
15.0
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
-
docs: add SECURITY.md vulnerability reporting policyForse già presa @AK-Lmn l’ha presa oggi. Aperta
Difficoltà 1/5 1-3 ore Idoneità per principianti 72/100
flisk-sh/linux2wasm#12 ·
I maintainer di solito rispondono entro 1 giorno