Should We Build Before Testing or Test Before Building in CI/CD?

0
33
Asked By CuriousCoder98 On

I'm curious about the sequence of processes in a CI/CD pipeline. Should we build first and then run tests, or should we test before the build? I have my own take on this, but I'd love to hear other viewpoints and any reasons for choosing one order over the other.

5 Answers

Answered By TechWizard22 On

In an ideal setup, you'd want to run unit tests and other checks (like linting and static analysis) before building. This way, you avoid unnecessary builds if there are issues present. After the build, you can then run application tests, ultimately making your pipeline more efficient.

DevJourney94 -

Totally agree! It makes sense to save time by catching problems early in the process.

CodeSeeker77 -

But I guess it depends on the tools you're using, right? Some systems require a build to run any tests.

Answered By CodeGuru88 On

It really varies depending on what you're building. If it's software, I think it's better to test first, but if you're creating images or containers, testing pre-build could be beneficial since there are tools out there that let you do that easily.

DecisionMaker99 -

Interesting point! But I still think builds not depending on tests should be prioritized.

Answered By AgileAdvocate55 On

From an agile perspective, it's often more effective to have unit tests defined before building. This allows you to ensure code validity from the get-go, though real-world scenarios can complicate this.

CodeMaster22 -

Definitely true! You’re right that businesses often have to decide which testing approach fits their workflow.

Answered By BuildMaster3000 On

I like the idea of a build followed by testing. If your tests are mainly acceptance tests in a staging environment, then why not build and deploy quickly and take a lunch while it runs?

WorkHardPlayHard -

Exactly! As long as it works, I say go for it.

Answered By DevOpsNinja45 On

Honestly, it can be both ways, and running them in parallel could be the best approach. It all boils down to what you're trying to achieve and the specific tools you have at hand.

ParallelPioneer81 -

Absolutely! Tailoring your process based on your project needs seems to be the best plan.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.