You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nlpcraft.apache.org by ar...@apache.org on 2020/05/26 23:59:57 UTC
[incubator-nlpcraft-website] branch web-site updated: Added test
framework docs.
This is an automated email from the ASF dual-hosted git repository.
aradzinski pushed a commit to branch web-site
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft-website.git
The following commit(s) were added to refs/heads/web-site by this push:
new a9b9553 Added test framework docs.
a9b9553 is described below
commit a9b9553870931d4b4a54f0ebe2643d344db68105
Author: Aaron Radzinzski <ar...@datalingvo.com>
AuthorDate: Tue May 26 16:59:29 2020 -0700
Added test framework docs.
---
.../nlpcraft/model/tools/test/NCTestClient.html | 2 +-
.../nlpcraft/model/tools/test/NCTestClient.html | 2 +-
feed.xml | 2 +-
tools/test_framework.html | 31 +++++++++++++++++++++-
4 files changed, 33 insertions(+), 4 deletions(-)
diff --git a/apis/javadoc-0.5.0/org/apache/nlpcraft/model/tools/test/NCTestClient.html b/apis/javadoc-0.5.0/org/apache/nlpcraft/model/tools/test/NCTestClient.html
index fb2aafb..298b46e 100644
--- a/apis/javadoc-0.5.0/org/apache/nlpcraft/model/tools/test/NCTestClient.html
+++ b/apis/javadoc-0.5.0/org/apache/nlpcraft/model/tools/test/NCTestClient.html
@@ -106,7 +106,7 @@ var activeTableTab = "activeTableTab";
<br>
<pre>public interface <span class="typeNameLabel">NCTestClient</span></pre>
<div class="block">Model testing client. This client can be used for convienient unit testing of the models together
- with any popular unit testing framework such as <a href="http://www.testng.org">TestNG</a> or
+ with any popular unit testing framework such as <a href="https://testng.org">TestNG</a> or
<a href="https://junit.org">JUnit</a>. The instance of test client should be obtained
via <a href="../../../../../../org/apache/nlpcraft/model/tools/test/NCTestClientBuilder.html" title="class in org.apache.nlpcraft.model.tools.test"><code>NCTestClientBuilder</code></a>.
<p>
diff --git a/apis/latest/org/apache/nlpcraft/model/tools/test/NCTestClient.html b/apis/latest/org/apache/nlpcraft/model/tools/test/NCTestClient.html
index fb2aafb..298b46e 100644
--- a/apis/latest/org/apache/nlpcraft/model/tools/test/NCTestClient.html
+++ b/apis/latest/org/apache/nlpcraft/model/tools/test/NCTestClient.html
@@ -106,7 +106,7 @@ var activeTableTab = "activeTableTab";
<br>
<pre>public interface <span class="typeNameLabel">NCTestClient</span></pre>
<div class="block">Model testing client. This client can be used for convienient unit testing of the models together
- with any popular unit testing framework such as <a href="http://www.testng.org">TestNG</a> or
+ with any popular unit testing framework such as <a href="https://testng.org">TestNG</a> or
<a href="https://junit.org">JUnit</a>. The instance of test client should be obtained
via <a href="../../../../../../org/apache/nlpcraft/model/tools/test/NCTestClientBuilder.html" title="class in org.apache.nlpcraft.model.tools.test"><code>NCTestClientBuilder</code></a>.
<p>
diff --git a/feed.xml b/feed.xml
index 38e5530..3f36bef 100644
--- a/feed.xml
+++ b/feed.xml
@@ -1 +1 @@
-<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.8.5">Jekyll</generator><link href="http://localhost:4000/feed.xml" rel="self" type="application/atom+xml" /><link href="http://localhost:4000/" rel="alternate" type="text/html" /><updated>2020-05-25T12:19:23-07:00</updated><id>http://localhost:4000/feed.xml</id><title type="html">Apache NLPCraft</title></feed>
\ No newline at end of file
+<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.8.5">Jekyll</generator><link href="http://localhost:4000/feed.xml" rel="self" type="application/atom+xml" /><link href="http://localhost:4000/" rel="alternate" type="text/html" /><updated>2020-05-26T16:56:28-07:00</updated><id>http://localhost:4000/feed.xml</id><title type="html">Apache NLPCraft</title></feed>
\ No newline at end of file
diff --git a/tools/test_framework.html b/tools/test_framework.html
index 6999302..2ef8d65 100644
--- a/tools/test_framework.html
+++ b/tools/test_framework.html
@@ -15,4 +15,33 @@
limitations under the License.
-->
-<!doctype html><html lang="en"><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><meta name="description" content="An open source API to convert natural language into actions."><meta name="author" content="NLPCraft."><link rel="apple-touch-icon" sizes="144x144" href="/apple-touch-icon.png"><link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"><link rel="icon" [...]
+<!doctype html><html lang="en"><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><meta name="description" content="An open source API to convert natural language into actions."><meta name="author" content="NLPCraft."><link rel="apple-touch-icon" sizes="144x144" href="/apple-touch-icon.png"><link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"><link rel="icon" [...]
+public class AlarmTest {
+ private NCTestClient cli;
+
+ @BeforeEach
+ void setUp() throws NCException, IOException {
+ NCEmbeddedProbe.start(AlarmModel.class);
+
+ cli = new NCTestClientBuilder().newBuilder().build();
+
+ cli.open("nlpcraft.alarm.ex");
+ }
+
+ @AfterEach
+ void tearDown() throws NCException, IOException {
+ if (cli != null)
+ cli.close();
+
+ NCEmbeddedProbe.stop();
+ }
+
+ @Test
+ public void test() throws NCException, IOException {
+ // Should be passed.
+ assertTrue(cli.ask("Ping me in 3 minutes").isOk());
+ assertTrue(cli.ask("Buzz me in an hour and 15mins").isOk());
+ assertTrue(cli.ask("Set my alarm for 30s").isOk());
+ }
+}
+ </pre><p> Few notes:</p><ul><li> Before each unit test execution on line 8 we create new instance of <code>NCTestClient</code> using client builder with default configuration. On line 10 we open test client connection for model with ID <code>nlpcraft.alarm.ex</code>.<li> After each test execution we close test client connection on line 16.<li> On lines 24-26 we submit ("ask") test sentences to our model and check for succesfull processing.</ul><div class="bq info"><p> <b>Embedded [...]