From 17705e459ebbd8a2c9776f148faf2086600ca020 Mon Sep 17 00:00:00 2001 From: nad Date: Wed, 10 Apr 2019 10:46:43 +0200 Subject: [PATCH] adding more functionality test rate v2 --- docs/score.rst | 5 +- ereuse_devicehub/resources/event/models.py | 70 +++++----- .../resources/event/rate/workbench/v2_0.py | 120 +++--------------- tests/test_rate_v2.py | 15 ++- 4 files changed, 72 insertions(+), 138 deletions(-) diff --git a/docs/score.rst b/docs/score.rst index d76dd5aa..9894d167 100644 --- a/docs/score.rst +++ b/docs/score.rst @@ -23,7 +23,7 @@ We define 5 categories to measure: • Functionality (F). Answers to “does the machine work well?” Condition tests fall in here. • Appearance (A). Aesthetic evaluation, surface deterioration. - • Quality (Q). How good is the machine, in terms of performance. Benchmarks, power, and characteristics fall here. The quality score, that represents the performance of the device, the functionality score, that based on the correct working of the buttons, audio and connectivity aspects, and the appaerance score, that focused on the aesthetics and cosmetics aspects like visual damage on screen, buttons or cabinet. + • Performance (Q). How good is the machine, in terms of performance. Benchmarks, power, and characteristics fall here. The quality score, that represents the performance of the device, the functionality score, that based on the correct working of the buttons, audio and connectivity aspects, and the appaerance score, that focused on the aesthetics and cosmetics aspects like visual damage on screen, buttons or cabinet. • Market value (MV). Perceived value, brand recognition, selling value. • Cost of repair, refurbish and manufacture. ( C ) @@ -111,6 +111,8 @@ Elements of effective testing include the following: • Test results must be retained after unit shipment or sale. + + **Example of Theorical Normals** Characteristics xMin xMax xMax-xMin @@ -135,4 +137,3 @@ Characteristics xMin xMax xMax-xMin - Camera Resolution 8 64 56 -// end \ No newline at end of file diff --git a/ereuse_devicehub/resources/event/models.py b/ereuse_devicehub/resources/event/models.py index 91d235ef..bdd86af4 100644 --- a/ereuse_devicehub/resources/event/models.py +++ b/ereuse_devicehub/resources/event/models.py @@ -546,6 +546,7 @@ class SnapshotRequest(db.Model): id = Column(UUID(as_uuid=True), ForeignKey(Snapshot.id), primary_key=True) request = Column(JSON, nullable=False) snapshot = relationship(Snapshot, + backref=backref('request', lazy=True, uselist=False, @@ -708,7 +709,7 @@ class TestAudio(Test): Test to check all this aspects related with audio functions, Manual Tests?? """ loudspeaker = Column(BDEnum(LoudspeakerRange)) - loudspeaker.comment = 'Range to determine if the speaker is working properly and what sound quality it has.' + loudspeaker.comment = 'Test to determine if the speaker is working properly and what sound quality it has.' microphone = Column(Boolean) microphone.comment = 'This evaluate if microphone works correctly' @@ -726,7 +727,8 @@ class TestConnectivity(Test): bluetooth.comment = 'Evaluate if bluetooth works' usb_port = Column(Boolean()) usb_port.comment = 'Evaluate if usb port was detected and charger plug works' - + locked = Column(Boolean) + locked.comment = 'Test to check if devices is locked' class TestBattery(Test): """ @@ -747,6 +749,21 @@ class TestCamera(Test): # TODO define when test FAIL """ camera = Column(Boolean) + camera.comment = "" + + +class TestKeyboard(Test): + """ + Test to determinate if keyboard layout are and works correctly + """ + keyboard = Column(Boolean) + keyboard.comment = "" + + +class TestTrackpad(Test): + """Test trackpad works correctly""" + trackpad = Column(Boolean) + trackpad.comment = "" class TestBios(Test): @@ -880,13 +897,7 @@ class RateComputer(Rate): # self.network_adapter = device.network_adapter.rate ... - COMPONENTS_WEIGHTS = [ - PROCESSOR_WEIGHT = 0.1, - RAM_WEIGHT = 0.25, - DATA_STORAGE_WEIGHT = 0.05, - GRAPHIC_CARD_WEIGHT = 0.1, - ... - ] + COMPONENTS_WEIGHTS.. return harmonic_mean(self.processor, self.ram, self.data_storage, self.graphic_card, ..., COMPONENTS_WEIGHTS) @@ -972,14 +983,14 @@ class RateLaptop(RateComputer): ... COMPONENTS_WEIGHTS = [ - PROCESSOR_WEIGHT = 0.1, - RAM_WEIGHT = 0.25, - DATA_STORAGE_WEIGHT = 0.05, - GRAPHIC_CARD_WEIGHT = 0.1, - DISPLAY_WEIGHT = 0.3, - BATTERY_WEIGHT = 0.25, - CAMERA_WEIGHT = 0.1, - ... + PROCESSOR_WEIGHT: 0.1, + RAM_WEIGHT: 0.25, + DATA_STORAGE_WEIGHT: 0.05, + GRAPHIC_CARD_WEIGHT: 0.1, + DISPLAY_WEIGHT: 0.3, + BATTERY_WEIGHT: 0.25, + CAMERA_WEIGHT: 0.1, + ... ... ] return harmonic_mean(self.processor, self.ram, self.data_storage, self.graphic_card, self.display, @@ -1074,10 +1085,10 @@ class RateMobile(Rate): CHARACTERISTIC_WEIGHTS = [ PROCESSOR_CHAR_WEIGHTS = 0.2, 0.4, 0.4 # cores, speed, benchmark - RAM_CHAR_WEIGHT = 0.3, 0.3, 0.4 # size, benchmark - DATA_STORAGE_CHAR_WEIGHT = 0.2, 0.4, 0.4 # size, speed, benchmark - GRAPHIC_CARD_CHAR_WEIGHT = 0.5, 0.5 # size, benchmark - DISPLAY_CHAR_WEIGHT = 0.4, 0.6 # size, resolution + RAM_CHAR_WEIGHT = 0.3, 0.3, 0.4 # size, benchmark + DATA_STORAGE_CHAR_WEIGHT = 0.2, 0.4, 0.4 # size, speed, benchmark + GRAPHIC_CARD_CHAR_WEIGHT = 0.5, 0.5 # size, benchmark + DISPLAY_CHAR_WEIGHT = 0.4, 0.6 # size, resolution ... ] @@ -1093,14 +1104,14 @@ class RateMobile(Rate): ... COMPONENTS_WEIGHTS = [ - PROCESSOR_WEIGHT = 0.1, - RAM_WEIGHT = 0.25, - DATA_STORAGE_WEIGHT = 0.05, - GRAPHIC_CARD_WEIGHT = 0.1, - DISPLAY_WEIGHT = 0.3, - BATTERY_WEIGHT = 0.25, - CAMERA_WEIGHT = 0.1, - ... + PROCESSOR_WEIGHT: 0.1, + RAM_WEIGHT: 0.25, + DATA_STORAGE_WEIGHT: 0.05, + GRAPHIC_CARD_WEIGHT: 0.1, + DISPLAY_WEIGHT: 0.3, + BATTERY_WEIGHT: 0.25, + CAMERA_WEIGHT: 0.1, + ... ] return harmonic_mean(self.processor, self.ram, self.data_storage, self.graphic_card, self.display, @@ -1162,6 +1173,7 @@ class RateMonitor(Rate): Main class to group by device type: Monitor Computer is broadly extended by ``ComputerMonitor``, ``TelevisionSet``, and `` Projector``. + Important: Aspect ratio is an important variable in screen features """ id = Column(UUID(as_uuid=True), ForeignKey(Rate.id), primary_key=True) diff --git a/ereuse_devicehub/resources/event/rate/workbench/v2_0.py b/ereuse_devicehub/resources/event/rate/workbench/v2_0.py index d7b380d8..5659c826 100644 --- a/ereuse_devicehub/resources/event/rate/workbench/v2_0.py +++ b/ereuse_devicehub/resources/event/rate/workbench/v2_0.py @@ -92,12 +92,26 @@ class FunctionalityRate(BaseRate): LOUDSPEAKER_WEIGHT = 0.15 MICROPHONE_WEIGHT = 0.15 - def compute(self, FunctionalityRate: FunctionalityRate): + @classmethod + def compute(cls, device: Device): """ :param FunctionalityDevice: List[Boolean] :return: """ + test_bios_power_on = device.last_event_of(TestBios).bios_power_on # type: bool + test_bios_power_on = int(test_bios_power_on) + + + test_battery = device.last_event_of(TestBattery) + test_audio + test_data_storage + + functionality = test_bios.bios_power_on * self.BIOS_WEIGHT + ... + return cls(funcionality=functionality) + + + # TODO Check if funcionality aspect is != NULL sim = FunctionalityDevice.sim * self.SIM_WEIGHT usb = FunctionalityDevice.usb * self.USB_WEIGHT @@ -127,110 +141,6 @@ class Appearance(Range): NONE = -0.3 -class FinalRate(Rate): - """The act of grading the appearance, quality (performance), and functionality - of a device. - - There are five categories of ``Rate``: - 1. ``Quality``. How good is the machine, in terms of performance. - 2. ``Functionality``. - 3. ``Appearance``. - 4. ``Market value``. - 5. ``Cost of repair``. - - There are types of rating a device: - - 1. Rate Quality - 2. Rate Functionality - 3. Rate Final - """ - quality_rate = QualityRate() - functionality_rate = FunctionalityRate() - appearance_rate = Appearance() - - final_rate = None - - # TODO Develop merge rate aspects (categories) - - """ MANUAL INPUT """ - manual_id = Column(UUID(as_uuid=True), ForeignKey(ManualRate.id)) - manual_id.comment = """The ManualEvent used to generate this - aggregation, or None if none used. - - An example of ManualEvent is using the web or the Android app - to rate a device. - """ - manual = relationship(ManualRate, - backref=backref('aggregate_rate_manual', - lazy=True, - order_by=lambda: ResultRate.created, - collection_class=OrderedSet), - primaryjoin=manual_id == ManualRate.id) - - """ WORKBENCH COMPUTER """ - workbench_computer_id = Column(UUID(as_uuid=True), ForeignKey(QualityRateComputer.id)) - workbench_computer_id.comment = """The WorkbenchRate used to generate - this aggregation, or None if none used. - """ - workbench_computer = relationship(QualityRateComputer, - backref=backref('aggregate_rate_workbench', - lazy=True, - order_by=lambda: ResultRate.created, - collection_class=OrderedSet), - primaryjoin=workbench_computer_id == QualityRateComputer.id) - - """ WORKBENCH MOBILE """ - - workbench_mobile_id = Column(UUID(as_uuid=True), ForeignKey(QualityRateMobile.id)) - workbench_mobile_id.comment = """The WorkbenchRate used to generate - this aggregation, or None if none used. - """ - workbench_mobile = relationship(QualityRateMobile, - backref=backref('aggregate_rate_workbench', - lazy=True, - order_by=lambda: ResultRate.created, - collection_class=OrderedSet), - primaryjoin=workbench_mobile_id == QualityRateMobile.id) - - def __init__(self, *args, **kwargs) -> None: - kwargs.setdefault('version', StrictVersion('1.0')) - super().__init__(*args, **kwargs) - - @classmethod - def quality_rate(cls, quality: QualityRate): - pass - - @classmethod - def functionality_rate(cls, func: FunctionalityRate): - pass - - @classmethod - def final_rate(cls, rate: Rate): - pass - - # Categories - - @classmethod - def quality_category(cls, quality: QualityRate): - pass - - @classmethod - def functionality_category(cls, quality: QualityRate): - pass - - @classmethod - def appearance_category(cls, quality: QualityRate): - pass - - @classmethod - def maket_value_category(cls, quality: QualityRate): - pass - - @classmethod - def cost_of_repair_category(cls, quality: QualityRate): - pass - - class DisplayRate(QualityRate): """ Calculate a DisplayRate diff --git a/tests/test_rate_v2.py b/tests/test_rate_v2.py index 8a71a119..9dcde103 100644 --- a/tests/test_rate_v2.py +++ b/tests/test_rate_v2.py @@ -119,13 +119,24 @@ def test_functionality_rate(): def test_functionality_rate_miss_tests(): """ Functionality Rate Test - Test to check if functionality rate compute correctly without complete information of test. + Test to check if functionality rate compute correctly with some test without any information. """ + pass -@pytest.mark.xfail(reason='Develop') +@pytest.mark.xfail(reason='Discuss') +def test_appearance_rate(): + """ + Test to check if compute correctly a new rate of a device, only with visual test + """ + pass + + +@pytest.mark.xfail(reason='Discuss') def test_update_rate_with_manual_rate(): """ Test to check if compute correctly a new rate of a device, if this device input after a manual rate (like visual test) Computing a new rate with old snapshot information score and aggregate a new test information score. """ + pass +