plummbur_kruk 0.1.2

  • Installing
  • Versions
  • 4

Plummbur Kruk

A “real fake” HTTP server specially designed to support browsers tests that make HTTP requests.

Build Status

Getting Started

You'll need Dart.

Install this from pub as plummbur_kruk.

To start the plummbur_kruk server, use the script:

# Start the test server

The test server runs on port 31337.

To stop the server, use the script:

# Stop the server

Using with dart:html

A REST-like API is available at http://localhost:31337/widgets. The most common REST verbs will work: GET, POST, PUT, DELETE.

When testing browser code, it is not possible to access a running server. The Kruk server can be controlled through a simple client-side API.

To create a record, use:

static Future<HttpRequest> create(String json)

For example:

  var id;
  setUp(() {
    return Kruk.
      create('{"foo": 42}').
      then((res) {
        id = JSON.parse(res.responseText)['id'];

If you would like a one-request alias for /widgets, use Kruk.alias():

static Future<HttpRequest> alias(String old_url, {as: String})

To delete all record, use Kruk.deleteAll():

static Future<HttpRequest> deleteAll()

This is especially useful when deleting records in a unittest tearDown():

  tearDown(()=> Kruk.deleteAll());

As Part of a Test Runner

In a script, be sure to allow to run before exiting on failure:

# Start the test server
echo "starting test server"

echo "content_shell --dump-render-tree test/index.html"
results=`content_shell --dump-render-tree test/index.html 2>&1`

echo "$results"

# Stop the server

# check to see if DumpRenderTree tests
# fails, since it always returns 0
if [[ "$results" == *"Some tests failed"* ]]; then
    exit 1

if [[ "$results" == *"Exception: "* ]]; then
    exit 1

Address Already in Use

Sometimes it is possible for things to go quite wrong. If the file is deleted before the server shuts down, it needs to be stopped manually. The netstat command is your friend:

$ sudo netstat -nlp | grep 31337
tcp        0      0*               LISTEN      2879/dart
$ kill 2879


This software is licensed under the MIT License. See LICENSE for details.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  plummbur_kruk: "^0.1.2"

2. Install it

You can install packages from the command line:

with pub:

$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

      import 'package:plummbur_kruk/kruk.dart';

      import 'package:plummbur_kruk/server.dart';
Version Uploaded Documentation Archive
0.1.2 Dec 5, 2013 Go to the documentation of plummbur_kruk 0.1.2 Download plummbur_kruk 0.1.2 archive
0.1.1 Dec 4, 2013 Go to the documentation of plummbur_kruk 0.1.1 Download plummbur_kruk 0.1.1 archive
0.1.0 Nov 7, 2013 Go to the documentation of plummbur_kruk 0.1.0 Download plummbur_kruk 0.1.0 archive
0.0.7 Oct 10, 2013 Go to the documentation of plummbur_kruk 0.0.7 Download plummbur_kruk 0.0.7 archive
0.0.6 Sep 21, 2013 Go to the documentation of plummbur_kruk 0.0.6 Download plummbur_kruk 0.0.6 archive
0.0.5 Sep 2, 2013 Go to the documentation of plummbur_kruk 0.0.5 Download plummbur_kruk 0.0.5 archive
0.0.4 Aug 31, 2013 Go to the documentation of plummbur_kruk 0.0.4 Download plummbur_kruk 0.0.4 archive
0.0.3 Aug 31, 2013 Go to the documentation of plummbur_kruk 0.0.3 Download plummbur_kruk 0.0.3 archive
0.0.2 Aug 31, 2013 Go to the documentation of plummbur_kruk 0.0.2 Download plummbur_kruk 0.0.2 archive
0.0.1 Aug 31, 2013 Go to the documentation of plummbur_kruk 0.0.1 Download plummbur_kruk 0.0.1 archive


We analyzed this package on Jul 13, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0-dev.63.0
  • pana: 0.11.3


Describes how popular the package is relative to other packages. [more]
0 / 100
Code health derived from static analysis. [more]
14 / 100
Reflects how tidy and up-to-date the package is. [more]
0 / 100
Overall score:
Weighted score of the above. [more]
Learn more about scoring.


Detected platforms: web

Platform components identified in package: html, io.


  • Maintain

    Changelog entries help clients to follow the progress in your code.

  • Package is too old.

    The package was released more than two years ago.

  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 5 errors 7 warnings 17 hints.

    Strong-mode analysis of lib/kruk.dart failed with the following error:

    line: 9 col: 10
    Undefined class 'Future'.

    Strong-mode analysis of lib/server.dart failed with the following error:

    line: 261 col: 30
    The argument type 'int' can't be assigned to the parameter type 'String'.

  • The description is too short.

    Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

  • Package is pre-v1 release.

    While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction API.

  • Maintain an example.

    Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use plummbur_kruk.dart.


Package Constraint Resolved Available
Direct dependencies
ansicolor >=0.0.9 <0.0.10 0.0.9 0.1.1
browser >=0.9.0 <0.10.0 0.9.1 0.10.0+3
dirty >=0.1.3 <0.1.4 0.1.3 0.1.5
intl >=0.9.0 <0.9.1 0.9.0 0.15.6
uuid >=0.1.6 <0.1.7 0.1.6 1.0.1
Transitive dependencies
analyzer 0.10.5 0.32.3
args 0.9.0 1.4.3
charcode 1.1.2
collection 0.9.4 1.14.10
convert 1.1.1 2.0.1
crypto 0.9.2+1 2.0.6
logging 0.9.3 0.11.3+1
path 0.9.0 1.6.1
stack_trace 0.9.0 1.9.2
typed_data 1.1.5
unittest 0.11.7 0.12.4+1
unmodifiable_collection 0.9.2+1
Dev dependencies
scheduled_test any