botphus-core

Core testing lib for botphus

botphus-core has been moved to @botphus/server-runner, please check detail in npm
Last updated a year ago by cqggff .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install botphus-core 
SYNC missed versions from official npm registry.

botphus-core

botphusCorebotphus的核心测试程序,通过底层使用puppeteer提供web测试单元任务配置和执行.

build status codecov.io node version

功能特性

  • 使用任务单元组成的测试任务,可以按需执行特定部分.如:
    • 执行Web页面测试
    • 连接数据库/Redis缓存进行数据验证
    • Web页面事件捕获
  • 服务端和PC客户端均可使用

索引

快速使用

安装

npm install botphus-core --save

构建

npm run build

使用

import BotphusCore, {TaskMessage, TaskType, TaskTypeDomSubType} from 'botphus-core';
const botphusCore = new BotphusCore();
(async () => {
    // Create task cache file
    const taskNo = await botphusCore.createTask('Test task', new Date().getTime(), [
        {
            argments: ['div'],
            assertion: ['data === "wrong assertion rule"'],
            subType: TaskTypeDomSubType.SUB_TYPE_GET_TEXT,
            type: TaskType.TYPE_DOM
        }
    ]);
    // Start task & listen child process message
    const subProcess = await botphusCore.startTask(taskNo, 'https://bing.com/');
    // Get task exec message info
    subProcess.on('message', ([error, messageData]: TaskMessage) => {
        if (error) {
            global.console.log(error.stack);
        }
        global.console.log(messageData);
    });
    // Process close
    subProcess.on('close', (code) => {
        global.console.log('done:', code);
    });
})();

Current Tags

  • 0.3.4                                ...           latest (a year ago)

12 Versions

  • 0.3.4 [deprecated]           ...           a year ago
  • 0.3.3 [deprecated]           ...           a year ago
  • 0.3.2 [deprecated]           ...           a year ago
  • 0.3.1 [deprecated]           ...           a year ago
  • 0.3.0 [deprecated]           ...           a year ago
  • 0.2.2 [deprecated]           ...           a year ago
  • 0.2.1 [deprecated]           ...           a year ago
  • 0.2.0 [deprecated]           ...           a year ago
  • 0.1.3 [deprecated]           ...           a year ago
  • 0.1.2 [deprecated]           ...           a year ago
  • 0.1.1 [deprecated]           ...           a year ago
  • 0.1.0 [deprecated]           ...           a year ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 3
Last Day 0
Last Week 0
Last Month 14
Dependencies (12)
Dev Dependencies (13)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |