kevinohara80/dmc

Add test options for classes and specific tests

Opened this issue · 2 comments

dmc test currently accepts a --ns option, but there are no options to run a specific class or a specific test within a class.

Add the following options:

  • --class to filter apex classes by name
  • --name to filter tests by name

Options may be used independently or may be combined to provide even more targeted filters for which tests to run.

For now, only exact name matches (case-insensitive) will be supported, although a future iteration could potentially allow globbing patterns ("BR1_*", for example)

Example usage:

dmc test --class AccountTests
dmc test --name BR1_AccountManagerOrRegionManagerRequired
dmc test --class AccountTests --name BR1_AccountManagerOrRegionManagerRequired
dmc test --ns MyManagedPackage --class AccountTests --name BR1_AccountManagerOrRegionManagerRequired

I'd be happy to help by submitting a PR once this issue has been reviewed and approved/amended.

dmc test uses the same globbing patterns as a deploy to select which classes to run tests on. Something like this works...

dmc test src/classes/MyTest*

The ability to specify tests methods to run does not currently exist and I'd be happy to entertain a PR for it. It's in my mental backlog of things to add right now.