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".