Skip to content

mjvoss/assistant-javatester

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

assistant-javatester

Sample code and utilities for building unit tests with Watson Assistant.

Includes examples for unit testing:

  • Standalone dialog (via code)
  • Standalone dialog (via configuration file)
  • Dialog with custom orchestration layer

This project extends from the Java SDK for Watson Assistant and uses JUnit 4.x.

Standalone dialog (via code)

ExampleTest_Code.java demonstrates how to test a Watson Assistant dialog by writing tests entirely in code. This allows maximal control of your tests, including ability to group common setup into shared functions.

Standalone dialog (via configuration file)

ExampleTest_Parameterized.java uses a JUnit Parameterized test so that you can write your tests via configuration only. The sample configuration file format is as follows:

#testname,initial_context_var_name,initial_context_var_value
turn1_utterance,turn1_expected_response_substring,expected_context_var_name,expected_context_value
turn2_utterance,turn2_expected_response_substring,expected_context_var_name,expected_context_value

Each line can have 0-n context variable name/value pairs. Expected response substrings are also optional.

Dialog with custom orchestration layer

ExampleTest_Orchestrator.java demonstrates testing a conversational system that includes a simple orchestration layer. The test makes use of test doubles, however you can also use mocks to similar effect. Loose coupling in your orchestration layer is critical to enabling easy unit testing.

About

Unit Testing examples for Watson Assistant

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%