Sequential Testing

I have functional tests. But I want to execute them all in order. I have two test files;

  • 01-login.js
  • 02-logout.js

Usually they are executed in order but sometimes logout.js is executed first.

I want to create a scenario which I can design all user’s actions step by step. Am I missing something?

1 Like

Ok I have found something about it. :slight_smile:

In the adonis-vow package, there is a line which fetching test files. You may see in here

let testFiles = await this.cli.getTestFiles()

I have checked out getTestFiles function too. It uses globby library. I don’t know why but sometimes, while we are fetching test files, it can be unordered. If we change the line like following example, it will works.

let testFiles = (await this.cli.getTestFiles()).sort()

@virk, should I open a Pull Request for this?

I have found another solution. We can order suites by its name in the vowfile.js

module.exports = (cli, runner) => {
  runner.before(async () => {

    runner._suites.sort(function (a, b) {
      if( < { return -1; }
      if( > { return 1; }
      return 0;
1 Like

Only the filename will not resolve.
See in the two files in the header the code could be

/ * 01-login.js * /
const {test, trait} = use (‘Test / Suite’) (‘01-login’)

/ * 02-logout.js * /
const {test, trait} = use (‘Test / Suite’) (‘02-logout’)

@odirleiborgert thank a lot. But even I tried it your way, sometimes the file list which I mention before could be ordered wrong. I think the real problem is in globby library.

1 Like

@ozziest If you can find the exact issue and create a PR to fix it at globally level, then I’ll be happy to accept a PR for same