Smoke Testing Keeps Your Delivery Pipeline Safe and Sound
Smoke testing is a method to find major software flaws by using pipelines for CI/CD. It's a set of extremely low but extensive tests that test all the essential components of the software. Smoke testing is generally a economical operation.
This article we'll look at the roots of smoke testing, and how it can be utilized in the Continuous Integration as well as Continuous Delivery pipelines.
Smoke's origins in testing
The phrase "smoke test" originates from the field of electrical engineering. When the circuit of the electrical gadget is prepared for testing, it's connected to a source of power. If there is a major issue the circuit will begin burning immediately. This indicates that the system needs to be repaired before any further tests are conducted.
The same idea has been used in the development of software, in conjunction with the original definition.
What, and how should be testing?
Smoke testing can confirm if the system is sufficiently stable to go on to the next stage, i.e. to more precise tests. This is accomplished through testing the system's principal capabilities at a basic scale.
Smoke tests needn't be extensive. For instance, if we work on an online eCommerce web site We only need to verify that users can purchase a product. It is not necessary to check every detail and edge scenarios of the buying procedure.
Although it is normal to perform smoke tests on the most functions that are accessible to users of the application however, smoke tests can be suitable at various levels of abstraction across your system. The advantage of this approach to smoke testing at multiple levels is that you are able to spot flaws at a more specific and controlled scale. When working with distributed systems that have multiple teams, this could prove to be a significant time-saver.
Based on the type of test you are conducting, the steps you decide to take based on the results you receive can be very different. But, smoke tests should be swift to create a quick feedback loop. The benefit in a smoke testing is in the ability to fail quickly to ensure that you don't spend time and money on tests for acceptance and unit testing if there's a major issue within your project.
Tools that work well to write smoke tests can be quite easy to use. For instance, a simple curl api.myapp.com/is_alive is a good start. The ability to check the versions of installed dependencies by using a straightforward Bash script can be enough.
For more complicated checks, you can depend on a test library for your preferred programming language. If you're using Ruby for instance, and you want to test some aspects of your website You can test some Cucumber scenarios against your production version.
Smoke tests are part of the CI pipeline
The next obvious place to run testing a smoke test would be in the build phase. In this phase we create the executable binary artifact and run different types of tests. In most cases, we are able to reuse the same script to execute tests using the Git Hook smoke test.
The purpose of this test is to verify that the application is able to start up and perform basic functions however, this time in a clean environment the CI machine offers. It is recommended that you create the artifact only once (and just once) and test it through the time of the process. The test doesn't have to be comprehensive but it should be able to reveal significant issues.
Smoke tests are element of acceptance tests
Once the initial testing is completed then we can move on to more complex tasks like acceptance tests as well as end-to-end tests. These types of tests generally require a lot of time to setup and run since they require a production-like setting and interact with the application using the UI.
Due to this long runtime Acceptance tests that fail can be more difficult than other tests. Smoke testing offers another chance to fail quickly and help save time. Some well-placed smoke tests which verify the most crucial pathways for application can spot the most issues before we get into the final testing phase.
Smoke tests need to change as your business grows. They initially examine one or two crucial tasks and, with time increase in size to fulfill the goal of catching mistakes quickly and inexpensively. It is a bit of effort, but it can reduce effort and time.