Skip to content

Commit c4561cb

Browse files
committed
Merge branch 'release/v0.4.2'.
2 parents 6abf35d + 6166f57 commit c4561cb

8 files changed

Lines changed: 202 additions & 29 deletions

File tree

.travis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,6 @@ before_install:
2525
- echo "====== DEPENDENCIES - End ======"
2626
jdk:
2727
- oraclejdk8
28+
script: "mvn cobertura:cobertura"
29+
after_success:
30+
- bash <(curl -s https://codecov.io/bash)

README.md

Lines changed: 47 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@ What you think is what you test... Not yet another testing API or framework!
22

33
Matter | Badges
44
------ | ------
5-
Software factory | [![Maven Central](https://img.shields.io/maven-central/v/org.apache.maven/apache-maven.svg)](https://search.maven.org/#artifactdetails%7Ccom.github.xapn%7Ctest-as-you-think-core%7C0.4%7C) [![Build Status for master](https://travis-ci.org/xapn/test-as-you-think.svg?branch=master)](https://travis-ci.org/xapn/test-as-you-think) [![Build Status for develop](https://travis-ci.org/xapn/test-as-you-think.svg?branch=develop)](https://travis-ci.org/xapn/test-as-you-think) [![Javadocs](http://javadoc.io/badge/com.github.xapn/test-as-you-think-core.svg?color=orange)](http://javadoc.io/doc/com.github.xapn/test-as-you-think-core) [![License: GNU LGPL v3](https://img.shields.io/badge/License-LGPL%20v3-blue.svg)](http://www.gnu.org/licenses/lgpl-3.0)
5+
Software factory | [![Maven Central](https://img.shields.io/maven-central/v/com.github.xapn/test-as-you-think-project.svg)](http://search.maven.org/#search%7Cga%7C1%7Ctest-as-you-think) master: { [![Build Status for master](https://travis-ci.org/xapn/test-as-you-think.svg?branch=master)](https://travis-ci.org/xapn/test-as-you-think), [![codecov](https://codecov.io/gh/xapn/test-as-you-think/branch/master/graph/badge.svg)](https://codecov.io/gh/xapn/test-as-you-think) } develop: { [![Build Status for develop](https://travis-ci.org/xapn/test-as-you-think.svg?branch=develop)](https://travis-ci.org/xapn/test-as-you-think), [![codecov](https://codecov.io/gh/xapn/test-as-you-think/branch/develop/graph/badge.svg)](https://codecov.io/gh/xapn/test-as-you-think/branch/develop) } [![Javadocs](http://javadoc.io/badge/com.github.xapn/test-as-you-think-core.svg?color=orange)](http://javadoc.io/doc/com.github.xapn/test-as-you-think-core)
66
Source code | [![LoC](https://tokei.rs/b1/github/xapn/test-as-you-think?category=code)](https://github.com/xapn/test-as-you-think) [![Files](https://tokei.rs/b1/github/xapn/test-as-you-think?category=files)](https://github.com/xapn/test-as-you-think) [![Total lines](https://tokei.rs/b1/github/xapn/test-as-you-think?category=lines)](https://github.com/xapn/test-as-you-think) [![Comments](https://tokei.rs/b1/github/xapn/test-as-you-think?category=comments)](https://github.com/xapn/test-as-you-think) [![Blank lines](https://tokei.rs/b1/github/xapn/test-as-you-think?category=blanks)](https://github.com/xapn/test-as-you-think)
7-
Social | [![Twitter URL](https://img.shields.io/twitter/url/http/shields.io.svg?style=social)](https://twitter.com/search?q=%23TestAsYouThink) [![Twitter Follow](https://img.shields.io/twitter/follow/espadrine.svg?style=social&label=Follow)](https://twitter.com/XEngineer) [![GitHub stars](https://img.shields.io/github/stars/badges/shields.svg?style=social&label=Star)](https://github.com/xapn/test-as-you-think/stargazers) [![GitHub watchers](https://img.shields.io/github/watchers/badges/shields.svg?style=social&label=Watch)](https://github.com/xapn/test-as-you-think/watchers) [![GitHub forks](https://img.shields.io/github/forks/badges/shields.svg?style=social&label=Fork)](https://github.com/xapn/test-as-you-think)
7+
Licensing | [![License: GNU LGPL v3](https://img.shields.io/badge/License-LGPL%20v3-blue.svg)](http://www.gnu.org/licenses/lgpl-3.0) [![GitHub contributors](https://img.shields.io/github/contributors/xapn/test-as-you-think.svg)](https://github.com/xapn/test-as-you-think/graphs/contributors)
8+
Social coding | [![Twitter URL](https://img.shields.io/twitter/url/https/github.com/xapn/test-as-you-think.svg?style=social)](https://twitter.com/intent/tweet?text=Wow:&url=https%3A%2F%2Fgoo.gl%2FXqS4Zf) [![Twitter Follow](https://img.shields.io/twitter/follow/xengineer.svg?style=social&label=Follow)](https://twitter.com/intent/follow?screen_name=xengineer) [![GitHub stars](https://img.shields.io/github/stars/xapn/test-as-you-think.svg?style=social&label=Star)](https://github.com/xapn/test-as-you-think/stargazers) [![GitHub watchers](https://img.shields.io/github/watchers/xapn/test-as-you-think.svg?style=social&label=Watch)](https://github.com/xapn/test-as-you-think/watchers) [![GitHub forks](https://img.shields.io/github/forks/xapn/test-as-you-think.svg?style=social&label=Fork)](https://github.com/xapn/test-as-you-think/network)
9+
10+
Please use this [permalink](https://goo.gl/XqS4Zf) to share this web page and to get [analytics data](https://goo.gl/#analytics/goo.gl/XqS4Zf/all_time). You can also use this [QR code](https://chart.googleapis.com/chart?cht=qr&chs=150x150&choe=UTF-8&chld=H&chl=https://goo.gl/XqS4Zf).
11+
![QR code](https://chart.googleapis.com/chart?cht=qr&chs=150x150&choe=UTF-8&chld=H&chl=https://goo.gl/XqS4Zf)
812

913
<!-- toc -->
1014

@@ -26,11 +30,16 @@ Social | [![Twitter URL](https://img.shields.io/twitter/url/http/sh
2630
- [Expected failures](#expected-failures)
2731
- [Unexpected failures](#unexpected-failures)
2832
+ [Time limit](#time-limit)
29-
- [Release Notes](#release-notes)
30-
* [Version 0.4: Time limit as an expectation](#version-04-time-limit-as-an-expectation)
31-
* [Version 0.3: TestAsYouThink as a Maven distributed OSS library](#version-03-testasyouthink-as-a-maven-distributed-oss-library)
32-
* [Version 0.2: Test fixtures as method arguments](#version-02-test-fixtures-as-method-arguments)
33-
* [Version 0.1: Given-When-Then as a canvas](#version-01-given-when-then-as-a-canvas)
33+
- [Code Examples](#code-examples)
34+
- [Releases](#releases)
35+
* [Versioning](#versioning)
36+
* [Release Notes](#release-notes)
37+
+ [0.4.2 version: Cobertura as a code coverage analyzer](#042-version-cobertura-as-a-code-coverage-analyzer)
38+
+ [0.4.1 version: Travis CI as a continuous integration platform](#041-version-travis-ci-as-a-continuous-integration-platform)
39+
+ [0.4 version: Time limit as an expectation](#04-version-time-limit-as-an-expectation)
40+
+ [0.3 version: TestAsYouThink as a Maven distributed OSS library](#03-version-testasyouthink-as-a-maven-distributed-oss-library)
41+
+ [0.2 version: Method arguments as test fixtures](#02-version-method-arguments-as-test-fixtures)
42+
+ [0.1 version: Given-When-Then as a canvas](#01-version-given-when-then-as-a-canvas)
3443
- [License](#license)
3544

3645
<!-- tocstop -->
@@ -46,7 +55,7 @@ Social | [![Twitter URL](https://img.shields.io/twitter/url/http/sh
4655

4756
Why to name this API *TestAsYouThink*? The goal of *TestAsYouThink* is to map out the road from a new software functionality idea to its contractualized achievement as an executable test, while preserving product developers against known pitfalls. According to this perspective, any pitfall is likely to extend the developer's journey and to put him off his target. By anticipating such pitfalls, *TestAsYouThink* will be the best way to reduce the distance to proper, durable testing.
4857

49-
Moreover *TestAsYouThink* uses the Given-When-Then canvas as a formal guide to compose tests. This canvas originally comes from [Gherkin](https://sites.google.com/site/unclebobconsultingllc/the-truth-about-bdd) that is a grammatical protocol used in the [Behavior-Driven Development](https://en.wikipedia.org/wiki/Behavior-driven_development) method to write test scenarii in a business human-readable way by specifying a software behavior basing on concrete examples. Given-When-Then serves to divide any test into the three eponym steps. This canvas is implemented by the *TestAsYouThink* project to deliver a [DSL](https://en.wikipedia.org/wiki/Domain-specific_language) style fluent API.
58+
Moreover *TestAsYouThink* uses the [Given-When-Then](https://www.agilealliance.org/glossary/gwt/) canvas as a formal guide to compose tests. This canvas originally comes from [Gherkin](https://sites.google.com/site/unclebobconsultingllc/the-truth-about-bdd) that is a grammatical protocol used in the [Behavior-Driven Development](https://en.wikipedia.org/wiki/Behavior-driven_development) method to write test scenarii in a business human-readable way by specifying a software behavior basing on concrete examples. [Given-When-Then](https://www.agilealliance.org/glossary/gwt/) serves to divide any test into the three eponym steps. This canvas is implemented by the *TestAsYouThink* project to deliver a [DSL](https://en.wikipedia.org/wiki/Domain-specific_language) style fluent API.
5059

5160
# Getting Started
5261

@@ -70,14 +79,14 @@ givenSutClass(SystemUnderTest.class)
7079
.then(() -> {});
7180
```
7281

73-
Let us complete the previous scenario with a very simple example of what you can do, while testing a non-void method of your system under test.
82+
Let us complete the previous scenario with a very simple example of what you can do, while testing a non-void method of your system under test (abbreviated as SUT later).
7483
```java
7584
import static testasyouthink.TestAsYouThink.givenSutClass;
7685
...
7786

7887
givenSutClass(SystemUnderTest.class)
7988
.given(sut -> {
80-
// Where you prepare the context that defines the initial state of the system under test (SUT).
89+
// Where you prepare the context that defines the initial state of the SUT.
8190
DataSet dataSet = new DataSet(...);
8291
sut.setAnyAttribute(...);
8392
}).when(sut -> {
@@ -90,9 +99,10 @@ givenSutClass(SystemUnderTest.class)
9099
```
91100

92101
Notice that:
93-
- any Given-When-Then step can be implemented by a lambda or a method reference;
102+
- the `TestAsYouThink` class is the only one end point of the API;
103+
- any *Given-When-Then* step can be implemented by a lambda or a method reference;
94104
- you manipule the same SUT type from the beginning to the end, because the `sut` type is determined during the *Given* step, until the end;
95-
- there is no need to instantiate the `sut` object, even if it is allowed by the `givenSut(sutInstance)` alternate end point, as below;
105+
- there is no need to instantiate the `sut` object, even if it is allowed by the `givenSut(sutInstance)` alternate end point method, as below;
96106
- the call to any `given()` method is optional;
97107
- you manipule the same `result` type until the end, because the `result` type is determined during the *When* step;
98108
- you cannot inadvertently make a fake test that would verify nothing, because any `then()` method is always a sequence termination.
@@ -300,26 +310,43 @@ givenSutClass(SystemUnderTest.class)
300310

301311
The advantage of TestAsYouThink is that the time limit is only applied to the tested event, while [JUnit](https://github.com/junit-team/junit4/wiki/timeout-for-tests) applies its `timeout` to the whole test method with its `@Test` annotation. [JUnit 5](http://junit.org/junit5/docs/snapshot/user-guide/) will propose an `assertTimeout(duration, lambda)` method that returns the lamba result, but such a syntax amalgamates irremediably the expectations and the event.
302312

303-
# Release Notes
313+
# Code Examples
314+
315+
You can find concrete examples of use in the following repositories.
316+
- [TestAsYouThink examples](https://github.com/xapn/test-as-you-think-examples), with didactic, funny examples of use: do not hesitate to add your own examples being creative.
317+
- [Fizz-Buzz](https://xapn.github.io/fizz-buzz), a coding dojo with many JUnit tests.
318+
319+
# Releases
320+
321+
## Versioning
322+
323+
To understand how version numbers change, please read the [Semantic Versioning](http://semver.org/).
324+
325+
## Release Notes
326+
327+
### 0.4.2 version: Cobertura as a code coverage analyzer
328+
329+
- Generate the documentation TOC updating with [markdown-toc](https://github.com/jonschlinkert/markdown-toc) and commit the documentation change while building with Maven.
330+
- Check code coverage with [Cobertura](http://cobertura.github.io/cobertura/) and publish reports to [Codecov](https://codecov.io/) while building with [Travis CI](https://travis-ci.org).
304331

305-
## Version 0.4.1: Travis CI as a continuous integration platform
332+
### 0.4.1 version: Travis CI as a continuous integration platform
306333

307334
- Build the project with [Travis CI](https://travis-ci.org).
308335

309-
## Version 0.4: Time limit as an expectation
336+
### 0.4 version: Time limit as an expectation
310337

311338
- Expect that the system under test replies within a time limit.
312339
- Resolve ambiguous method calls in relation to using expression lambdas.
313340
- Start to write a test with the when step.
314341

315-
## Version 0.3: TestAsYouThink as a Maven distributed OSS library
342+
### 0.3 version: TestAsYouThink as a Maven distributed OSS library
316343

317-
- Rename the API to **TestAsYouThink**.
344+
- Rename the API to *TestAsYouThink*.
318345
- Choose an open source license.
319346
- Publish artifacts to Maven Central.
320347
- Check version updates.
321348

322-
## Version 0.2: Test fixtures as method arguments
349+
### 0.2 version: Method arguments as test fixtures
323350

324351
- Include a data as a method argument during the preparation phase.
325352
- Include two data as method arguments during the preparation phase.
@@ -329,7 +356,7 @@ The advantage of TestAsYouThink is that the time limit is only applied to the te
329356
- Verify failures while invoking methods with arguments.
330357
- Verify the expected exception and the expected message separately.
331358

332-
## Version 0.1: Given-When-Then as a canvas
359+
### 0.1 version: Given-When-Then as a canvas
333360

334361
- Write an unit or integration test by using the Given-When-Then canvas and full sequence.
335362
- Delegate the system under test instantiation to the API.
@@ -344,4 +371,4 @@ The advantage of TestAsYouThink is that the time limit is only applied to the te
344371

345372
# License
346373

347-
*Test As You Think* is distributed under the GNU LGPLv3 license. The LGPLv3 license is included in the LICENSE.txt file. More information about this license is available at http://www.gnu.org.
374+
*TestAsYouThink* is distributed under the GNU LGPLv3 license. The LGPLv3 license is included in the LICENSE.txt file. More information about this license is available at http://www.gnu.org.

pom.xml

Lines changed: 92 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<groupId>com.github.xapn</groupId>
66
<artifactId>test-as-you-think-project</artifactId>
7-
<version>0.4.1</version>
7+
<version>0.4.2</version>
88
<packaging>pom</packaging>
99
<name>${project.groupId}:${project.artifactId}:${project.version}:${project.packaging}</name>
1010
<description>The TestAsYouThink project aims to provide tooling to improve test code quality and to make testing
@@ -272,11 +272,102 @@
272272
<artifactId>versions-maven-plugin</artifactId>
273273
<version>2.4</version>
274274
</plugin>
275+
<!-- https://mvnrepository.com/artifact/org.codehaus.mojo/exec-maven-plugin -->
276+
<plugin>
277+
<groupId>org.codehaus.mojo</groupId>
278+
<artifactId>exec-maven-plugin</artifactId>
279+
<version>1.6.0</version>
280+
</plugin>
281+
<!-- https://mvnrepository.com/artifact/org.codehaus.mojo/cobertura-maven-plugin -->
282+
<plugin>
283+
<groupId>org.codehaus.mojo</groupId>
284+
<artifactId>cobertura-maven-plugin</artifactId>
285+
<version>2.7</version>
286+
<configuration>
287+
<check>
288+
<branchRate>85</branchRate>
289+
<lineRate>85</lineRate>
290+
<haltOnFailure>true</haltOnFailure>
291+
<totalBranchRate>85</totalBranchRate>
292+
<totalLineRate>85</totalLineRate>
293+
<packageLineRate>85</packageLineRate>
294+
<packageBranchRate>85</packageBranchRate>
295+
</check>
296+
<formats>
297+
<format>html</format>
298+
<format>xml</format>
299+
</formats>
300+
<check/>
301+
</configuration>
302+
<executions>
303+
<execution>
304+
<goals>
305+
<!-- For bytecode instrumentation -->
306+
<goal>clean</goal>
307+
<!-- For checking the post-testing coverage percentages to ensure a valid level of test coverage -->
308+
<goal>check</goal>
309+
</goals>
310+
</execution>
311+
</executions>
312+
</plugin>
275313
</plugins>
276314
</pluginManagement>
277315
</build>
278316

279317
<profiles>
318+
<profile>
319+
<id>coverage</id>
320+
<build>
321+
<plugins>
322+
<plugin>
323+
<groupId>org.codehaus.mojo</groupId>
324+
<artifactId>cobertura-maven-plugin</artifactId>
325+
</plugin>
326+
</plugins>
327+
</build>
328+
</profile>
329+
<profile>
330+
<id>before-release</id>
331+
<activation>
332+
<activeByDefault>false</activeByDefault>
333+
</activation>
334+
<build>
335+
<plugins>
336+
<plugin>
337+
<groupId>org.codehaus.mojo</groupId>
338+
<artifactId>exec-maven-plugin</artifactId>
339+
<inherited>false</inherited>
340+
<executions>
341+
<execution>
342+
<id>generate_toc</id>
343+
<phase>initialize</phase>
344+
<goals>
345+
<goal>exec</goal>
346+
</goals>
347+
<configuration>
348+
<!-- https://github.com/jonschlinkert/markdown-toc -->
349+
<executable>markdown-toc</executable>
350+
<commandlineArgs>-i README.md</commandlineArgs>
351+
</configuration>
352+
</execution>
353+
<execution>
354+
<id>commit_toc</id>
355+
<phase>initialize</phase>
356+
<goals>
357+
<goal>exec</goal>
358+
</goals>
359+
<configuration>
360+
<executable>git</executable>
361+
<commandlineArgs>
362+
commit README.md -m 'Update the table of content of the documentation.'
363+
</commandlineArgs>
364+
</configuration>
365+
</execution>
366+
</executions>
367+
</plugin>
368+
</plugins>
369+
</build>
370+
</profile>
280371
<profile>
281372
<id>release</id>
282373
<activation>

test-as-you-think-core/pom.xml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>com.github.xapn</groupId>
77
<artifactId>test-as-you-think-project</artifactId>
8-
<version>0.4.1</version>
8+
<version>0.4.2</version>
99
</parent>
1010

1111
<artifactId>test-as-you-think-core</artifactId>
@@ -14,6 +14,24 @@
1414
</description>
1515
<url>https://xapn.github.io/test-as-you-think</url>
1616

17+
<build>
18+
<pluginManagement>
19+
<plugins>
20+
<plugin>
21+
<groupId>org.codehaus.mojo</groupId>
22+
<artifactId>cobertura-maven-plugin</artifactId>
23+
<configuration>
24+
<instrumentation>
25+
<excludes>
26+
<exclude>testasyouthink/verification/Assertions.class</exclude>
27+
</excludes>
28+
</instrumentation>
29+
</configuration>
30+
</plugin>
31+
</plugins>
32+
</pluginManagement>
33+
</build>
34+
1735
<dependencies>
1836
<dependency>
1937
<groupId>junit</groupId>

0 commit comments

Comments
 (0)