<commit_before># Bot Tester for Bot Builder Framework [![CircleCI](https://circleci.com/gh/microsoftly/BotTester.svg?style=shield)](https://circleci.com/gh/microsoftly/BotTester) [![npm version](https://badge.fury.io/js/bot-tester.svg)](https://badge.fury.io/js/bot-tester) [![Coverage Status](https://coveralls.io/repos/github/microsoftly/BotTester/badge.svg?branch=master)](https://coveralls.io/github/microsoftly/BotTester?branch=master)
Simple framework that allows for easy testing of a botbuiler chatbot using mocha and chai.
## install
```bash
npm install --save bot-tester
```
## Class definitions, see the [BotTester Framework reference docs](https://microsoftly.github.io/BotTester/classes/_bottester_.bottester.html)
## config
config can be set one of 2 ways:

1. creating a bot-tester.json file in the root directory of your project.
2. passing in a config object into the options param, which is the last, when creating a BotTester instance


Passing in the config overrides any default values or values set by bot-tester.json. At the moment, the options are:
```typescript
{
    defaultAddress: botbuilder.IAddress,
    timeout: number // in milliseconds
    // each filter returns false for messages that the BotTester should ignore
    messageFilters: ((message:IMessage) => boolean)[],
    ignoreTypingEvent: boolean,
    ignoreEndOfConversationEvent: boolean,
    // Setting this to true will cause checkSession to hang and test to fail.
    ignoreInternalSaveMessage?: boolean;

} 
```
if timeout is defined, then a particular ```runTest()``` call will fail if it does not receive each expected message within the timeout period of time set in the options.

additionally, config can be set by using the config updating options in the build chain, documented below in the example use

For a more in depth view, check out [the Bot Tester Framework Config doc](https://microsoftly.github.io/BotTester/interfaces/_config_.iconfig.html)
# Example Usage
```javascript
import { IAddress, IMessage, Message, Prompts, Session, UniversalBot } from 'botbuilder';
import { expect } from 'chai';
import { BotTester, TestConnector } from 'bot-tester';

const connector = new TestConnector();

describe('BotTester', () => {
    let bot;

    beforeEach(() => {
        bot = new UniversalBot(connector);
    });

    // ... tests live here!
```

# Test for single response
```javascript<commit_msg>remove typescript notation from docs<commit_after># Bot Tester for Bot Builder Framework [![CircleCI](https://circleci.com/gh/microsoftly/BotTester.svg?style=shield)](https://circleci.com/gh/microsoftly/BotTester) [![npm version](https://badge.fury.io/js/bot-tester.svg)](https://badge.fury.io/js/bot-tester) [![Coverage Status](https://coveralls.io/repos/github/microsoftly/BotTester/badge.svg?branch=master)](https://coveralls.io/github/microsoftly/BotTester?branch=master)
Simple framework that allows for easy testing of a botbuiler chatbot using mocha and chai.
## install
```bash
npm install --save bot-tester
```
## Class definitions, see the [BotTester Framework reference docs](https://microsoftly.github.io/BotTester/classes/_bottester_.bottester.html)
## config
config can be set one of 2 ways:

1. creating a bot-tester.json file in the root directory of your project.
2. passing in a config object into the options param, which is the last, when creating a BotTester instance


Passing in the config overrides any default values or values set by bot-tester.json. At the moment, the options are:
```typescript
{
    defaultAddress: botbuilder.IAddress,
    timeout: number // in milliseconds
    // each filter returns false for messages that the BotTester should ignore
    messageFilters: ((message:IMessage) => boolean)[],
    ignoreTypingEvent: boolean,
    ignoreEndOfConversationEvent: boolean,
    // Setting this to true will cause checkSession to hang and test to fail.
    ignoreInternalSaveMessage: boolean;

} 
```
if timeout is defined, then a particular ```runTest()``` call will fail if it does not receive each expected message within the timeout period of time set in the options.

additionally, config can be set by using the config updating options in the build chain, documented below in the example use

For a more in depth view, check out [the Bot Tester Framework Config doc](https://microsoftly.github.io/BotTester/interfaces/_config_.iconfig.html)
# Example Usage
```javascript
import { IAddress, IMessage, Message, Prompts, Session, UniversalBot } from 'botbuilder';
import { expect } from 'chai';
import { BotTester, TestConnector } from 'bot-tester';

const connector = new TestConnector();

describe('BotTester', () => {
    let bot;

    beforeEach(() => {
        bot = new UniversalBot(connector);
    });

    // ... tests live here!
```

# Test for single response
```javascript
{'fraction_non_alphanumeric': 0.10754247824285122, 'fraction_numerical': 0.0012432656444260257, 'mean_word_length': 4.593279258400927, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 16, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7498115', 'n_tokens_mistral': 1397, 'n_tokens_neox': 1333, 'n_words': 491}