Unit 11 - Product quality: verification, metrics and testing Flashcards
What does TDD (Test Driven Development) demand?
Before any code is written, tests should be written for that code to meet. Just enough code should then be written to pass those tests – then further tests should be written and so on. On each iteration all of the tests should be run.
What advantage does running all test on each iteration have?
This approach has the major advantage that as development proceeds, and after any change, a complete suite of tests can be run at the press of a button
How does TDD help the design process?
In practical terms, TDD eases the process of making changes to code at late stages in development, simply because the accumulated tests provide assurance that changes have not broken the code. In object-oriented contexts this whole approach is generally relatively convenient to manage due to the existence of unit testing frameworks such as JUnit.
How do Pre- and postconditions in DbC differ from unit tests in TDD?
Pre- and postconditions, like the unit tests of TDD, are a form of executable documentation. Unlike unit tests, they focus on invariant conditions rather than on test cases. Some of the benefits of using assertions can be enjoyed whether or not DbC is applied strictly, such as the use of assertions to identify how and where problems arise at run-time.
Define appropriate quality
Software that is fit for its purpose and of sufficiently high quality. One way of characterising the
notion of appropriate quality is to say that it is in conformance to the requirements and expectations of the customer.
What can we check to establish if quality is appropriate?
. how the product operates against what was both explicitly required and implicitly expected by the customer
. that quality and development standards – whether in-house rules or ISO 9000 mandated practices – have been followed
. that best practice of software engineers, as professionals operating to professional standards, has been followed during development.
Suggest three expectations that a customer might have of a software product without perhaps being aware of them.
Three possibilities are:
. the product will not conflict with other software that they use
. the product will boost productivity
. the product will be simple to use.
Software Quality Factors (SQFs) can be grouped into six classes. What are they?
Functionality, reliability, usability, efficiency, maintainability and portability.
SQFs affected by product operation requirements include?
SQFs affected by product operation requirements include:
. correctness: how well a system fulfils the customer’s overall objectives – how well the software does what the customer wants
. reliability: the likelihood with which a system can be expected to perform its intended function – how well the software does what it is supposed to do
. efficiency: the level of computing resources (including time) required by a system to perform its function – how well it runs on the customer’s hardware
. integrity: the strength of measures to ensure that modification or deletion of data by unauthorised persons (or by any other unintended means) does
not occur
. usability: the effort required to learn about, operate, prepare input for and interpret the output of a system – how easy the system is to use.
SQFs affected by product revision requirements include?
. maintainability: the effort required to deal with expected changes and to understand, locate and fix errors in a system
. flexibility: the effort required to modify an operational system – how easily the system can be changed while in service
. testability: the effort required to test a system to ensure that it performs its intended function. Different kinds of testing may vary according to how easy they are to adapt when requirements are revised.
SQFs affected by product transition requirements include?
. portability: the effort required to transfer the system from one hardware platform and/or software environment to another – how easily the system
can be used on another machine should the customer change their platform or should other customers require it
. reusability: the extent to which a system (or system component) can be reused in other applications – how easy it is to reuse some of the software to make future developments more cost effective
. interoperability: the effort required to couple one system to another – how easy it is to interface the system with another, should the customer require it.
Explain how increasing integrity within a system could affect efficiency.
Increasing integrity within a system means strengthening measures to ensure that modification or deletion of data by unauthorised persons, or by any other unintended means, does not occur. This might
involve the use of passwords to access certain data and an authentication server to check a user’s identity, or it might mean that network traffic needs to be encrypted and decrypted. Each of these factors adds an overhead to processing, so efficiency is likely to be
reduced
Identify one other pair of SQFs that are not independent
Another pair of SQFs that are not independent is usability and portability. For example, many of the features of the Apple Macintosh that contribute to its reputation for usability are built into its operating system. Applications that take advantage of these features are less portable to other systems, such as Windows or Linux.
What are the four SQFs of primary importance?
. Correctness. A popular measure for assessing correctness is defects per thousand lines of code (defects per KLOC), where a defect may be defined
as a verified lack of conformance to requirements. Defects may be identified by testers or reported by users of a software product after the product has been released for general use. In the case of a large project
they may be counted over a standard period of time, for example one month.
. Integrity. This is measured by considering the proportion of ‘attacks’ on a product as opposed to bona fide uses. In cases where integrity is of great
importance, and different kinds of attack can be identified, it can be useful to measure or estimate quantities such as the likelihood that an attack of a
given type will occur within a given time and the likelihood that an attack of a given type will be repelled. If historical data is available that allows
these probabilities to be calculated with some accuracy, for example using information from a log file, then it becomes possible to assign numerical
values in a simple way to the integrity of a system.
. Maintainability. Unfortunately there is no way to measure maintainability directly, and so we must measure it indirectly. A simple measure is mean
time to change (MTTC), which is the average of the times it takes to analyse a bug report, design an appropriate modification, implement the change, test it and distribute the change to all users. In general, the lower the MTTC (for equivalent types of changes), the more maintainable the software product is.
. Usability: any system with a user interface and that will be used by people other than the developers should be usability tested. Usability testing involves users systematically trying out the user interface and the
system behind it – although for some purposes the system may be simulated. There are also forms of evaluation such as heuristic review that can be used to make substantial improvements to user interfaces without involving users. For any system that depends on how users will interact with it, user interface design and testing should be continual engineering
focuses.
What is validation?
Validation is concerned with whether the right product is being built.
Validation does not assume that either the specifications or development processes are adequate. Validation focuses on ensuring that outputs meet the needs, including implicit needs and expectations of
customers and stakeholders. These may never have been written down. For this reason validation is generally harder than verification. Validation can
have far-reaching effects and can result in changes to specifications or organisational processes, or both. Validation ultimately depends on acceptance by customers.
What is verification?
Verification concerns whether the product is built in the right way.
Verification assumes that the current specifications are
correct and focuses on ensuring that development processes produce outputs that meet the specifications. More specifically, verification tests the extent to which the product conforms with the various, often evolving, system descriptions designed to help produce it.
Verification of a system involves which two tasks?
. ensuring that all system descriptions are self-consistent
. ensuring that all system descriptions are consistent and complete with respect to those from which they were derived.
Validation comprises?
. ensuring that all system descriptions are consistent with the customer’s requirements, including implicit requirements.
Give a simple example of two system descriptions that might contradict each other.
There are numerous possibilities. One elementary example would be if a structural model for a hotel reservation system indicated that a reservation
could be made for more that one room but the implementation only allowed one room per reservation.
Why is it important for the customer’s requirements statement to be self consistent?
If the customer’s requirement statement lacks self consistency, then either the resulting system will be inconsistent or it will not satisfy the customer’s requirements. The system builders can decide (implicitly or explicitly) how to resolve the inconsistencies or, if the inconsistent
requirements affect different parts of the system and are not picked up by the developers, the developers could inadvertently build the inconsistencies into the product.
List some approaches that can be used to promote testing throughout development
. prototyping (the rapid creation of exploratory software artefacts that are discarded after evaluation)
. iterative approaches (where early software artefacts are built on rather than discarded)
. frameworks such as the dynamic systems development method (DSDM) – promoted by the not-for-profit, vendor-independent DSDM Consortium –
which documents best practice processes for iterative and incremental development.
What is unit testing usually performed on?
Unit testing is usually performed on classes, with the focus on the systematic testing of methods using test cases.
Explain Test-driven development in nutshell?
In TDD, code is written in very small increments – of the order of no more than five or ten lines of code.
But crucially, no code is written without first
devising and writing an automated test case for each code increment.
The essence of the cycle is as follows: 1 Decide on a code increment. 2 Decide on a test. 3 Write the test. 4 Run all tests, expecting the new test to fail (so that you know that the test has ‘teeth’). 5 Write the code. 6 Run all the tests and succeed.
What are the benefits of TDD?
TDD is claimed to bring many benefits, including the following:
. Test coverage: Test coverage is in some respects comprehensive, with virtually all code having associated tests. These tests should all have been run successfully throughout development. Finished code therefore already has an extensive test suite.
. Regression testing and early discovery of errors: Many kinds of error are discovered and corrected at the earliest opportunity. Changes that break tests can be quickly identified and rectified.
. Executable documentation: The tests both show how the code should be used and indicate what it should do by means of test cases.
. Beneficial effect on design: The writing of tests contributes to design as well as to testing. TDD encourages clarity, modularity and a focus on
interface over implementation.
. Complementarity with DbC: TDD tests by test cases, whereas DbC tests by invariants. These perspectives are usefully complementary.
. Promotes good code quality: TDD promotes sustained focus on quality, design for testability and early and frequent refactoring.
. Inhibition of ‘featuritis’: Because addition of extraneous code is discouraged during TDD cycles, creeping featuritis – the addition of unnecessary features – is inhibited.