Reputation: 73
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:
Is there a way correctly to do this? Because my gitlabci-runner doesnt work fine with this configuration. E.g.:
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
Upvotes: 2
Views: 1237
Reputation: 73
I found a solution for this mistake. I add some tags in each NUnit running line and it works! Look here:
Before:
- '"C:\\Program Files (x86)\NUnit.org\nunit-console\nunit3-console.exe" "test-automation-inscricao-vestib.dll" --where "cat==Producao"'
After:
- '"C:\\Program Files (x86)\NUnit.org\nunit-console\nunit3-console.exe" "test-automation-inscricao-vestib.dll" --inprocess --labels=On --where "cat==Producao"'
Fixed only including these tags: --inprocess --labels=On
Upvotes: 2