aztfmod / rovergo

The next version of Rover, the command line tool for Azure CAF Landingzones. Developed in Go
MIT License
10 stars 7 forks source link

Develop pattern for integration testing #54

Closed sebastus closed 3 years ago

sebastus commented 3 years ago

integration testing may use terratest, but in general the pattern is:

sebastus commented 3 years ago

Looking at how the various pkgs can be refactored as interfaces so that mocks can be written.

sebastus commented 3 years ago

Initial unit test has 99.9% of what's needed to do an integration test. One line of code has to change: (file is runFromCLI_test.go)

    getActionMap()
    action := cmd.ActionMap["mock"]
    console.DebugEnabled = true
    action.Execute(&optionsList[0])

to:

    getActionMap()
    action := cmd.ActionMap[cmd.Name()]    <-- this 
    console.DebugEnabled = true
    action.Execute(&optionsList[0])