私の仕事では、私の同僚のローカルマシンで失敗しているいくつかのテストがありますが、私がテストを実行している代理人ではありません。私はあなたが分度器を使用すると、それぞれが制御フローに入れられ、順番に実行されるという印象を受けました。私たちの同僚のマシンで見ていることは、以前の約束が解決されていないにもかかわらず、後続のものが実行されているということです。私は仕事に関する詳細を取り除きました。うまくいけば、以下のコードスニペットは何が起こっているのかを理解するのに十分です。分度器とControlFlowを誤解していますか?
分度器の理解が間違っている、または同僚のマシンに問題がある可能性がありますか?
"use strict";
describe('Test Title', function() {
let fetchedData,
createdData;
beforeAll(()=> globalHelper.logIn());
afterAll(()=> globalHelper.logOut());
it("Precondition: set to clean state", function() {
environmentHelper.cleanEnvironment();
});
it("Get data from server", function() {
fetchDataFromServer()
.then((result) => {
fetchedData = result;
});//we expect execution of the test to stop until this promise is resolved and an error is thrown or the code inside the then is executed
});
it("Next Step", function() {
//do some things
});
it("Next step", function(){
//do more things
});
it("Navigate to page",() => {
//navigate to page
});
it("create some data", function() {
//create some data
});
it("another step", function() {
//do even more things
});
it("Clean up", function() {
environmentHelper.removeCreatedData(createdData);
});
});
助けてください。事前のおかげで
'it(...) 'によって表されるテストは、他のテストとは独立していると考えられます。あなたの例では、それらをステップとして使用していますが、これは悪い習慣です。 –