0

I'm having a very specific, yet very interesting problem.

So, the end goal is to have some end-to-end, specflow tests running in the Azure pipeline. Those tests are connecting to the Database, running the procedure with different parameters and test the outcome that happens in the tables.

Now, the problem is there because the architecture of my employer is a bit strange. Now, they have 2 servers where an Azure pipeline would be running:

  • Build Server
  • And QA Server

The problem is that Build server can only build (has access to specific Nuget feed where all the libraries are) and can't access the database - can't run the tests. The QA server can't build anything, but can access the database and can run the tests.

So basically, I have to build the project, save it as an artefact and run that artefact on QA server.

This testing application is now a console app. Basically an executable is provided. But, how do I use that in the QA server, to actually run those tests?

The tests, as I've mentioned are Specflow tests. They are just in feature files and I've used Test Explorer to run them locally.

Any help would be highly appreciated! This is bugging my mind for a while now, without the proper answer.

Thank you in advance!

2
  • You can still run tests. I do this easily. Build the test projects in on your build server, zip them up, upload them as an artifact. Pull the zip down on your QA server, unzip, and then run the tests using the "Visual Studio Test" task. You'll need the Visual Studio testing tools installed on the QA server. No need for an executable. Commented May 20, 2024 at 17:47
  • BTW, they are never "just SpecFlow tests". SpecFlow is usually paired with a unit testing framework, which you have not mentioned. Most unit testing frameworks come with .exe files you can execute from the command line to run tests. Your QA server could have that installed as well and just run these are normal tests. Commented May 20, 2024 at 17:49

1 Answer 1

1

You can build your project on a Build server Publish it as an Artifact and then download the artifact on QA Server and finally run your tests on a QA Server by using the Azure Devops Yaml pipeline below:-

My Github repository with the code.

My Azure devops yaml pipeline:-

trigger:
- '*'

pool:
  vmImage: 'windows-latest'

stages:
- stage: Build
  jobs:
  - job: BuildJob
    steps:
    - task: UseDotNet@2
      displayName: 'Install .NET CORE 6.x SDK'
      inputs:
        version: 6.x

    - task: NuGetCommand@2
      inputs:
        command: 'restore'
        restoreSolution: '**/*.sln'
        feedsToUse: 'select'

    - task: VSBuild@1
      inputs:
        solution: '**/*.sln'
        msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(Build.Repository.LocalPath)"'

    - task: DotNetCoreCLI@2
      inputs:
        command: 'publish'
        publishWebProjects: false
        projects: '**/*.csproj'
        arguments: '--configuration $(BuildConfiguration) --output $(Build.ArtifactStagingDirectory)/drop'

    - task: PublishBuildArtifacts@1
      inputs:
        PathtoPublish: '$(Build.ArtifactStagingDirectory)/drop'
        ArtifactName: 'drop'

- stage: DeployAndTest
  dependsOn: Build
  jobs:
  - deployment: DeployAndTestJob
    environment: 'QA'
    strategy:
      runOnce:
        deploy:
          steps:
          - task: DownloadBuildArtifacts@0
            inputs:
              buildType: 'current'
              downloadType: 'single'
              artifactName: 'drop'
              downloadPath: '$(Build.ArtifactStagingDirectory)'

          - task: VSTest@2
            inputs:
              testSelector: 'testAssemblies'
              testAssemblyVer2: '**\*test*.dll'
              searchFolder: '$(Build.ArtifactStagingDirectory)/drop'
              runSettingsFile: '$(Build.ArtifactStagingDirectory)/drop/SpecFlowProject1/test.runsettings'
              diagnosticsEnabled: true

Output:-

enter image description here

enter image description here

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.