Where is the log for the current build located?

rafae11's Avatar

rafae11

20 Feb, 2020 12:24 PM

I want to do this findstr "Failed to discover tests from assembly" C:\path-to-log-file\console.log
Write-Output $LASTEXITCODE
stop the build.

  1. Support Staff 1 Posted by Feodor Fitsner on 20 Feb, 2020 07:13 PM

    Feodor Fitsner's Avatar

    There should be a simpler solution to determine if your tests failed. Could you share your appveyor.yml?

  2. 2 Posted by rafae11 on 20 Feb, 2020 07:24 PM

    rafae11's Avatar

    at the moment i'm capturing the console log and finding if the string exists in the file.
    version: 1.0.{build}
    before_build:
    - ps: "nuget config -set repositoryPath=C:\\projects\\example-csharp-master\\packages -configfile C:\\projects\\example-csharp-master\\nuget.config\nnuget restore \nchoco install opencover.portable\nchoco install codecov"
    build:
      project: CodecovProject.sln
      verbosity: minimal
    test_script:
    - ps: >-
        $env:PATH += ";C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\Extensions\TestPlatform\"

        $Path = "vstest.console.exe"

        $Param1 = "/logger:Appveyor"

        $Param2 = "C:\projects\example-csharp-master\MyUnitTests\bin\Debug\MyUnitTests.dll"

        $List = -join($Path," ",$Param1," ",$Param2)

        Write-Host "Test Started"

        $out = Invoke-Command -ScriptBlock {cmd /c $List}

        $out | out-file -filepath C:\projects\example-csharp-master\out.txt

        Write-Host "Test Completed"

        findstr "Failed to discover tests from assembly" "C:\projects\example-csharp-master\out.txt"

        if( $LASTEXITCODE -eq 0)

        {
            Write-Output "Failed to discover tests from assembly"
            $LASTEXITCODE = 1
            Write-Output $LASTEXITCODE
            $host.SetShouldExit($LastExitCode)
        }

        ElseIf( $LASTEXITCODE -eq 1)

        {
            Write-Output "Tests Completed"
            $LASTEXITCODE = 0
            Write-Output $LASTEXITCODE
        }
        On Thursday, February 20, 2020, 11:13:09 AM PST, Feodor Fitsner <[email blocked]> wrote:

      #yiv5515179617 pre {width:92%;margin:10px 2%;padding:5px 2%;background:#efefef;border:1px solid #d6d6d6;}#yiv5515179617 blockquote {margin-left:0;padding-left:1em;border-left:5px solid #ccc;}
    |

  3. Support Staff 3 Posted by Feodor Fitsner on 20 Feb, 2020 07:31 PM

    Feodor Fitsner's Avatar

    Why not just having something like:

    - cmd: vstest.console.exe /logger:Appveyor MyUnitTests\bin\Debug\MyUnitTests.dll && echo Tests Completed || echo Failed to discover tests from assembly
    
  4. 4 Posted by rafae11 on 20 Feb, 2020 07:36 PM

    rafae11's Avatar

    Thanks will try that, i'm a newbie. 
        On Thursday, 20 February 2020, 11:31:13 GMT-8, Feodor Fitsner <[email blocked]> wrote:
     
      #yiv0728775002 pre {width:92%;margin:10px 2%;padding:5px 2%;background:#efefef;border:1px solid #d6d6d6;}#yiv0728775002 blockquote {margin-left:0;padding-left:1em;border-left:5px solid #ccc;}
    |

  5. 5 Posted by rafae11 on 20 Feb, 2020 07:57 PM

    rafae11's Avatar

    We have had instances where the test are not run, which shows in the log file but does not return any error message. How do you deal with that scenario?
        On Thursday, February 20, 2020, 11:36:03 AM PST, rafael gonzalez <[email blocked]> wrote:
     
      Thanks will try that, i'm a newbie. 
        On Thursday, 20 February 2020, 11:31:13 GMT-8, Feodor Fitsner <[email blocked]> wrote:
     
      #yiv3705751097 pre {width:92%;margin:10px 2%;padding:5px 2%;background:#efefef;border:1px solid #d6d6d6;}#yiv3705751097 blockquote {margin-left:0;padding-left:1em;border-left:5px solid #ccc;}
    |

  6. Support Staff 6 Posted by Feodor Fitsner on 20 Feb, 2020 07:59 PM

    Feodor Fitsner's Avatar

    Could you elaborate please? ...or maybe link to a build would help if it's not a private project.

  7. Feodor Fitsner closed this discussion on 21 Apr, 2020 09:03 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

 

01 Oct, 2024 04:27 PM
26 Sep, 2024 03:49 PM
26 Sep, 2024 09:02 AM
25 Sep, 2024 07:07 PM
24 Sep, 2024 08:39 PM
24 Sep, 2024 06:47 AM