ALL


  Stub Mixlib::ShellOut and shell_out in Ruby unit testing

Unit testing is part of software development to ensure the tiny component of a function can work as designed. Different frameworks and tools can be used to run unit testing for different programming languages. In Ruby, one popular unit testing framework is Rspec, or Chefspec if you are writing Chef recipes.While writing Chef recipes, some low level commands(DOS commands or shell commands) need to be executed on the managed resource to perform actions or gather information. For example, listing directory and files on an Unix system using ls command. Mixlib-Shellout can be used to execute o...

10,233 0       RUBY UNIT TESTING RSPEC CHEFSPEC SHELL_OUT


  Code coverage rate

When doing unit testing, the code coverage rate is often used as the criteria for measuring testing performance, even in some cases code coverage may be used to consider whether the testing task is completed or not. So testers need to spend much time on designing test cases which can cover as many codes as possible. There are advantages and disadvantages about using code coverage rate.First let's check what is code coverage rate:code coverage rate= the degree of code coverage in testing.There are some ways to measure the degree of code coverage. Here we introduce some common used ways:1. State...

3,144 0       UNIT TESTING CODE COVERAGE


  Writing unit tests for legacy code – an open letter to developers I work with

This is an email I sent today to developers who work with me, it is exactly as I wrote it except for project and developer names which I’ve redacted.Dear Developers,S asked me a difficult question today, and I think the answer (which took me a few minutes to arrive at) is worth sharing with all developers, mainly because many of you will surely face the exact same problem especially in [maintenance and enhancement] projects.By now I think it is crystal clear that one of our non-negotiable requirements for coding is that we write unit tests.For new projects it is easy – in fact fo...

10,258 0       UNIT TESTING OPEN LETTER