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

When call fail after check, check will not be count in the checks result #669

Closed
owenhuang2017 opened this issue Jun 8, 2018 · 2 comments
Labels

Comments

@owenhuang2017
Copy link

Test code with calling fail():

import { check, sleep, fail } from "k6";

// K6 testing options
export let options = {
    stages: [
        { duration: "5s", target: 5 },
        { duration: "30s" },
        { duration: "5s", target: 0 }
    ]
};

export default function() {
    sleep(0.1);

    var date = new Date();
    
    check(date, {
        "milliseconds < 500": (r) => r.getMilliseconds() < 500
    }) || fail("milliseconds >= 500");
};

Result:

     ↳  50% — ✓ 872 / ✗ 858

    checks...............: 100.00% ✓ 872 ✗ 0  
    data_received........: 0 B     0 B/s
    data_sent............: 0 B     0 B/s
    iteration_duration...: avg=102.38ms min=100.07ms med=102.52ms max=105.27ms p(90)=104.63ms p(95)=104.9ms
    iterations...........: 1734    43.349749/s
    vus..................: 1       min=1 max=5
    vus_max..............: 5       min=5 max=5

Test code without calling fail():

import { check, sleep, fail } from "k6";

// K6 testing options
export let options = {
    stages: [
        { duration: "5s", target: 5 },
        { duration: "30s" },
        { duration: "5s", target: 0 }
    ]
};

export default function() {
    sleep(0.1);

    var date = new Date();
    
    check(date, {
        "milliseconds < 500": (r) => r.getMilliseconds() < 500
    });
};

Result:

     ↳  50% — ✓ 874 / ✗ 860

    checks...............: 50.40% ✓ 874 ✗ 860
    data_received........: 0 B    0 B/s
    data_sent............: 0 B    0 B/s
    iteration_duration...: avg=102.17ms min=100.08ms med=101.87ms max=105.28ms p(90)=104.54ms p(95)=104.88ms
    iterations...........: 1738   43.449626/s
    vus..................: 1      min=1 max=5
    vus_max..............: 5      min=5 max=5
@na-- na-- added the bug label Jun 8, 2018
@robingustafsson robingustafsson added this to the v1.0.0 milestone Jul 6, 2018
@luizbafilho luizbafilho self-assigned this Jul 31, 2018
@luizbafilho
Copy link
Contributor

Hi @owenhuang2017,

Just tried to reproduce the problem but I wasn't able to, I guess the latest changes fixed that. Could you try the newest version of k6 and let me know if the problem persists?

@na--
Copy link
Member

na-- commented Oct 5, 2018

Closing this since it was inadvertently fixed by the real-time metrics refactoring that was part of the k6 v0.22.0 release.

@na-- na-- closed this as completed Oct 5, 2018
@na-- na-- removed this from the v1.0.0 milestone Jul 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants