k6test

package
v0.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 25, 2023 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type VU

type VU struct {
	*k6modulestest.VU
	Loop *k6eventloop.EventLoop
	// contains filtered or unexported fields
}

VU is a k6 VU instance. TODO: Do we still need this VU wrapper? ToGojaValue can be a helper function that takes a goja.Runtime (although it's not much of a helper from calling ToValue(i) directly...), and we can access EventLoop from modulestest.Runtime.EventLoop.

func NewVU

func NewVU(tb testing.TB, opts ...any) *VU

NewVU returns a mock k6 VU.

func (*VU) AssertSamples added in v0.6.0

func (v *VU) AssertSamples(assertSample func(s k6metrics.Sample)) int

AssertSamples asserts each sample VU received since AssertSamples is last called, then it returns the number of received samples.

func (*VU) MoveToVUContext added in v0.5.0

func (v *VU) MoveToVUContext()

MoveToVUContext moves the VU to VU context, adding a predefined k6 lib State and nilling the InitEnv to simulate how that is done in the real k6.

func (*VU) ToGojaValue

func (v *VU) ToGojaValue(i any) goja.Value

ToGojaValue is a convenience method for converting any value to a goja value.

type WithSamplesListener added in v0.9.0

type WithSamplesListener chan k6metrics.SampleContainer

WithSamplesListener is used to indicate we want to use a bidirectional channel so that the test can read the metrics being emitted to the channel.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL