# Fundamentally, how does CircleCI run tests for a PR?

**URL:** <https://discuss.circleci.com/t/fundamentally-how-does-circleci-run-tests-for-a-pr/28497>\
**Category:** Running Tests\
**Created:** [February 20, 2019, 2:41pm UTC](https://discuss.circleci.com/t/fundamentally-how-does-circleci-run-tests-for-a-pr/28497 "2019-02-20T14:41:30Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![thomas-ncino](https://avatars.discourse-cdn.com/v4/letter/t/2bfe46/32.png) [@thomas-ncino](https://discuss.circleci.com/u/thomas-ncino)\
**Post date:** [February 20, 2019, 2:41pm UTC](https://discuss.circleci.com/t/fundamentally-how-does-circleci-run-tests-for-a-pr/28497/1 "2019-02-20T14:41:30Z")

</div>

Hello! I just have a brief formality question pertaining to how CircleCI runs pull request testing. For example, I have specified the branches, dev, qa, and prod, to have tests executed when anyone commits or pull requests to those branches.

If I create a new branch using the dev base, naming it dev-update, and make commits to dev-update… it shouldn’t require the [ci skip] command to skip running the CircleCI tests (because it wasn’t specified as a branch in the config.yml); however, if I merged dev-update into the dev branch it won’t have any tests for dev-update to pass, but it will try to run the tests against dev when the pull request is completed… correct?

I’m writing documentation for my team, and want to ensure I personally have the full grasp for the tool. Before using the branches parameter in the config.yml, we originally had if statements in our bash scripts to ensure it was building the proper branch-- so we would always receive a “tests passed” notification for any branch that wasn’t dev, qa, or prod because the if statements wouldn’t execute.

Was everything I said here correct?

---

<div class="post-metadata">

**Author:** ![drazisil](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/drazisil/32/24029_2.png) [@drazisil](https://discuss.circleci.com/u/drazisil)\
**Post date:** [February 20, 2019, 3:09pm UTC](https://discuss.circleci.com/t/fundamentally-how-does-circleci-run-tests-for-a-pr/28497/2 "2019-02-20T15:09:48Z")

</div>

Hi Thomas,

This sounds mostly correct. You didn’t mention if you were using branch whitelisting, but you did mention the `config.yml` so I’m assuming you are.

In that case, assuming forked PRs aren’t involved, CircleCI will only run builds against the target branches listed, regardless of where the PR is coming from. [https://circleci.com/docs/2.0/configuration-reference/#branches](https://circleci.com/docs/2.0/configuration-reference/#branches)

If you can think of improvements to our own docs please open an issue or PR and we would be happy to make them clearer.

---

<div class="post-metadata">

**Author:** ![thomas-ncino](https://avatars.discourse-cdn.com/v4/letter/t/2bfe46/32.png) [@thomas-ncino](https://discuss.circleci.com/u/thomas-ncino)\
**Post date:** [February 20, 2019, 3:35pm UTC](https://discuss.circleci.com/t/fundamentally-how-does-circleci-run-tests-for-a-pr/28497/3 "2019-02-20T15:35:43Z")

</div>

Thanks for your response @drazisil! I apologize for not being clear the first time: I am using branch whitelisting to specify the specific branches as of now. My team and I didn’t know it existed until now, so we are beginning to use it. Before, we just used if statements.

We never fork PRs; however, if we whitelisted the branches dev & prod and performed a pull request from dev into prod (prod \<- dev) would it try to build both branches after the PR was merged-- or would it only build prod? I know that, on the PR screen, it will display “Checks passed” if the previous commit to the branch was successful-- unless I’m mistaken?

Point being, if we were to ever perform a PR merging the prod branch into another that isn’t whitelisted… would it attempt to build prod?

randomBranch \<- prod

Or would nothing happen since randomBranch isn’t whitelisted?

---

<div class="post-metadata">

**Author:** ![drazisil](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/drazisil/32/24029_2.png) [@drazisil](https://discuss.circleci.com/u/drazisil)\
**Post date:** [February 20, 2019, 3:40pm UTC](https://discuss.circleci.com/t/fundamentally-how-does-circleci-run-tests-for-a-pr/28497/4 "2019-02-20T15:40:19Z")

</div>

Good question. We build on commits, so since you would just be doing a merge and not adding any new commits I don’t believe prod would build again since that commit had already run on CircleCI

---

<div class="post-metadata">

**Author:** ![thomas-ncino](https://avatars.discourse-cdn.com/v4/letter/t/2bfe46/32.png) [@thomas-ncino](https://discuss.circleci.com/u/thomas-ncino)\
**Post date:** [February 20, 2019, 4:46pm UTC](https://discuss.circleci.com/t/fundamentally-how-does-circleci-run-tests-for-a-pr/28497/5 "2019-02-20T16:46:21Z")

</div>

Thanks for all your help!

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/circleci/original/3X/5/1/511608acda8e85906e15909b57bd0a46c1dbe291.png) [@system](https://discuss.circleci.com/u/system)\
**Post date:** [March 2, 2019, 4:59pm UTC](https://discuss.circleci.com/t/fundamentally-how-does-circleci-run-tests-for-a-pr/28497/6 "2019-03-02T16:59:35Z")

</div>

Closed on March 2, 2019, 4:59pm UTC

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.
