haf / expecto

A smooth testing lib for F#. APIs made for humans! Strong testing methodologies for everyone!
Apache License 2.0
668 stars 96 forks source link

Tests vanish after being run #277

Closed ImaginaryDevelopment closed 6 years ago

ImaginaryDevelopment commented 6 years ago

image after running a single test, it vanishes image

[9/13/2018 1:34:16 PM Informational] ------ Discover test started ------
[9/13/2018 1:34:18 PM Warning] A test with the same name 'unfocused list/focused list/will run' already exists. This test is not added to the test window.
[9/13/2018 1:34:18 PM Warning] A test with the same name 'unfocused list/focused list/will run' already exists. This test is not added to the test window.
[9/13/2018 1:34:18 PM Warning] A test with the same name 'unfocused list/unfocused list/skipped' already exists. This test is not added to the test window.
[9/13/2018 1:34:18 PM Warning] A test with the same name 'unfocused list/unfocused list/will run' already exists. This test is not added to the test window.
[9/13/2018 1:34:18 PM Informational] ========== Discover test finished: 8 found (0:00:01.5445998) ==========
[9/13/2018 1:34:28 PM Informational] ------ Discover test started ------
[9/13/2018 1:34:29 PM Warning] A test with the same name 'unfocused list/focused list/will run' already exists. This test is not added to the test window.
[9/13/2018 1:34:29 PM Warning] A test with the same name 'unfocused list/focused list/will run' already exists. This test is not added to the test window.
[9/13/2018 1:34:29 PM Warning] A test with the same name 'unfocused list/unfocused list/skipped' already exists. This test is not added to the test window.
[9/13/2018 1:34:29 PM Warning] A test with the same name 'unfocused list/unfocused list/will run' already exists. This test is not added to the test window.
[9/13/2018 1:34:29 PM Informational] ========== Discover test finished: 8 found (0:00:00.6426964) ==========
[9/13/2018 1:34:29 PM Informational] ------ Run test started ------
[9/13/2018 1:34:29 PM Informational] Running selected tests
[9/13/2018 1:34:29 PM Informational] Executing tests in assembly C:\projects\HealthDesigns\HD.Tests\bin\Release\HD.Tests.exe
[9/13/2018 1:34:30 PM Informational] Executing tests from: C:\projects\HealthDesigns\HD.Tests\bin\Release\HD.Tests.exe. 1 tests (unfocused list/focused list/will run)
[9/13/2018 1:34:30 PM Informational] All tests: 8
[9/13/2018 1:34:30 PM Informational] Number of tests included: 3
[9/13/2018 1:34:30 PM Informational] ========== Run test finished: 0 run (0:00:00.6765898) ==========
[9/13/2018 1:37:09 PM Informational] ------ Discover test started ------
[9/13/2018 1:37:10 PM Warning] A test with the same name 'unfocused list/focused list/will run' already exists. This test is not added to the test window.
[9/13/2018 1:37:10 PM Warning] A test with the same name 'unfocused list/focused list/will run' already exists. This test is not added to the test window.
[9/13/2018 1:37:10 PM Warning] A test with the same name 'unfocused list/unfocused list/skipped' already exists. This test is not added to the test window.
[9/13/2018 1:37:10 PM Warning] A test with the same name 'unfocused list/unfocused list/will run' already exists. This test is not added to the test window.
[9/13/2018 1:37:10 PM Informational] ========== Discover test finished: 8 found (0:00:00.9541923) ==========
[9/13/2018 1:39:03 PM Informational] ------ Run test started ------
[9/13/2018 1:39:03 PM Informational] Running selected tests
[9/13/2018 1:39:04 PM Informational] Executing tests in assembly C:\projects\HealthDesigns\HD.Tests\bin\Release\HD.Tests.exe
[9/13/2018 1:39:04 PM Informational] Executing tests from: C:\projects\HealthDesigns\HD.Tests\bin\Release\HD.Tests.exe. 1 tests (unfocused list/focused list/will run)
[9/13/2018 1:39:04 PM Informational] All tests: 8
[9/13/2018 1:39:04 PM Informational] Number of tests included: 3
[9/13/2018 1:39:04 PM Informational] ========== Run test finished: 0 run (0:00:00.4897678) ==========

I have only two files after creating a new project targeting 4.6.2

module ConversionsTests

open Expecto

[<Tests>]
let focusedTests =
  testList "unfocused list" [
    ftestList "focused list" [
      testCase "will run" <| fun () -> Expect.equal (2+2) 4 "2+2"
      ftestCase "will run" <| fun () -> Expect.equal (2+2) 4 "2+2"
      test "will run" { Expect.equal (2+2) 4 "2+2" }
    ]
    testList "unfocused list" [
      testCase "skipped" <| fun () -> Expect.equal (2+2) 1 "2+2?"
      ftestCase "will run" <| fun () -> Expect.equal (2+2) 4 "2+2"
      test "skipped" { Expect.equal (2+2) 1 "2+2?" }
      ftest "will run" { Expect.equal (2+2) 4 "2+2" }
    ]
    testCase "skipped" <| fun () -> Expect.equal (2+2) 1 "2+2?"
  ]

and Program.fs

// Learn more about F# at http://fsharp.org
// See the 'F# Tutorial' project for more help.

open System
open Expecto

let tests =
  test "A simple test" {
    let subject = "Hello World"
    Expect.equal subject "Hello World" "The strings should equal"
  }

[<EntryPoint>]
let main args =
  let result = runTestsWithArgs defaultConfig args tests
  Console.ReadLine() |> ignore
  result

if I rebuild the test project the test reappears.

AnthonyLloyd commented 6 years ago

I think you should post in https://github.com/adamchester/expecto-adapter for @adamchester @MNie

ImaginaryDevelopment commented 6 years ago

Posted https://github.com/adamchester/expecto-adapter/issues/43