Skip to content

Tool to test flash memory devices (usb stick, sd card)

So, i bought a usb stick for damn low price. I assumed it won't have the size but anyway, the price was low, i had some money in the pocket so i tried this delicious fruit of joy and fun.

As expected, the size doesn't fit and i can not format the stick without any errors. So i searched for a tool to test this sort of devices. After a while i found f3.

Whats the real size of my memory stick you going to ask? Well, i will keep this as a secret and won't try something like this again ;-).

Translate to de es fr it pt ja

FrOSCon - Test Proxies: How Problems Became Features

By Sebastian Bergman and Arne Blankerts.
Keep your eyes up and stay tuned for "patch coverage".
Second time, thanks for the book - handed over by sebastian himself. Mister HowTrueIsFalse, you will get back your book soon :-).

What Is The Talk About

Integration tests closing the gap between unit tests and system tests. This is resolved by keep the focus on interfaces between components and testing that the interaction between the components is working as expected.

Arne Blankerts and Sebastian Bergman showing how a problem by setting up the integration tests became a feature aka "Test Proxies" for PHPUnit.

They also discuss problems and provide solutions for implementing mock objects in php unit and how to ship them as features.

How To Visualize

How lower you go, the faster and the exact the tested code behaves. How higher you go, the more you can provide a stable and general testcase.

  • business
  • technology

  • ui

  • service
  • unit

Isolation, speed (top down) vs Confidence in whole system (bottom up) from how google tests software * large * medium * small

Terms

Test one unit is a unit test.

Write a test between two units is more a integration test than a unit test. Current idea is to stub or mock one of the two units and see how other unit acts.

Push the idea of stubbing and mocking more to the edge will lead to "edge to edge test" like "client to server test". In general, try to test components on the same level (layer).
Try to monitor systems for load tests and use appdynamcis or xdebug and xhprof.

Example

<?php
namespace Company\Project

class SampleWorkflow
{
    private $backend;
    private $service;

    public function __construct(Backend $backend, Service $service)
    {
        $this->backend = $backend;
        $this->service = $service;
    }

    public function execute(Request $request)
        $this->service->workflow(
            $this->backend->getObjectById($request->getValue('id));
        );
    }
}

How to test this?

Would be cool if we can log that code was executed like test proxies by adding an extra flag to the mock builder.
Provides way to see where dataflow changed or drifts from expected way (will be in PHPUnit 3.8-).

<?php
namespace Company\Project

use PHPUnitFrameworkTestCase;

class SampleWorkflowTest extends PHPUnitFrameworkTestCase { public function testServiceCallUpdatesObjects() { $service = $this->getMockBuilder('Service') ->enableProxyingToOriginalMethods() ->getMock();

    $service-&gt;expects($this-&gt;once())
        -&gt;method('doWork');

    $backend = new Backend();
    $workflow = new SampleWorkflow($backend, $service);

    $workflow-&gt;execute(new Request(array('id' =&gt; 42)));
}

}

Translate to de es fr it pt ja