There is a statement from microsoft documentation about Selenium testing in a continuous integration pipeline:

To include the Selenium test as part of a build, the source code must be in version control.


The build summary includes a snapshot of the test results. There is also a Tests results page that highlights the build-on-build changes, including errors, stack traces, and the ability to easily create a bug that contains this information.

Selenium tests use graphical interface, so I do not think that they could be used on build stage, because application is not deployed yet. Am I right?

4 Answers 4


I think you are confusing "build" vs "build-stage"

A build is a the full chain, for example:

  • Get code from source control
  • Build-code (this is I think what you call the build-stage)
  • Run unit-tests
  • Package API, Website and Sync-Services
  • Deploy to test-environment in the cloud
  • Run Selenium-tests

This is what our team calls the build, this is run for each commit into our test branch and is called the test-build.


When they are talking about source code in the information snippet, its about the selenium code which is designed for testing the Web Application. You need to have it in version control.

Assuming that most of the people have source code version controlled. Taking Github as a version control you would provide the GitHub URL of the repo to your CI tool such as Jenkins. it would request you to provide that URL.

Once URL is configured you can trigger the build once the dev deploys their build in AUT.


Selenium tests use graphical interfaces.

They can be used on staging because there will be a program that calls each UI test. Each test will then create a browser instance and run the code in that instance. When the test is finished the browser instance closes and the program which is running that test records the results, potentially including screen shows in the case of failure.

The individual code for tests that is run needs to be available to the infrastructure programs that are running the tests and is typically in source control.

  1. Selenium tests can be used in a build stage, despite seemingly needing a graphical user interface. You can accomplish via using google chrome, but activating "headless" mode when constructing Selenium capabilities object. Multiple ways to handle this strategy, such as https://intoli.com/blog/running-selenium-with-headless-chrome/. You can also use a service such as Browser Stack https://www.browserstack.com/ or Sauce Labs https://saucelabs.com/ to allow Selenium Tests to launch browsers on remote computers in the cloud.

  2. "so I do not think that they could be used on build stage, because application is not deployed yet" -- this depends on your test automation setup. If you have your selenium tests in the same code base as the System Under Test (SUT), then you could start the server within the build so that the application is available at "localhost" and then test it. Or you could optionally use a docker container to run the local server (the SUT) (accomplishing starting the server), and then test the pre-deployed application. Those are the major solutions for testing a pre-deployed application. Another option is to put the Selenium Tests in the same build that deploys the application, but put the Selenium Tests in a build step after the deployment.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.