Testing 如何做';每次';仅在夹具级别,而不是该夹具下的每个测试

Testing 如何做';每次';仅在夹具级别,而不是该夹具下的每个测试,testing,automated-tests,e2e-testing,testcafe,web-testing,Testing,Automated Tests,E2e Testing,Testcafe,Web Testing,我只想在fixture级别运行“beforeach”,而不是针对该fixture下的每个测试 fixture `Fixture A for Use Case1` .beforeEach(login) test('A Test 1', async t => { await t --- }); test('A Test 2', async t => { await t --- }); 发生了什么事 登录功

我只想在fixture级别运行“beforeach”,而不是针对该fixture下的每个测试

fixture `Fixture A for Use Case1`
   .beforeEach(login)

test('A Test 1', async t => {
      await t 
      ---
    }); 

test('A Test 2', async t => {
      await t 
      ---
    }); 
发生了什么事 登录功能在每次测试之前在“Fixture A”和“Fixture B”下运行

我需要什么 我希望“登录”在每个“Fixture”开始时运行一次,而不是在Fixture下的每个测试中运行一次


可能吗?我找不到有关文档的方法。

这可以通过用户角色和“保留url”选项实现。TestCafe的文档说明如下:

fixture `Fixture B for Use Case2`
    .beforeEach(login)

test('B Test 1', async t => {
      await t 
      ---
    }); 

test('B Test 2', async t => {
      await t 
      ---
    }); 
   
test('B Test 3', async t => {
      await t 
      ---
    });