Giter Club home page Giter Club logo

botphus-core's Introduction

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);
    });
})();

botphus-core's People

Contributors

baka397 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.