How to run testsup2 from command line on mac

Hi there,

I have written some tests for an extension I am working on. I am able to run the tests using the testup2 UI. I want to run the tests from a command line. I have a tasks.json file like following

  {
		// See https://go.microsoft.com/fwlink/?LinkId=733558
  // for the documentation about the tasks.json format
  "version": "2.0.0",
  "tasks": [
    {
      "label": "Debug SketchUp 2021",
      "type": "shell",
      "command": "open -a '/Applications/SketchUp 2021/SketchUp.app' --args -rdebug 'ide port=7000'"
    },
    {
      "label": "Run tests",
      "type": "shell",
      "command":     "open -a '/Applications/SketchUp 2021/SketchUp.app' --args 'TestUp:CI:Path: /Users/anuragjoshi/Bonito/Bonito_Sketchup_Tools/Product Smoke Tests'"
    }

  ]
}

But when I run my command the tests won’t run(See the command in Run Tests in above tasks.
Q: How to run invoke the tests to run from the command line on a mac?(I am asking mac because I haven’t tested this on a windows machine).

Have a look at the example arguments from the documentation again:

You are using --args, but to pass arguments to SketchUp’s Ruby interpreter you need to use -RubyStartupArg

-RubyStartupArg "TestUp:CI:Config: \Full\Path\To\Config.yml"

using -RubyStartupArg gives the following error

open: unrecognized option `--RubyStartupArg'`

I have tried both --RubyStartupArg and -RubyStartupArg

Hm… I’ll have to look closer at that. (But all my macs are busy updating atm, so I cannot do that right now.)

Wait, that says that open isn’t recognising --RubyStartupArg. Meaning SketchUp isn’t getting the arguments.

This is probably an issue with how your command is set up in tasks.json.
I see you have the whole command in "command"'s value, but tasks.json have an "args" field to fill in the arguments passed to the command. Tasks in Visual Studio Code

Maybe something like this? (I’ve not been able to test this.)

      "program": "/Applications/SketchUp 2021/SketchUp.app/Contents/MacOS/SketchUp",
      "args": [
        "-RubyStartupArg",
        "TestUp:CI:Path: /Users/anuragjoshi/Bonito/Bonito_Sketchup_Tools/Product Smoke Tests"
      ],

Oh, I see now, --args is a parameter for open, and that is used to pass any trailing arguments to the app open is set to lunch.

This will probably also work:

open -a '/Applications/SketchUp 2021/SketchUp.app' --args -RubyStartupArg 'TestUp:CI:Path: /Users/anuragjoshi/Bonito/Bonito_Sketchup_Tools/Product Smoke Tests'

open -a '/Applications/SketchUp 2021/SketchUp.app' says to use open to launch SketchUp 2021, and --args -RubyStartupArg 'TestUp:CI:Path: /Users/anuragjoshi/Bonito/Bonito_Sketchup_Tools/Product Smoke Tests' says to pass all arguments after --args to the application being opened.