#56 Add ability to disable tests and have them reported

[FUTURE FEATURE]
closed
nobody
None
2022-01-05
2022-01-04
jtebokkel
No

It would be nice to add the ability to disable tests and have them listed in the xml report and logger report.

I've got a situation where I have a some function blocks that I want to test. Most of the functionality can be tested in quick tests that only take a cycle or two, but some tests are dealing with timeouts that can make the test suite run for a few minutes. I'd like to be able to setup two configurations (through applications) that will disable the longer running tests so that I can quickly iterate my code. I have an input to my test suite function block that I can set to disable the longer running tests, but I have no easy way to know how many disabled tests there are when I run the quick config.

If we could disable tests with a reason that would be even better. Then I could write a test for a future feature and have it shown as disabled rather than just failing before the feature is written.

Thanks so much for the work that has gone into this project. It is really helpful and I greatly appreciate it.

Discussion

  • aliazzz

    aliazzz - 2022-01-04
     
  • aliazzz

    aliazzz - 2022-01-04

    Hi,

    maybe it is an undocumented feature(?) but your request is allready implemented into v1.2.0.0 :-)

    AFAIK Use

    Test('Disabled_TestXYZ');
    
    
    
    Test_Finished();
    

    This will be counted in the reporting as a skipped test.
    (both logged in PLC Log and in the XML.report)

     
  • jtebokkel

    jtebokkel - 2022-01-04

    Does TEST_FINISHED() need to be called when the test is marked as disabled_? or is it sufficient to just have it marked as skipped/disabled?

    METHOD T101_Process
    VAR_INPUT
    END_VAR
    VAR_INST
        mxT : UINT;
    END_VAR
    
    IF xLiveDB THEN
        TEST('T101_Process');
    ELSE
        // gc_sDisable : STRING(10) := 'disabled_';
        TEST(concat(gConst.gc_sDisable, 'T101_Process'));
    
        // Is this call necessary?
        TEST_FINISHED();
    
        RETURN;
    END_IF
    
    CASE mxT OF
        0: // init
            mxT := 10;
        10: // multi stage test
            mxT := 20;
        ELSE
            TEST_FINISHED();
    END_CASE
    
     
    👍
    1
  • aliazzz

    aliazzz - 2022-01-04

    If you declare a test, calling TEST_FINISHED() is mandatory, even if the test will be disabled;

    TEST('DISABLED_ThisTestWillBeIgnored');
    
    AssertEquals(Expected := a,
                 Actual := b,
                 Message := 'A does not equal B');
    
    TEST_FINISHED();
    

    Note that 'Disabled' is case insensitive.

     

    Last edit: aliazzz 2022-01-04
  • aliazzz

    aliazzz - 2022-01-05

    Since this ticket is fulfilled within scope I will close the issue.

     
  • aliazzz

    aliazzz - 2022-01-05
    • status: open --> closed
     

Log in to post a comment.