2017-09-20 3 views
0

DearsGitlabCI - Plusieurs environnements NUnit à la même version

Mon intégration continue + projet de tests est en cours avec le fichier gitlabci sur un serveur dédié. Exécuter avec plusieurs environnements est mon objectif pour terminer ce projet. Par exemple: J'ai deux environnements (desenv et homol) et mon désir est de construire le projet et après avoir couru dans chacun de ces tests ne changeant que quelques variables (lien, utilisateur db) dans le test-automation-inscricao- vestib.dll.config.

Je createad un fichier YML avec 3 emplois:

  • build: Test -> NuGet restaurer et construire des projets
  • test: desenv -> changement file.dll.config à respectif fichier de configuration de l'environnement et exécuter testes (NUnit)
  • test: homol -> modifier file.dll.config dans le fichier de configuration respectif de l'environnement et exécuter testes (NUnit)

Existe-t-il un moyen de le faire correctement? Parce que mon gitlabci-runner ne fonctionne pas bien avec cette configuration. .: par exemple

Error

Voici mon code YML:

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 

Répondre

0

J'ai trouvé une solution pour cette erreur. J'ajoute des tags dans chaque ligne de running NUnit et ça marche! Regardez ici:

Avant:

- '"C:\\Program Files (x86)\NUnit.org\nunit-console\nunit3-console.exe" "test-automation-inscricao-vestib.dll" --where "cat==Producao"' 

Après:

- '"C:\\Program Files (x86)\NUnit.org\nunit-console\nunit3-console.exe" "test-automation-inscricao-vestib.dll" --inprocess --labels=On --where "cat==Producao"' 

fixe incluant uniquement ces tags: --inprocess --labels = Sur

+0

Ce sujet m'a aidé: https : //github.com/nunit/nunit/issues/1045 –