Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Matcher to test timeouts #133

Closed
llorllale opened this issue Jun 29, 2019 · 20 comments
Closed

Matcher to test timeouts #133

llorllale opened this issue Jun 29, 2019 · 20 comments

Comments

@llorllale
Copy link
Owner

llorllale commented Jun 29, 2019

We need a proper OOP alternative for @Test#timeout (JUnit 4) and Assertions#assertTimeout (JUnit 5). In particular, the latter reads backwards (it doesn't assert a timeout - it asserts whether the code executes before the timeout).

Proposal:

new Assertion<>(
    "runs in 5 seconds max",
    /* some scalar */,
    new RunsInMax(5, TimeUnit.SECONDS)
).affirm();

Where RunsInMax is a Matcher<Scalar<T>> like Throws.

RunsInMax fails if the scalar under test throws an error, even before the timeout.

I'm open to suggestions for a better name. Maybe DoesNotExceed(5, TimeUnit.SECONDS) sounds better?

@llorllale
Copy link
Owner Author

@0crat in

@0crat
Copy link
Collaborator

0crat commented Jun 29, 2019

@0crat in (here)

@llorllale Job #133 is now in scope, role is DEV

@0crat
Copy link
Collaborator

0crat commented Jun 29, 2019

Bug was reported, see §29: +15 point(s) just awarded to @llorllale/z

@0crat
Copy link
Collaborator

0crat commented Jul 20, 2019

The job #133 assigned to @victornoel/z, here is why; the budget is 30 minutes, see §4; please, read §8 and §9; if the task is not clear, read this and this; there will be no monetary reward for this job

@victornoel
Copy link
Collaborator

victornoel commented Jul 20, 2019

@llorllale usually, with @Test#timeout, the timeout is expressed on top of another assertion. You don't just test that a function runs in less than a given amount or fails if not.

Don't you think we should have something like this instead:

new Assertion<>(
    "runs in 5 seconds max",
    () -> new TextOf("test"),
    new MatchesBefore(
        new TextIs("test"),
        5, TimeUnit.SECONDS
    )
).affirm();

An alternative would be for Assertion#affirm to be called in the Scalar maybe.

@victornoel
Copy link
Collaborator

@0crat wait for ARC answer

@0crat
Copy link
Collaborator

0crat commented Jul 20, 2019

@0crat wait for ARC answer (here)

@victornoel The impediment for #133 was registered successfully by @victornoel/z

@0crat
Copy link
Collaborator

0crat commented Jul 20, 2019

@0crat wait for ARC answer (here)

@victornoel There is an unrecoverable failure on my side. Please, submit it here:

PID: 4@dddff4c1-9156-49e2-a2d9-cf978c5a9655, thread: pool-11-thread-8
org.codehaus.groovy.runtime.ScriptBytecodeAdapter[66] groovy.lang.MissingPropertyException: No such property: issue for class: com.zerocracy.stk.pm.in.impediments.add_waiting_label

0.48.2: CID: c14f0688-f370-4ed4-ba68-74a01385b4fc, Type: "Impediment was registered"

@llorllale
Copy link
Owner Author

@victornoel I would be OK if you invert the order of the arguments in your example:

new Assertion<>(
    "runs in 5 seconds max",
    () -> new TextOf("test"),
    new MatchesBefore(
        5, TimeUnit.SECONDS.
        new TextIs("test")        
    )
).affirm();

@0crat
Copy link
Collaborator

0crat commented Sep 11, 2019

The architect of the project has changed; @llorllale/z is not at this role anymore; @paulodamaso/z is the architect now

victornoel added a commit to victornoel/cactoos-matchers that referenced this issue Sep 15, 2019
victornoel added a commit to victornoel/cactoos-matchers that referenced this issue Sep 15, 2019
@victornoel
Copy link
Collaborator

@0crat wait for #145 to be merged

@0crat
Copy link
Collaborator

0crat commented Sep 15, 2019

@0crat wait for #145 to be merged (here)

@victornoel Job #133 is already on hold

@0pdd
Copy link
Collaborator

0pdd commented Sep 15, 2019

@llorllale the puzzle #146 is still not solved.

@victornoel
Copy link
Collaborator

@llorllale this was merged in #145, can you close the issue?

@llorllale
Copy link
Owner Author

@victornoel thanks!

@0crat
Copy link
Collaborator

0crat commented Sep 17, 2019

@paulodamaso/z all QAs are on vacation. Please handle that.

@0crat
Copy link
Collaborator

0crat commented Sep 17, 2019

The job #133 is now out of scope

@paulodamaso
Copy link
Contributor

@0crat quality good

@0crat
Copy link
Collaborator

0crat commented Sep 17, 2019

@0crat quality good (here)

@paulodamaso There is no quality review for #133, no performer

@0pdd
Copy link
Collaborator

0pdd commented Sep 11, 2020

@llorllale the only puzzle #146 is solved here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants