La configurazione del test dell'unità / Teardown funziona in test asincrono?
-
11-12-2019 - |
Domanda
Stavo cercando di lavorare con sé oggi in uno scenario simile a questo:
group('some group', (){
//prints
setUp(() => print('set up'));
test('some test', (){
window.requestLayoutFrame(
expectAsync0((){
Expect.isTrue(true);
})
);
});
//doesn't print
tearDown(() => print('tear down'));
});
.
In questo esempio, il callback di teachdown non sembra essere chiamato.
Quando metto la funzione Teardown () prima del test dell'unità, viene chiamato, ma la sequenza di uscita non è ciò che mi aspetterei:
group('some group', (){
setUp(() => print('set up'));
tearDown(() => print('tear down'));
test('some test', (){
window.requestLayoutFrame(expectAsync0((){
print('in unit test');
Expect.isTrue(true);
}));
});
});
.
rendimenti:
set up
tear down
in unit test
PASS: some group some test
.
Non dovrebbe l'uscita del test dell'unità prima della lacrimazione?
SDK Build 9881
Soluzione
Bug.Risolto: http://www.dartbug.com/4284
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow