or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

capabilities.mdframeworks.mdindex.mdnetwork.mdoptions.mdreporters.mdservices.mdworkers.md

frameworks.mddocs/

0

# Test Frameworks

1

2

Test framework integration types supporting Mocha, Jasmine, and Cucumber with test execution results, metadata, and framework-specific structures.

3

4

## Capabilities

5

6

### Test Suite Structure

7

8

Core test suite interface used across all frameworks.

9

10

```typescript { .api }

11

/**

12

* Test suite information

13

*/

14

interface Suite {

15

/** Suite type identifier */

16

type: string;

17

/** Suite title/name */

18

title: string;

19

/** Parent suite identifier */

20

parent: string;

21

/** Full hierarchical title */

22

fullTitle: string;

23

/** Whether suite is pending/skipped */

24

pending: boolean;

25

/** Source file path */

26

file: string;

27

/** Error information if suite failed */

28

error?: any;

29

/** Suite execution duration in milliseconds */

30

duration?: number;

31

}

32

```

33

34

### Test Structure

35

36

Individual test case interface extending suite information.

37

38

```typescript { .api }

39

/**

40

* Individual test case information

41

*/

42

interface Test extends Suite {

43

/** Full test name including suite hierarchy */

44

fullName: string;

45

/** Test function reference */

46

fn?: Function;

47

/** Test function body as string */

48

body?: string;

49

/** Async test indicator */

50

async?: number;

51

/** Synchronous test flag */

52

sync?: boolean;

53

/** Whether test timed out */

54

timedOut?: boolean;

55

/** Test execution context */

56

ctx: any;

57

58

// Mocha-specific properties

59

/** Test description */

60

description?: string;

61

/** Retried test reference */

62

_retriedTest?: any;

63

/** Current retry attempt */

64

_currentRetry?: number;

65

/** Maximum retry attempts */

66

_retries?: number;

67

}

68

```

69

70

### Test Execution Results

71

72

Test execution outcome and metadata.

73

74

```typescript { .api }

75

/**

76

* Test retry information

77

*/

78

interface TestRetries {

79

/** Maximum retry attempts allowed */

80

limit: number;

81

/** Number of retry attempts made */

82

attempts: number;

83

}

84

85

/**

86

* Test execution result

87

*/

88

interface TestResult {

89

/** Error information if test failed */

90

error?: any;

91

/** Test result data */

92

result?: any;

93

/** Whether test passed */

94

passed: boolean;

95

/** Test execution duration in milliseconds */

96

duration: number;

97

/** Retry information */

98

retries: TestRetries;

99

/** Exception details as string */

100

exception: string;

101

/** Test status */

102

status: string;

103

}

104

105

/**

106

* Test run summary statistics

107

*/

108

interface Results {

109

/** Number of completed tests */

110

finished: number;

111

/** Number of passed tests */

112

passed: number;

113

/** Number of failed tests */

114

failed: number;

115

}

116

```

117

118

### Cucumber Framework Types

119

120

Cucumber-specific test framework types for BDD testing.

121

122

```typescript { .api }

123

/**

124

* Cucumber world object

125

*/

126

interface World {

127

/** Pickle (scenario) information */

128

pickle: {

129

/** Scenario name */

130

name?: string;

131

};

132

/** Scenario execution result */

133

result?: {

134

/** Execution duration */

135

duration: {

136

seconds: number;

137

nanos: number;

138

};

139

/** Scenario status */

140

status: 'UNKNOWN' | 'PASSED' | 'SKIPPED' | 'PENDING' | 'UNDEFINED' | 'AMBIGUOUS' | 'FAILED';

141

/** Error message if failed */

142

message?: string;

143

/** Whether scenario will be retried */

144

willBeRetried: boolean;

145

};

146

}

147

148

/**

149

* Cucumber pickle (scenario/step) result

150

*/

151

interface PickleResult {

152

/** Whether scenario passed */

153

passed: boolean;

154

/** Error stack if scenario failed */

155

error?: string;

156

/** Scenario duration in milliseconds */

157

duration?: number;

158

}

159

160

/**

161

* Cucumber step information

162

*/

163

interface PickleStep {

164

/** Step identifier */

165

id: string;

166

/** Step text */

167

text: string;

168

/** AST node identifiers */

169

astNodeIds: string[];

170

/** Step keyword with trailing space */

171

keyword: 'Given ' | 'When ' | 'Then ' | 'And ';

172

}

173

174

/**

175

* Cucumber tag information

176

*/

177

interface Tag {

178

/** Tag name */

179

name: string;

180

/** AST node identifier */

181

astNodeId: string;

182

}

183

184

/**

185

* Cucumber scenario information

186

*/

187

interface Scenario {

188

/** Scenario identifier */

189

id: string;

190

/** Feature file URI */

191

uri: string;

192

/** Scenario name */

193

name: string;

194

/** AST node identifiers */

195

astNodeIds: string[];

196

/** Scenario steps */

197

steps: PickleStep[];

198

/** Scenario tags */

199

tags: Tag[];

200

}

201

```

202

203

### Framework Configuration Types

204

205

Global namespace extensions for framework-specific options.

206

207

