Deno &JavaScript之测试

发表于:2020-9-28 09:33

字体: | 上一篇 | 下一篇 | 我要投稿

 作者:逍遥_乔治    来源:掘金

  目标使用
  0. Deno 测试
  1. Jest API 以及使用方法
  2. Jest 与微信小程序
  3. Jest 与 Vue 测试
  4. Jest 与 React 测试
  Deno 测试
  测试风格:
  传统的测试风格,类似于 Jest 等等
  对象描述测试风格
  性能测试
  传统的测试方法
  API: Deno.test 函数
const { test } = Deno;
test('测试描述', () => {
    // 需要测试的代码
})
test("hello world", () => {
  const x = 1 + 2;
  if (x !== 3) {
    throw Error("x should be equal to 3");
  }
});
  对象描述测试风格
import { assertEquals } from "https://deno.land/std/testing/asserts.ts";
const { test } = Deno;

test({
  name: "testing example",
  fn(): void {
    assertEquals("world", "world");
    assertEquals({ hello: "world" }, { hello: "world" });
  },
});
  使用断言
import { assertEquals } from "https://deno.land/std/testing/asserts.ts";
const { test } = Deno;

test("hello world", () => {
  const x = 1 + 2;
  assertEquals(x, 3);
});
  API列表
  Deno 性能测试
  Deno 是一个比较完整的框架也好也好,周边都做的比较完整了,性能测试也成了其中的一环。

  本文内容不用于商业目的,如涉及知识产权问题,请权利人联系51Testing小编(021-64471599-8017),我们将立即处理
《2023软件测试行业现状调查报告》独家发布~

关注51Testing

联系我们

快捷面板 站点地图 联系我们 广告服务 关于我们 站长统计 发展历程

法律顾问:上海兰迪律师事务所 项棋律师
版权所有 上海博为峰软件技术股份有限公司 Copyright©51testing.com 2003-2024
投诉及意见反馈:webmaster@51testing.com; 业务联系:service@51testing.com 021-64471599-8017

沪ICP备05003035号

沪公网安备 31010102002173号