1

有什么办法可以让测试顺序依赖,所以测试 2 在测试 1 完成之前不会开始?去 localhost:4200/tests 以不确定的方式运行它们,有时它会以正确的顺序运行并且工作正常,但有时它会乱序运行它们,这可能会导致问题,有没有办法强制特定的顺序但保留它们在单独的测试功能中,我总是可以将该测试的所有内容放在一个大测试功能中,以便顺序始终有效,但我觉得它们应该被分解成自己的功能,任何指导将不胜感激?下面的示例只是我希望订单看起来像的示例测试

import Ember from 'ember';
import startApp from '../helpers/start-app';

var application;

module('Acceptance: Login', {
  beforeEach: function() {
    application = startApp();
  },
  afterEach: function() {
    Ember.run(application, 'destroy');
  }
});


test('test 1', function(assert) {
  authenticateSession();

  andThen(function() {
    visit('/patients/1');
  });

  andThen(function() {
   assert.equal(currentRouteName(), 'patients.show.index', "Current route is patients.show.index");
  });

});

test('test 2', function(assert) {
  authenticateSession();

  andThen(function() {
    visit('/invoices/1');
  });

  andThen(function() {
   assert.equal(currentRouteName(), 'invoices.show.index', "Current route is invoices.show.index");
  });

});
4

1 回答 1

3

您是否尝试过使用reorder配置选项

<script>
// after you include QUnit...
QUnit.config.reorder = false;
</script>
于 2015-02-19T19:24:15.197 回答