```typescript { .api }

208

declare global {

209

namespace WebdriverIO {

210

/**

211

* Mocha test framework options

212

*/

213

interface MochaOpts {

214

/** Test timeout in milliseconds */

215

timeout?: number;

216

/** Enable bail (stop on first failure) */

217

bail?: boolean;

218

/** Test UI (bdd, tdd, exports) */

219

ui?: string;

220

/** Grep pattern for test filtering */

221

grep?: string;

222

/** Invert grep pattern */

223

invert?: boolean;

224

/** Require modules before running tests */

225

require?: string[];

226

/** Mocha reporter */

227

reporter?: string;

228

/** Reporter options */

229

reporterOptions?: Record<string, any>;

230

/** Enable recursive file search */

231

recursive?: boolean;

232

/** Slow test threshold in milliseconds */

233

slow?: number;

234

/** Number of times to retry failed tests */

235

retries?: number;

236

[key: string]: any;

237

}

238

239

/**

240

* Jasmine test framework options

241

*/

242

interface JasmineOpts {

243

/** Default test timeout in milliseconds */

244

defaultTimeoutInterval?: number;

245

/** Helper files to load */

246

helpers?: string[];

247

/** Require modules before running tests */

248

requires?: string[];

249

/** Enable random test execution order */

250

random?: boolean;

251

/** Seed for random test order */

252

seed?: number;

253

/** Stop on first failure */

254

stopOnFailure?: boolean;

255

/** Enable one failure per spec */

256

oneFailurePerSpec?: boolean;

257

/** Spec files to include */

258

specFilter?: (spec: string) => boolean;

259

/** Grep pattern for test filtering */

260

grep?: string | RegExp;

261

/** Invert grep pattern */

262

invertGrep?: boolean;

263

[key: string]: any;

264

}

265

266

/**

267

* Cucumber test framework options

268

*/

269

interface CucumberOpts {

270

/** Feature files to include */

271

require?: string[];

272

/** Require modules before running tests */

273

requireModule?: string[];

274

/** Cucumber tags to include/exclude */

275

tags?: string;

276

/** Strict mode (fail on undefined steps) */

277

strict?: boolean;

278

/** Dry run (don't execute steps) */

279

dryRun?: boolean;

280

/** Fail fast (stop on first failure) */

281

failFast?: boolean;

282

/** Step timeout in milliseconds */

283

timeout?: number;

284

/** Number of times to retry failed scenarios */

285

retry?: number;

286

/** Retry only tagged scenarios */

287

retryTagFilter?: string;

288

/** World parameters */

289

worldParameters?: Record<string, any>;

290

/** Cucumber profile */

291

profile?: string[];

292

/** Name pattern for scenario filtering */

293

name?: string[];

294

/** Scenario line numbers */

295

scenarioLevelReporter?: boolean;

296

[key: string]: any;

297

}

298

}

299

}

300

```

301

302

**Usage Examples:**

303

304

```typescript

305

import type { Frameworks } from "@wdio/types";

306

307

// Custom test reporter using framework types

308

class CustomReporter {

309

onTestStart(test: Frameworks.Test) {

310

console.log(`Starting test: ${test.fullTitle}`);

311

}

312

313

onTestEnd(test: Frameworks.Test, result: Frameworks.TestResult) {

314

const status = result.passed ? 'PASSED' : 'FAILED';

315

console.log(`${status}: ${test.fullTitle} (${result.duration}ms)`);

316

317

if (!result.passed && result.error) {

318

console.error('Error:', result.error.message);

319

}

320

321

if (result.retries.attempts > 0) {

322

console.log(`Retried ${result.retries.attempts} times`);

323

}

324

}

325

326

onSuiteEnd(suite: Frameworks.Suite) {

327

console.log(`Suite completed: ${suite.fullTitle}`);

328

if (suite.duration) {

329

console.log(`Total duration: ${suite.duration}ms`);

330

}

331

}

332

333

onRunnerEnd(results: Frameworks.Results) {

334

console.log(`\nTest Summary:`);

335

console.log(`Total: ${results.finished}`);

336

console.log(`Passed: ${results.passed}`);

337

console.log(`Failed: ${results.failed}`);

338

}

339

}

340

341

// Cucumber step result handler

342

function handleCucumberStep(

343

step: Frameworks.PickleStep,

344

result: Frameworks.PickleResult

345

) {

346

const status = result.passed ? '✓' : '✗';

347

console.log(`${status} ${step.keyword}${step.text}`);

348

349

if (!result.passed && result.error) {

350

console.error(` Error: ${result.error}`);

351

}

352

353

if (result.duration) {

354

console.log(` Duration: ${result.duration}ms`);

355

}

356

}

357

358

// Framework configuration examples

359

const mochaConfig: WebdriverIO.MochaOpts = {

360

timeout: 60000,

361

bail: false,

362

ui: 'bdd',

363

grep: '@smoke',

364

retries: 2,

365

reporter: 'spec'

366

};

367

368

const jasmineConfig: WebdriverIO.JasmineOpts = {

369

defaultTimeoutInterval: 60000,

370

stopOnFailure: false,

371

random: true,

372

oneFailurePerSpec: false

373

};

374

375

const cucumberConfig: WebdriverIO.CucumberOpts = {

376

require: ['./step-definitions/**/*.ts'],

377

tags: '@smoke and not @skip',

378

strict: true,

379

failFast: false,

380

timeout: 60000,

381

retry: 1

382

};

383

```