github.com/getgauge/gauge@v1.6.9/execution/saveResult_test.go (about)

     1  /*----------------------------------------------------------------
     2   *  Copyright (c) ThoughtWorks, Inc.
     3   *  Licensed under the Apache License, Version 2.0
     4   *  See LICENSE in the project root for license information.
     5   *----------------------------------------------------------------*/
     6  package execution
     7  
     8  import (
     9  	"os"
    10  	"path/filepath"
    11  	"testing"
    12  
    13  	"github.com/getgauge/common"
    14  	"github.com/getgauge/gauge/config"
    15  	"github.com/getgauge/gauge/execution/result"
    16  )
    17  
    18  func TestIfResultFileIsCreated(t *testing.T) {
    19  	msg := &result.SuiteResult{}
    20  
    21  	writeResult(msg)
    22  
    23  	file := filepath.Join(config.ProjectRoot, dotGauge, lastRunResult)
    24  
    25  	if !common.FileExists(file) {
    26  		t.Errorf("Expected file %s to exist", file)
    27  	}
    28  	os.RemoveAll(filepath.Join(config.ProjectRoot, dotGauge))
    29  }