Is it possible to parameterize the display name of the NUnit test case when using the `` Ticked names of methods ''?

I am testing F # and using NUnit as a test library; I discovered the use of double reverse ticks to allow arbitrary method names to make my method names even more human readable.

I was wondering, right or wrong, if you can change the method names when using NUnit TestCaseAttributeto change the method name, for example:

[<TestCase("1", 1)>]
[<TestCase("2", 2)>]
let ``Should return #expected when "#input" is supplied`` input expected =
    ...
+4
source share
2 answers

, , , TickSpec ( BDD, F #) , back-tick, .

, , tic-tac-toe:

Scenario: Winning positions
    Given a board layout:
        | 1 | 2 | 3 |
        | O | O | X |
        | O |   |   |
        | X |   | X |
    When a player marks X at <row> <col>
    Then X wins

Examples:
    | row    | col    | 
    | middle | right  |
    | middle | middle |
    | bottom | middle |

, When , F #, - :

let [<When>] ``a player marks (X|O) at (top|middle|bottom) (left|middle|right)`` 
        (mark:string,row:Row,col:Col) =       
    let y = int row             
    let x = int col        
    Debug.Assert(System.String.IsNullOrEmpty(layout.[y].[x]))
    layout.[y].[x] <- mark  

, , unit test - BDD , ( , !)

+5

.

, input expected . ( stacktrace ). .

, - eval ( fsi), - , .

+1

Source: https://habr.com/ru/post/1526149/


All Articles