TestNG @Optional | @Parameters | Setting default value for the parameters

Опубликовано: 06 Март 2021
на канале: total-qa
613
16

References:

https://testng.org/doc/documentation-...

Parameters can be declared optional with the Optional annotation:
=============================================================

@Parameters("username")
@Test
public void validatelogin(@Optional("totalqa") String db) { ... }
If no parameter named "db" is found in your testng.xml file, your test method will receive the default value specified inside the @Optional annotation: "mysql".