Defining Automated Test Cases#

It is possible to define test cases for a knowledge base within the wiki. For each test case the answers of questions together with the expected solutions are described. In the examples below, one test case for an "unpowered printer" and one test case for an "unconnected printer" is depicted.

%%TestCase
No power on printer {
   Please specify your problem = Printer does not print,
   Please check the power supply of the printer = Printer is not connected or power is off :
   No power supply (established);
}
%

%%TestCase
Unconnected printer {
   Please specify your problem = Printer does not print,
   Please check the power supply of the printer = Printer is connected and power is on,
   How is the printer connected to your computer = Connected by cable,
   Is the cable plugged into the printer and the computer = No :
   Cable not connected (established);
}
%

When inserting the test cases into an article, they are printed as below:

No power on printer { Please specify your problem = Printer does not print, Please check the power supply of the printer = Printer is not connected or power is off : No power supply (established); }

Unconnected printer { Please specify your problem = Printer does not print, Please check the power supply of the printer = Printer is connected and power is on, How is the printer connected to your computer = Connected by cable, Is the cable plugged into the printer and the computer = No : Cable not connected (established); }

Running Test Cases#

A test case player can be inserted into an article by using the following markup

%%TestCasePlayer 
@uses: Printer_Demo
%

Please note, that in the uses annotation the package name of your knowledge base project needs for be defined. When saving the article, the following interface is shown. Here users can play the test cases automatically and see whether the expected solutions are derived by the current version of the knowledge base.

Case Start: ---
Name
Time
Checks
Please specify your problem
Please check the power supply of the printer
0s
No power supply = ESTABLISHED
Printer does not print
Printer is not connected or power is off

Continuous Integration of Knowledge Bases#

The execution of test test cases can be automated by creating a continuous integration dashboard. Here, some static verification methods can be applied as well as the test cases. The following markup introduces a continuous integration dashboard:

%%CIDashboard 
  @trigger: onSave "Tutorial Printer Problems"
  @name: Continuous Integration of Printer Problems Knowledge Base
  
  @test ArticleHasErrors "Tutorial Printer Problems"
  @test TestCase "Tutorial Printer Testcases/No power on printer" "Tutorial Printer Problems"
  @test TestCase "Tutorial Printer Testcases/Unconnected printer" "Tutorial Printer Problems"
  
  @test CombinedFlowRuleAbstraction "Tutorial Printer Problems"
  @test CombinedFlowRuleSolution "Tutorial Printer Problems"
  @test NoAutostart "Tutorial Printer Problems"
  @test UnusedNode "Tutorial Printer Problems"
  @test UnusedFlow "Tutorial Printer Problems"
%

When saving the article, the following dashboard appears:

health-80plusContinuous Integration of Printer Problems Knowledge Base0 %Build running...

Build #113 (Dec 10, 2018 10:23:35 AM) in 194 msec.

ArticleHasErrors( "Tutorial Printer Problems" )
TestCase( "Tutorial Printer Testcases/No power on printer" "Tutorial Printer Problems" )
TestCase( "Tutorial Printer Testcases/Unconnected printer" "Tutorial Printer Problems" )
DiaFlux:CombinedFlowRuleAbstraction( "Tutorial Printer Problems" )
DiaFlux:CombinedFlowRuleSolution( "Tutorial Printer Problems" )
DiaFlux:NoAutostart( "Tutorial Printer Problems" )
DiaFlux:UnusedNode( "Tutorial Printer Problems" )
DiaFlux:UnusedFlow( "Tutorial Printer Problems" )

Add new attachment

Only authorized users are allowed to upload new attachments.

List of attachments

Kind Attachment Name Size Version Date Modified Author Change note
xml
ci-build-Continuous-Integratio... 1.8 kB 113 10-Dec-2018 10:23 ci-process
This page (revision-26) was last changed on 23-Jun-2015 15:04 by Albrecht Striffler