0

I'm using gopter for property testing and I'm interested in speeding up my test runs by running independent tests in parallel.

I can't find any reference in the documentation as to whether it's safe to call t.Parallel() in my test or not. Though, none of the examples that I've found are actually tests, they're all standalone console apps.

For example, here's one of my tests - is it safe to add the marked line?

func Test_NetworkSecurityGroup_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) {
    t.Parallel() // Is this safe?
    parameters := gopter.DefaultTestParameters()
    parameters.MaxSize = 10
    properties := gopter.NewProperties(parameters)
    properties.Property(
        "Round trip from NetworkSecurityGroup to NetworkSecurityGroup via AssignPropertiesToNetworkSecurityGroup & AssignPropertiesFromNetworkSecurityGroup returns original",
        prop.ForAll(RunPropertyAssignmentTestForNetworkSecurityGroup, NetworkSecurityGroupGenerator()))
    properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout))
}

I don't have any crashes when the t.Parallel() call is present, but I'm wary about proceeding without some reference that indicates it may be safe to do so.

Bevan
  • 43,618
  • 10
  • 81
  • 133
  • The synopsis section in the readme says `No parallel commands ... yet?`, Not sure if it parallel safe. https://github.com/leanovate/gopter#synopsis – Shailesh Suryawanshi Aug 17 '21 at 06:20
  • I couldn't decide whether that comment was specifically about commands (implying generators are safe for parallel use) or more general. – Bevan Aug 17 '21 at 19:54

0 Answers0