Submit and vote on feature ideas.

Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

dotTest 10.3 - Is it possible to edit a rule.

elch
elch Posts: 95

Hi,

dotTest 10.3 - Is it possible to edit a rule. Similarity to C++test ?
Is it possible to do it from the IDE ?

Thanks In Advanced,

Best Answers

  • Piotr Krukowiecki
    Piotr Krukowiecki Posts: 10 ✭✭
    Answer ✓

    Yes, that is correct.

Answers

  • mrybak
    mrybak Posts: 5

    Hi @elch,
    Could you please clarify what do you mean as "editing"? Do you mean rule parametrization, cloning/renaming rules, creating new ones or changing behavior of current ones?

  • elch
    elch Posts: 95

    Hi @mrybak

    1. changing behavior of current ones by adding\updating parameters.

    Thanks

  • elch
    elch Posts: 95

    Hi @Piotr Krukowiecki

    Thanks for the detailed answer.
    I downloaded the latest Rule wizard application 10.3.4.
    I got an error when tried to edit a rule from 10.3.3. dotTest. The Error was Unknown rule type .NET.

    1. Any suggestion.
    2. How can I link between rule name in report , for example SEC.... to the name of rules files ?

    Thanks

  • elch
    elch Posts: 95

    Hi @Piotr Krukowiecki

    Thanks on your support.
    Ok , Rule wizard is operating , it was missing some files.
    I can browse the xml files.

    I can not find in my version 10.3.3 the rule SEC.LGE-2 ? very wiered.
    Any suggestions ? BTW can I edit it ?

    Thanks

  • elch
    elch Posts: 95

    Hi @Piotr Krukowiecki

    We had some issues with this rule as it raising an error that catch has no logger operation inside the catch.
    we have Serilog logger , the rule does not recognize such logger. the logger has different logger methods , such as logger
    So Do you think setting up a new rule can resolve this issue ?

    thanks

  • elch
    elch Posts: 95

    Hi @Piotr Krukowiecki

    I want to edit SEC.LGE rule because it is raising a lot of false alarms on missing logger.
    We are using for example Serilog logger , It seems the scan does not recognize _logger.Error( ex, "dd") methods in the catch .
    Any suggestions how to resolve the issue ?

    Thanks

  • Piotr Krukowiecki
    Piotr Krukowiecki Posts: 10 ✭✭

    Hi @elch,

    please make sure that rule parameters are correctly set up and that the _logger.Error call should be recognized as "log" method based on parameters definition.

    If you believe rule parameters are correctly set up, could you please provide compilable/simplified code which shows the problem?

  • elch
    elch Posts: 95

    Hi @Piotr Krukowiecki

    Can you please tell what are the steps to check if I setup the rule correctly.
    I just set it to TRUE in my properties file.
    Am i missing something ?

    thanks

  • elch
    elch Posts: 95

    Hi @Piotr Krukowiecki

    OK , got it,
    It can be editable except for some rules like SEC.LGE ?

    Thanks

  • elch
    elch Posts: 95

    Hi @Piotr Krukowiecki

    I tried to edit SEC.LGE parametres by editing rule properties.

    SEC.LGE.CheckExceptionPassing=true
    SEC.LGE.logtypesandmethodes=.[lL]logger;.*

    Is it possible to do so in 10.3 or 10.4? I tried in both version and the engine still does not consider loggers such as Serilog _logger.Error( ex, "dd") .

    Thanks

  • Piotr Krukowiecki
    Piotr Krukowiecki Posts: 10 ✭✭
    edited September 2018

    Hi @elch

    I see a couple things that need to be changed:
    1. "[" and "]" must be encoded
    2. use ";" as separator

    For example to set following two patterns:

    1.
    Full Type Name Pattern: .[lL]logger.
    Method Name Pattern: .Log.

    2.
    Full Type Name Pattern: SomeOtherFullTypeNamePattern
    Method Name Pattern: SomeOtherMethodNamePattern

    You should use following entry in .properties file:

    SEC.LGE.LogTypesAndMethods=.*%5BlL%5Dlogger.*;.*MethodName.*;SomeOtherFullTypeNamePattern;SomeOtherMethodNamePattern

    (that should be one line of course)

    PS. Are you sure your pattern should be "[lL]logger" ? That will match "Ilogger" and "Llogger" (case sensitive).

  • elch
    elch Posts: 95
    edited September 2018

    Hi @Piotr Krukowiecki

    Thanks on your answers, Yes you are correct it should be: .[lL]og.

    My log syntax is:
    catch(
    exception ex)
    {
    _logger.Error( ex, "there was an error.....", );
    return Something();
    }

    I am trying to suppress by rule parameters this validation.
    Any suggestions.

    Thanks

  • What is the type of _logger and what are your SEC.LGE settings?

  • elch
    elch Posts: 95

    Hi @Piotr Krukowiecki

    My settings are:
    SEC.LGE.CheckExceptionPassing=true
    SEC.LGE.logtypesandmethodes=.[lL]ogger;.

  • Please, you didn't answer my question about the type of _logger.

    Also, your pattern looks wrong:
    1. did you really mean the dot at the beginning?
    ".[lL]ogger" will not match "Logger" for example (will match xLogger etc)
    2. you did not encode the square brackets

    Assuming you want to accept types which have "logger" or "Logger" in it's fully qualified name, the regex pattern would be: "[lL]ogger" and in the .properties test configuration you should have following:

    SEC.LGE.CheckExceptionPassing=true
    SEC.LGE.LogTypesAndMethods=%5BlL%5Dogger;.
    
  • elch
    elch Posts: 95

    Hi @Piotr Krukowiecki

    I am sorry on my delay , What do you mean by What is the type of _logger" ?
    I tired the above settings and still the rule does not exclude:
    _logger.Error( ex, "there was an error.....", );

    Any suggestions

    Thanks

  • elch
    elch Posts: 95

    Hi @Piotr Krukowiecki

    After upgrading dotTest 10.4.
    Can you please provide for to whom I need to send issues with the rules ?
    To support ? mail ?

    Thanks