Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Test-driven Development: Prioritizing Unit Test Cases for Superior Code Quality, Study notes of Computer Science

Test-driven development (tdd), a software development practice that emphasizes writing tests before code. The article discusses the benefits and shortcomings of tdd, including its impact on code quality, the challenge of prioritizing test cases, and various approaches to addressing this issue. The document also includes references to relevant research and studies.

Typology: Study notes

2009/2010

Uploaded on 02/24/2010

koofers-user-z9a
koofers-user-z9a 🇺🇸

5

(3)

10 documents

1 / 10

Toggle sidebar

Related documents


Partial preview of the text

Download Test-driven Development: Prioritizing Unit Test Cases for Superior Code Quality and more Study notes Computer Science in PDF only on Docsity! Data Classification Test-driven development and prioritization of test case execution Team 4 Jim Kile, Don Little, and Samir Shah 2 Topic overview What is Test-driven development (TDD)? A practice of software development that involves the implementation of a system starting from the unit test cases of an object “If you can’t write a test for what you are about to code, then you shouldn’t even be thinking about coding” Lack of upfront design Applicability of the practice for code that is difficult to test using TDD (e.g. GUIs) Reliance on refactoring to achieve code understanding and manage complexity High skill level and experience requirements Program comprehension (especially useful for maintenance activities) Efficiency through continuous feedback Creation and availability of reusable test assets Reducing defect injection during development Perceived ShortcomingsPerceived Benefits 5 The prioritization problem [5] Given T, a test suite PT, the set of permutations of T f, a function from PT to the real numbers PT represents the set of all possible prioritizations (orderings of T), and f is a function that, applied to any such ordering, yields an award value for that ordering Higher award values are preferable to lower ones This is a search problem )]()()[)()((such that Find TfTfTTPTTTPTT ′′≥′′≠′′∈′′′′∀∈′ 6 “Greedy” approach Two of the articles propose a greedy algorithm [5, 8] to solve the prioritization issue Three step process to assign execution priority Step 1: Binary match to identify (Note: This is an example of an exhaustive search ) Old blocks of code Old modified blocks of code New blocks of code Step 2: Determine whether new versions are covered by an existing test Step 3: Prioritize the order of the selected test set (greedy search) 7 “Greedy” approach (continued) Find a short sequence of tests from the given test set such that as many of the impacted blocks as possible will be covered Assigns priority weights to each test equal to the number of impacted blocks it covers The test with the maximum weight is selected and then removed from the set and each case’s weight is re-calculated Algorithm [8]: while (any t in TestList covers any block in ImpactedBlkSet) { CurrBlkSet = ImpactedBlkSet Start a new sequence Seq while (any t in TestList covers any block in CurrBlkSet } { for each t in TestList compute { Weight(t) = count[CurrBlkSet ∩ Coverage(t)] } Select test t in TestList with maximum weight Add t to current sequence Seq Remove t from TestList CurrBlkSet = CurrBlkSet – Coverage (p) } } Put all remaining tests in TestList in a new sequence Seq
Docsity logo



Copyright © 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved