mercredi 20 septembre 2017

GitlabCI - Multiple environments NUnit to the same build

Dears

My continuous integration + tests project is running with the gitlabci file on a dedicated server. Run with multiple environments is my goal to complete this project.

For example: I have two environments (desenv and homol) and my desire is build the project and after run in each one these tests changing only some variables (link, db user) in the test-automation-inscricao-vestib.dll.config.

I createad a yml file with 3 jobs:

  • build:test -> nuget restore and build project
  • test:desenv -> change file.dll.config to the respective configuration file of the environment and run testes (NUnit)
  • test:homol -> change file.dll.config to the respective configuration file of the environment and run testes (NUnit)

Is there a way correctly to do this? Because my gitlabci-runner doesnt work fine with this configuration. E.g.:

Error

Here is my yml code:

stages:
  - build
  - test

build:test:
  only: 
   - schedules
   - web
  stage: build
  tags:
   - windows
  script:
  #Restore Nuget
   - '"C:\\Gitlab-Runner\\nuget.exe" restore "test-automation-inscricao-vestib.sln"'

  #Build project
   - '"C:\\Program Files (x86)\\MSBuild\\14.0\\Bin\\msbuild.exe" /t:Clean,Build /p:Configuration=Debug "test-automation-inscricao-vestib.sln"'
  artifacts:
   paths:
    - test-automation-inscricao-vestib\bin\Debug

test:desenv:
  only: 
   - schedules
   - web
  stage: test
  tags:
   - teste
  script:
  #Change the environment to DESENV
   - powershell Remove-Item test-automation-inscricao-vestib\bin\Debug\test-automation-inscricao-vestib.dll.config
   - powershell Rename-Item test-automation-inscricao-vestib\test-automation-inscricao-vestib_DESENV.dll.config test-automation-inscricao-vestib\bin\Debug\test-automation-inscricao-vestib.dll.config

  #Run tests
   - cd test-automation-inscricao-vestib/bin/Debug
   - '"C:\\Program Files (x86)\NUnit.org\nunit-console\nunit3-console.exe" "test-automation-inscricao-vestib.dll" --where "cat==Producao"'

  dependencies:
   - build:test   


test:homol:
  only: 
   - schedules
   - web
  stage: test
  tags:
   - teste
  script:
  #Change the environment to HOMOL
   - powershell Remove-Item test-automation-inscricao-vestib\bin\Debug\test-automation-inscricao-vestib.dll.config
   - powershell Rename-Item test-automation-inscricao-vestib\test-automation-inscricao-vestib_HOMOL.dll.config test-automation-inscricao-vestib\bin\Debug\test-automation-inscricao-vestib.dll.config

  #Run tests
   - cd test-automation-inscricao-vestib/bin/Debug
   - '"C:\\Program Files (x86)\NUnit.org\nunit-console\nunit3-console.exe" "test-automation-inscricao-vestib.dll" --where "cat==Producao"'

  dependencies:
   - build:test   

Aucun commentaire:

Enregistrer un commentaire