Skip to content

"Subtasks": Multiple tests at once #331

Closed
@moT01

Description

@moT01

So I've been looking into creating some projects lately, and these will be different from the tutorials.

I am wondering if we can add a way to do many tests at once. Basically, like you have multiple steps for one question. But instead of each step showing up after each test passes (I think that's how it currently is), all the tests (or steps) would be displayed from the start and when the tests were run, they would show pass/fail or some icons next to each test.

So when users create their projects, they can run the tests after they have worked on it for a while and see that they have passed 5 of 10 tests or something. This is similar to how fCC does it on projects.

Activity

ShMcK

ShMcK commented on May 12, 2020

@ShMcK
Member

Since CodeRoad is based on Git, steps are required to go in a specific order.

However, it would be possible to relate a series of unit tests with a step "subtask". When those subtasks pass, the task passes. It's a fair bit of work, but doable.

ShMcK

ShMcK commented on May 14, 2020

@ShMcK
Member

I've been thinking about this one.

Requirements

Display feature requires:

  1. determining a subset of tests to run
    2 parsing the test names as "subtask" text
  2. displaying which tests have passed/failed

I'll address each of these below:

Solutions

Subset of Tests

Many test runners have the ability to run a subset of tests by:

  • matching a pattern
  • targetting a named test suite
  • targeting a file

These test run commands aren't consistent across test runners - meaning that they would have to be specified in a tutorial config. Likely in the config.testRunner.testFilterCommand.

A step could indicate that it is using a test filter and could provide the filter string.

Test Names & Test Status

I parse the output in a format called "TAP" (Test Anywhere Protocol), so the subtask name can be taken from the test name, and the pass/fail status is recorded.

Process

  1. Add a tutorial test runner config that specifies a custom test runner filter command
  2. Add step filter string that can be used with the test runner filter command
  3. Run the tests initially when the step loads. This will provide the names of the "subtasks" as failed/passed test messages.
  4. Update the tests based on the pass/fail output.
moT01

moT01 commented on May 15, 2020

@moT01
ContributorAuthor

Here's a couple scenarios that you may want to consider. I will likely want to be able to do all of these if possible. It sounds your plan would accommodate, but I just want to try and clarify.

A Project will likely look like this - Pretty much just one level with one step and many tests:

## Project level name

### Step 1
- user story 1
- user story 2
- user story 3
...
- user story n

The tests would all be run at once, and users would be able to see what ones they pass/failed. If it's easier, you could maybe make it so it stops testing when the first one fails. Meaning the tests start running, it passes the first test (you get a green checkmark there), it fails on the second test, and the third test just doesn't execute.

Another scenario is to have multiple tests within a step of a regular challenge...

## Level X

View your tables with X command.

After you're done, create a row with x, y, and z values.

### Step 1
- You entered the X command
### Step 2
- your table has a row with x value
- your table has a row with y value
- your table has a row with z value

So step one would be the first test, they wouldn't be able to move past it until they passed. Then the second step might have several tests which all get tested at the same time. This is similar to what is on fCC and how I am familiar with writing instructions.

It sounds like your plan would accommodate both of these scenarios.

changed the title [-]Multiple tests at once[/-] [+]"Subtasks": Multiple tests at once[/+] on May 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    Participants

    @ShMcK@moT01

    Issue actions

      "Subtasks": Multiple tests at once · Issue #331 · coderoad/coderoad-vscode