Giter VIP home page Giter VIP logo

assignment-2's Introduction

Test - Assignment 2

Assignment Link

Reflections

Computer Mouse

Identify the types of testing you would perform on a computer mouse, to make sure that it is of the highest quality.

  1. Does the mouse detects movement correctly (on the X and Y axis).
  2. Stresstest all the buttons and see if they still works after a thousand clicks on each button.
  3. Does the scroll-wheel still work after continious stress testing and after scrolling for X-amount of miles.
  4. Does the scroll-wheel detect clicks when pressing down on the wheel.
  5. Is the mouse cabable of detecting click and movement at the same time.
  6. Is the mouse cabable of detecting scroll and movement at the same time.

Catastrophe failure

Find a story where a software system defect had a bad outcome. Describe what happened. Can you identify a test that would have prevented it?

Two years ago a well-known code collaboration platform GitLab experienced a severe data loss which appeared to be one of the major outages in the IT world. GitLab originally used only one database server but decided to test a solution using two servers. They planned to copy the data from the production environment to the test environment.

In the process, the automatic mechanisms began to remove accounts from the database which were identified as dangerous. As a result of increased traffic, the data copying process began to slow down and then stopped completely due to data discrepancies. To add insult to injury, information from the production database was removed during the copying process.

After several attempts to resume the process, one of the employees decided to delete the test base and start the process again but accidentally deleted the production base. What made things even worse is that the directory holding the copies was empty too — the backups had not been made for a long time due to a configuration error.

What meant to be a standard procedure resulted in an 18-hour outage while the 300 GB of customer data was lost. According to the GitLab’s estimates, the company has lost data on at least 5,000 new projects, 5,000 comments, and 700 users. The company approach to this failure deserves respect.

Gitlab explained in detail what happened, broadcasted the restoration procedure on YouTube and published a list of improvements to ensure that this trouble would never happen again. But as they say — the damage is done.

I would have make the process automatic instead of manual, and then added a test to the function that would run on a mock database to see if the copying of data happened the way it should without any failure before even considering using it on the production environment.

Investigation Tools

JUnit 5

Investigate JUnit 5 (Jupiter). Explain the following, and how they are useful:

Annotations Usage
@Tag Used to tag classes for filtering
@Disabled Used to disable a test class or method
@RepeatedTest Indicates that a method is a test template for a repeated class
@BeforeEach, @AfterEach BeforeEach should be executed before each @Test. AfterEach should be executed after each @Test
@DisplayName Used for defining a custom display name for the test class or method
@Nested Indicates that the class is a non-static nested test class
assumeFalse, assumeTrue assumeTrue() If called with an expression evaluating to false, the test will halt and be ignored. assumeFalse() is the inverse of assumeTrue()

Mocking Frameworks

Investigate mocking frameworks for your preferred language. Choose at least two frameworks, and answer the questions. (One could be Mockito, which we saw in class.)
- What are their similarities?
- What are their differences?
- Which one would you prefer, if any, and why?

Mockito or EasyMock

  1. Simlarities Mockito allow the same level verification as EasyMock. They are essentially the same mocking framework, but EasyMock is built in a way that makes it easier to setup tests.

  2. Differences

xxxxxxxxxxxx Mockito EasyMock
Support test spies Mockito support both mock as well as spies EasyMock only supports mocks
Mocked method calls To mock we use Mockito.when(mock.method(args)).thenReturn(value) In EasyMock, the EasyMock.expect(mock.method(args)).andReturn(Value) method for mocking a method call.
Verifying Calls In Mockito, verify(mock).method(args) is used to verify calls In EasyMock, EasyMock.verify(mock) is used for verifying calls to a mock.
Exception throwing To throw execptions, the .thenThrow(ExceptionClass.class) is used after calling the Mockito.when(mock.method(args)) method To throw exceptions, .andThrow(new ExceptionClass()) is used after calling EasyMock.expect(..)
Accessibility In addition, Mockito can also mock private and final methods. EasyMock cannot mock final and private methods

In conclusion they are fairly similar, with the biggest difference being EasyMock not supporting spies and private/final methods.

assignment-2's People

Contributors

thomebsen avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.