Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using python. On the course Moodle. you'll nd the following lets}: - statistics.py. which is an ADT covered in class and in the readings. For

Using python.

image text in transcribedimage text in transcribed
On the course Moodle. you'll nd the following lets}: - statistics.py. which is an ADT covered in class and in the readings. For your convenience. we re moved some of the calculations. and operations ie.g.. wart) and ssmpvsri). that were not relevant to this exercise. which would have made testing too onerous - tast_statistics .py. which is a test-script for the Statistics ADT. This test script currently only im plements a few basic tests. In this question you willcomplete the given test script. Study the test script. observing that each operation gets tested. Because each object is differentwe cannot check if an object is created correctly: instead. we will check ifthe initial values are correct. Likewise. methods like midi) cant be tested directly. because the object's attributes are private: all we can really do is check to see if the addii method has the right effect in combination with count (ii and meant}. Design new test cases for the operations. considering: - Whitebox test cases - Blackbox test cases. - Boundary test cases. and test case equivalence classes. a Test coverage. and degrees of testing. a Unit vs. Integration testing. Running your test script on the given ADT should report no errors. and should display nothing except the message 'ttt Test script completed I\" ' . Note: You will have to decide how many tests to include. This is part of the exercise. What to Hand In a A Python script named a4q'2_tasting. py containing your test script Be sure to include your name. NSID. student number. oourse number and section at the top of all docu ments. Evaluation - 5 marks: Your test cases for Statistics . asst} have good coverage. a 5 marks: Your test cases for Statistics . meant} have good coverage. class Statistics (object) : CN def _init_(self) : 4 self. _count = 0 # how many data values seen so far self . _avg = 0 # the running average so far def add (self value): 10 11 self. _count += 1 12 k = self . _count # convenience 13 diff = value - self . _avg # convenience 14 self . _avg += diff / k 15 16 17 def mean (self) : 18 19 return self. _avg 20 21 def count (self) : 22 23 return self.. count

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Dental Assisting

Authors: Doni Bird, Debbie Robinson

13th Edition

978-0323624855, 0323624855

Students also viewed these Programming questions