Skip to content

is after-all running at the correct time ? #7

Open
@a-stevan

Description

@a-stevan

i wrote a more complete example test file below with a before-all and after-all

use std assert

def local [] {
  print "i'm local"
}

#[before-all]
def global-setup [] {
  print "before all"
  {
    data: "xxx"
  }
}

#[before-each]
def setup [] {
  print "before each"
  {
    data: "xxx"
  }
}

#[after-each]
def cleanup [] {
  print "after each"
  print $in
}

#[after-all]
def global-cleanup [] {
  print "after all"
  print $in
}

#[test]
def "some-data is xxx" [] {
  let context = $in
  print $"Running test A: ($context.data)"
  assert equal "xxx" $context.data
}

#[test]
def "is one equal one" [] {
  print $"Running test B: ($in.data)"
  assert equal 1 1
}

#[test]
def "is two equal two" [] {
  print $"Running test C: ($in.data)"
  assert equal 2 2
}

#[ignore]
def "an ignored test" [] {
  print $"Running test D: ($in.data)"
  assert equal "dummy" "dummy"
}

but i get the following

testing run-tests --reporter table
#┬─suite──┬──────test──────┬result┬───────output────────
0│test-foo│an ignored test │SKIP  │─┬──────────         
 │        │                │      │0│before all         
 │        │                │      │1│after all          
 │        │                │      │2│────┬───           
 │        │                │      │ │data│xxx           
 │        │                │      │ │────┴───           
 │        │                │      │─┴──────────         
1│test-foo│is one equal one│PASS  │─┬───────────────────
 │        │                │      │0│before all         
 │        │                │      │1│after all          
 │        │                │      │2│────┬───           
 │        │                │      │ │data│xxx           
 │        │                │      │ │────┴───           
 │        │                │      │3│before each        
 │        │                │      │4│Running test B: xxx
 │        │                │      │5│after each         
 │        │                │      │6│────┬───           
 │        │                │      │ │data│xxx           
 │        │                │      │ │────┴───           
 │        │                │      │─┴───────────────────
2│test-foo│is two equal two│PASS  │─┬───────────────────
 │        │                │      │0│before all         
 │        │                │      │1│after all          
 │        │                │      │2│────┬───           
 │        │                │      │ │data│xxx           
 │        │                │      │ │────┴───           
 │        │                │      │3│before each        
 │        │                │      │4│Running test C: xxx
 │        │                │      │5│after each         
 │        │                │      │6│────┬───           
 │        │                │      │ │data│xxx           
 │        │                │      │ │────┴───           
 │        │                │      │─┴───────────────────
3│test-foo│some-data is xxx│PASS  │─┬───────────────────
 │        │                │      │0│before all         
 │        │                │      │1│after all          
 │        │                │      │2│────┬───           
 │        │                │      │ │data│xxx           
 │        │                │      │ │────┴───           
 │        │                │      │3│before each        
 │        │                │      │4│Running test A: xxx
 │        │                │      │5│after each         
 │        │                │      │6│────┬───           
 │        │                │      │ │data│xxx           
 │        │                │      │ │────┴───           
 │        │                │      │─┴───────────────────
─┴────────┴────────────────┴──────┴─────────────────────

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions