Chatbots are responding often with references to other sources. This might be just the link to a webpage, an image or a button. You don’t want to display the user an 404 page or an error. To cover if those links exist we created the HyperLinkAsserter. It automatically detects all links (Buttons, Cards, Images or simple references) and will check if those are reachable and delivering the correct http response code.
Chatbot Hyperlink Existence Asserter
Botium Tools & Settings > Settings > COMPONENTS > Chatbot Hyperlink
Existence Asserter
. (for arguments, see below)Example in the Convo Editor
www.google.com
and
www.facebook.com
exist in the bot response.Example Botium Script
#me
Give me some links
#bot
HASLINK www.google.com|www.facebook.com
Chatbot Hyperlink Response Asserter
Botium Tools
& Settings > Settings > COMPONENTS > Chatbot Hyperlink Response
Asserter
Example in the Convo Editor
Example Usage of the Hyperlink Response Asserter
Give me links
#me
Hi
#bot
Goodday, How can I help you?
#me
Can you give me some links
#bot
Here you go: www.google.com, https://flippingbook.com/404 https://de.wikipedia.org
Easy,
right? Everything works great, chatbot. Let’s go live with our amazing chatbot!After 5 minutes, we encountered the first issue. Someone tried to visit:
https://flippingbook.com/404
. Oops! It's not there anymore.
Enter the HyperLinkAsserter
restaurant
#me
Hi
#bot
Goodday, How can I help you?
#me
Can you give me some links
#bot
There you go: www.google.com, https://flippingbook.com/404 https://de.wikipedia.org
CHECKLINK 200
Now if we run this test again this will present an error so
we can fix the
link.Error: Line 15: FAILURE: https://flippingbook.com/404 Not Found Actual: 404 Expected: 200
at Promise.all.then.results
(/Users/stefan-sev/IdeaProjects/botium-box/packages/botium-asserter-hyperlink/src/HyperLinkAsserter.js:105:31)
at process.internalTickCallback
(internal/process/next_tick.js:77:7)
at ScriptingProvider.fail
(/Users/stefan-sev/IdeaProjects/botium-box/packages/botium-asserter-hyperlink/samples/sample1/node_modules/botium-core/src/scripting/ScriptingProvider.js:99:15)
at scriptingEvents.assertConvoStep.then.then.catch
(/Users/stefan-sev/IdeaProjects/botium-box/packages/botium-asserter-hyperlink/samples/sample1/node_modules/botium-core/src/scripting/Convo.js:218:42)
at process.internalTickCallback
(internal/process/next_tick.js:77:7)
Result
Great! Now we clearly see that our chatbot references a non existing page
https://flippingbook.com/404
. Once this link is removed our
tests are passing again and your customer will get all the information they
need.
This was a basic example for the usage of the hyperlink asserter. For more configuration options please read further.
Configuration Options
Botium Tools & Settings > Settings >
COMPONENTS > choose the relevant hyperlink asserter you wish to
edit
.Parameter | Description | Example |
baseUrl | If you test only links within your domain you can define a baseUrl. This will be concatenated with relative links in the response of the bot |
If we get a response with <a
href=”/img/logo.png”/> this will resolve to
https://www.botium.com/img/logo.png
|
httpStatus | this will set a list of valid HttpStatuses for the links |
HTTP statuses 200 (OK), 204 (No Content), and 301
(Redirect) are valid response codes in this example. |
maxRedirects | this is the depth of http redirects, which the hyperlink asserter is traversing. This might be handy if you are behind a corporate proxy. |
If we get the link https://de.wikipedia.org we want
redirect to https://de.wikipedia.org/wiki/Wikipedia:Hauptseite.
Instead we check the first response code, which is in this
scenario 301 (redirect). |
timeout | HTTP request timeout in milliseconds (default: 10000 = 10 seconds) |
In case you expect slow network traffic, increase this timeout |
extractFromSourceData | Include “sourceData” structure for detecting hyperlinks (default: false). This is useful for custom chatbot implementations with custom information attached not part of the Botium structures (see How to develop your own Botium Connector). |
|
Convo Settings
If you need specific settings to the convo step you can override the global settings and defaults with the convo settings.
Parameter | Description | Example |
httpStatus | Set the desired, valid http response codes for the links send by the bot |
There are to options to configure this in the convo file
Both configurations will produce the same result: verifying that all links in the bot's response return HTTP status 200, 204, or 301. |
maxRedirects | Define the max depth of the redirects for links |
For the maxRedirects there is just the structured
configuration
available.
In
this example the bot response with an redirect, but we are
not interested if the redirect is valid. So we are just
checking if the first url return status code 301
(redirect) |
timeout | HTTP request timeout in milliseconds |
Only structured configuration
possible
|