Flank / flank-dashboard

Integrate with popular CI tools to collect software project metrics like performance, build stability, and codebase quality.
Apache License 2.0
27 stars 14 forks source link

Projects

This repository holds the source code of the following projects:

Let's review each of them in a bit more details:

:bar_chart: Metrics

Metrics is a set of software components to collect and review software project metrics like performance, build stability, and codebase quality.

The Metrics project integrates with the following CI tools to collect software project metrics:

The Metrics Web Application displays the next project metrics on the dashboard:

Metric Description
Build Status A graph indicator displaying the result of the latest build in front of the project's name.
Build Results A bar chart displaying the build results and duration of the last 30 builds.
Performance A sparkline graph displaying an average build duration of successful builds by the last 7 days, excluding the queue time.
Builds A scorecard displaying a count of performed builds of the project per week.
Stability A circular graph displaying a ratio of successful builds to finished builds for the last 30 builds.
Coverage A circular graph displaying a last successful build's code coverage percent.

See Project metrics definitions document to get more information about project metrics.

Metrics Dashboard

:test_tube: Api Mock Server

Api Mock Server is a package that provides an abstraction to create mock HTTP servers for testing 3-rd party API integrations. Consider the Third Party API Testing and Mock Server documents for more details.

Features

The API Mock server allows mocking the following real-server functionality:

Usage example Consider this short example on how to use the API Mock Server. Let's assume that we have the following API client with the `fetchBar` method we should cover with tests: ```dart import 'package:http/http.dart' as http; class TestClient { final String apiUrl; const TestClient(this.apiUrl); Future fetchBar() async { final response = await http.get('$apiUrl/foo'); if (response.statusCode != 200) return null; return response.body; } } ``` Then, we should implement the mock server to test the desired client. The following `MockServer` implements the API Mock Server and mocks the behavior of the real server: ```dart class MockServer extends ApiMockServer { @override List get handlers => [ RequestHandler.get( pathMatcher: ExactPathMatcher('/foo'), dispatcher: _fooHandler, ), ]; Future _fooHandler(HttpRequest request) async { request.response.write('bar'); await request.response.flush(); await request.response.close(); } } ``` Finally, `start` the implemented mock server and provide the base path to the client under tests (`TestClient` in our case). To prevent memory leaks, close the server after all tests are finished. We should test the `fetchBar` method as follows: ```dart void main() { group("TestClient", () { final mockServer = MockServer(); TestClient client; setUpAll(() async { await mockServer.start(); client = TestClient(mockServer.url); }); tearDownAll(() async { await mockServer.close(); }); test( ".fetchBar() returns 'bar'", () async { const expectedResponse = 'bar'; final actualResponse = await client.fetchBar(); expect(actualResponse, equals(expectedResponse)); }, ); }); } ```

:shield: Guardian

Guardian is a tool designed for detecting flaky tests by analyzing JUnit XML reports and notifying the team about the results. This tool accepts the actual reports and compares them to the stored results in a database. If the test is considered flaky, Guardian notifies the team using Slack and/or Jira integrations.

Features:

:shell: Shell Words

Shell Words is a package that provides tools for parsing the command-line strings.

Features

Usage example Consider this short example on how to use the shell words parser. ```dart import 'package:shell_words/shell_words.dart'; void main() { final shellWords = split('cd foo/bar --some-flag=flag'); print(shellWords.words); // [cd, foo/bar, --some-flag=flag] print(shellWords.error); // any occurred error } ```

:world_map: YAML Map

YAML Map is a wrapper around Dart's yaml package that simplifies working with YAML documents.

Features

Usage example Consider this short example on how to use the main `YamlMapParser` and `YamlMapFormatter` classes: ```dart import 'package:yaml_map/src/yaml_map_formatter.dart'; import 'package:yaml_map/src/yaml_map_parser.dart'; void main() { const yaml = ''' foo: bar: baz: 1 '''; const yamlMapParser = YamlMapParser(); final parsedYaml = yamlMapParser.parse(yaml); print(parsedYaml); // {foo: {bar: {baz: 1}}} print(parsedYaml['foo']); // {bar: {baz: 1}} print(parsedYaml['foo']['bar']); // {baz: 1} print(parsedYaml['foo']['bar']['baz']); // 1 final yamlFormatter = YamlMapFormatter(); print(yamlFormatter.format(parsedYaml)); // foo: // bar: // baz: 1 } ```

Contributing

Consider these useful links that may help you to get started:

  1. GitHub Agile process :chart_with_upwards_trend:
  2. Dart code style :nail_care:
  3. Collaboration :raised_hands:
  4. Effective Dart :dart:

:scroll: License

Licensed under the terms of the Apache 2.0 License that can be found in the LICENSE file.

Consider the Dependencies Licenses document that describes the licenses for all 3-rd party libraries used in projects of this repository.