ソフトウェアテスト [10] リファクタリング演演 習 Software Testing [10] Refactoring Exercise & Seminar あまん ひろひさ ひろひさ 阿萬 裕久 裕久( AMAN Hirohisa ) aman@ehime-u.ac.jp (C) 2007-2022 Hirohisa AMAN Exercise purpose Refactoring program to experience an d learn the importance of writing in an easy-to-understand manner Main contents Improve unorganized indentation, variabl e names, and function names in confusin g prog ram Improve long unorg anized program prog ram Reg ression testing along with refactoring (C) 2007-2022 Hirohisa AMAN Exercise content Exercise Refactor programs that are completely unor ganized for indentation, variable names, an d function names However, regression testing as well Exercise Refactor a given program Do regression testing as well (C) 2007-2022 Hirohisa AMAN Exercise (1/2) [Target program] sample1001.c This program is supposed to sort inte gers, but due to poor writing, it is incomprehensible content First, look at the specification spec1001 pdf Create test cases and run tests Wri te the contents in test-report1001.xls x (Think more than 5) (C) 2007-2022 Hirohisa AMAN Exercise (2/2) Note the following points in sample100 1.c Perf orm refactoring : Ind programentation Variable name Function name Add comments if necessary Then, test with the test cases you prepare test with the test cases you prepare d program (record programed program in test-report1001.xlsx) and program make sure that they work correctly even after refactoring (This is called program reg ression testing ) (C) 2007-2022 Hirohisa AMAN Submission of Exercise If you pair programming Submit to Teams with two people, both of you should submit the same thing sample1001.c and test-report1001.xlsx [10] Exercise-1 (Refactoring) Submission deadline: May 16, 13:00 (Vietnam time) (C) 2007-2022 Hirohisa AMAN Exercise (1/2) [Target program] sample1002.c This program is Binary and program d programecimal co nversion, test with the test cases you prepare but it is bad program writing First, look at the specification spec1002 pdf Create test cases and run tests Wri te the contents in test-report1002.xls x (Think more than 5) (C) 2007-2022 Hirohisa AMAN Exercise (2/2) Note the following points in sample100 2.c Perf orm refactoring : Split the contents of main function into functi ons Add comments Make variable names meaning ful if necessary Turn hard programcod programing into macros Then, test with the test cases you prepare test with the test cases you prepare d program (record programed program in test-report1002.xlsx) and program make sure that they work correctly even after refactoring (C) 2007-2022 Hirohisa AMAN Submission of Exercise If you pair programming Submit to Teams with two people, both of you should submit the same thing sample1002.c and test-report1002.xlsx [10] Exercise-2 (Refactoring) Submission deadline: May 22, 13:00 (Vietnam time) (C) 2007-2022 Hirohisa AMAN Survey In this exercise, you can it alone, or you can pair programming with people I want to know which one you chose, so please answer the survey first [10] Survey (you must answer first) (C) 2007-2022 Hirohisa AMAN 10