Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I'm working now on my first bot with Microsoft Bot Framework, with ASP.NET.
After manually testing with the bot emulator, I'm looking for the best method to create automatic testing for the bot.
Considering two problems:
What is the best tool to automate such tests?
What is the best method to test a dialog that can return different answers to the same input?
One alternative is doing functional tests using DirectLine. The caveat is that the bot needs to be hosted but it's powerfull. Check out the AzureBot tests project to see how this works.
Another alternative, is doing what the BotFramework team is doing for some of their unit tests.
If you are using Dialogs, you can take a look to the EchoBot unit tests as they are simple to follow.
If you are using Chain, then take a look to how their are using the AssertScriptAsync method.
https://github.com/Microsoft/BotBuilder/blob/master/CSharp/Tests/Microsoft.Bot.Builder.Tests/ChainTests.cs#L360
https://github.com/Microsoft/BotBuilder/blob/master/CSharp/Tests/Microsoft.Bot.Builder.Tests/ChainTests.cs#L538
If you are looking for a way to mock up Luis Service, see this.
You may want to consider Selenium. Selenium is web browser automation software allowing you to write tests that programmatically read and write to the DOM of a web page. With a Selenium script you can:
login on any channel that provides a web client (and most of them do: WebChat, Telegram, Skype, Facebook, for example)
start a conversation with your bot
perform operations such as post a message to the chat and wait for a reply
test whether the reply is what you expected.
For automated testing of bots in Node.js, using ConsoleConnector in the same way as the tests in BotBuilder on GitHub works well, e.g. take a look at https://github.com/Microsoft/BotBuilder/blob/master/Node/core/tests/localization.js:
var assert = require('assert');
var builder = require('../');
describe('localization', function() {
this.timeout(5000);
it('should return localized prompt when found', function (done) {
var connector = new builder.ConsoleConnector();
var bot = new builder.UniversalBot(connector);
bot.dialog('/', function (session, args) {
session.send('id1');
});
bot.on('send', function (message) {
assert(message.text === 'index-en1');
done();
});
connector.processMessage('test');
});
...etc...
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I made a program. It tweets automatically every hour. What can I do to make it work when the computer is off. For example, there is an account called #everycolorbot, what is the working logic of this account?
You can do this with Azure Functions, where you only pay for compute time:
Create a new Functions project. Either in Visual Studio or On-Line. My preference is VS because I can keep the code in source control. You might need to open Visual Studio Installer and install Azure tools - either way, check out the docs at the Azure Functions link that I just posted here to make sure you're working with the latest info.
While creating the Functions project, choose a Timer trigger.
Take the defaults and it will create a new function project for you:
using Microsoft.Azure.WebJobs;
using Microsoft.Extensions.Logging;
namespace TweetMyStuff
{
public static class MyTweetBot
{
[FunctionName("MyTweetBot")]
public static void Run([TimerTrigger("0 * * * *")]TimerInfo myTimer, ILogger log)
{
// your tweet logic here
}
}
}
Notice that I set the chron setting on the TimerTrigger parameter attribute to "0 * * * *" This will start the function every hour on the hour. Azure has chron expression syntax documentation, which matches the Linux syntax (so you can find more information by a web search).
Finally, deploy and monitor - you can visit the QuickStart for Visual Studio to help you get started in the right direction.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I build Xamarin.Forms App using this tutorial:
https://learn.microsoft.com/en-us/azure/app-service-mobile/app-service-mobile-xamarin-forms-get-started
and I choose .NET back end.
I implement push notification for android and ios using this:
https://learn.microsoft.com/en-us/azure/app-service-mobile/app-service-mobile-xamarin-forms-get-started-push
and also implement authentication using this: https://learn.microsoft.com/en-us/azure/app-service-mobile/app-service-mobile-xamarin-forms-get-started-users
while choosing Facebook as my authentication provider.
My app is running and working great! but now I trying to add push notification to a specific user and I have few questions:
Is it possible to use the Facebook sid as the unique id and decide that if I want to send push to a specific user, I will do this using the Facebook sid?
I read that when the user does the authentication through Facebook, his Facebook sid is register automatically has a unique id and I can send to this Facebook id as a TAG and it will arrived to the specific user.
In this line of code: var result = await hub.SendTemplateNotificationAsync(templateParams);
that is located in my .NET back end code in the " public async Task PostTodoItem(TodoItem item) " method, I tried to add a TAG after the "templateParams" , I tried to enter the Facebook sid or the Installation id, is this correct?
If I want to send to a specific user, is that the place that I need to add his "TAG"?
Am I going the right way? can I choose the TAG to be the unique id and when I want to send push to a specific user, I will send to his TAG?
I Wanted to know how the user is register to a specific TAG? if the approach from the second question is correct.
*If you have a written code or different approach, I would really like to hear, I trying to implement the push to specific user for about 2 weeks and still did not succeed.
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 years ago.
Improve this question
How can I fetch an email, that has the subject I'm looking for in Hotmail using C#.
e.g. I want the emails(body/message) that has the word "Yahoo" in its subject.
Tried using many examples online but they weren't really clear. Thanks
You can connect to your hotmail account using the OpenPop.Net open source library. It has a lot of useful methods to communicate with a POP3 server. There is a lot of useful examples online. A simple code to connect to the POP3 server could work look this:
using(Pop3Client client = new Pop3Client())
{
client.Connect(hotmailHostName, pop3Port, useSsl);
client.Authenticate(username, password, AuthenticationMethod.UsernameAndPassword);
// And here you can use the client.GetMessage() method to get a desired message.
// You can iterate all the messages and check properties on each of them.
}
The hotmailHostName should be "pop3.live.com".
The pop3Port should be 995.
The useSsl should be true.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
Does anyone know of any working gvoice api? I have found this project:
http://sourceforge.net/projects/gvoicedotnet/
but the login appears to no longer work since the url changed some months ago.
Does anyone have a good question for sending out text messages to users of my website?
I found one: SharpGoogleVoice.
https://bitbucket.org/jitbit/sharpgooglevoice/downloads
It only has text messaging support, but it works well and looks like good work.
Self-promotion: my API, SharpVoice, works/worked quite well (hasn't been tested in some time): https://github.com/descention/sharp-voice
Voice voiceConnection = new Voice(loginEmail, loginPassword);
string response = voiceConnection.SendSMS(smsToPhoneNumber, smsMsgBody);
What you need is an SMS gateway that will let you send out text messages via an API. A quick Google search yields Zeep Mobile, which lets developers send SMS text messages for free from their application.
Because it's free, there may very well be some restrictions, but if you architect your app correctly using a strategy or adapter pattern then you should be able to replace this module later on down the road with something more advanced based on the needs of your application.
The primary restriction on the free plan is that it's ad-supported. This may very well be ok for you during initial development and testing, but your production users will likely find this to be a significant problem in using your service. Zeep does have a paid plan that eliminates the ads, and there are of course countless other SMS gateways that have API's that you can use for a fee.
You can get send messages with Twilio.
An example using the C# helper library:
https://www.twilio.com/docs/libraries/csharp
// Download the twilio-csharp library from twilio.com/docs/csharp/install
using System;
using Twilio;
class Example
{
static void Main(string[] args)
{
// Find your Account Sid and Auth Token at twilio.com/user/account
string AccountSid = "YOUR_ACCOUNT_SID";
string AuthToken = "YOUR_AUTH_TOKEN";
var twilio = new TwilioRestClient(AccountSid, AuthToken);
var message = twilio.SendMessage(
"+15017250604", "+15558675309",
"Hey Kyle! Glad you asked this question.",
new string[] { "http://farm2.static.flickr.com/1075/1404618563_3ed9a44a3a.jpg" }
);
Console.WriteLine(message.Sid);
}
}
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
Improve this question
I am use c# and for unit testing and integration testing usually I need to populate fields automatically based on attributes.
Lets say we will test if we can write and get back user data to database.
I create a user object populate fields write user to database
Read user object from database
Check fields if what I write is same as what I read
Is there any framework to populate user with test data automatically and check if two object are have the same values?
Sample code may like this
User user = new User();
AutoPopulator.Populate(user);
user.Save();
You might find it relevant. Here is a list of few other frameworks as of today:
Well-known and respected:
NBuilder
AutoFixture
AutoPoco(Discontinued / Deprecated)
Bogus - C# port of faker.js with locale support. Used by Elasticsearch (NEST).
Little-known:
Hydrator
Fabricator
Unfamiliar:
TestDataGenerator
TestDataFactory (Discontinued)
TestData
Any-.Net
Take a look at NBuilder. It lets you build test objects with random data, incrementing values, and anything you can probably think of. All through a nice fluent interface.
Yes there is. I found this when watching session #3 of the Summer of NHibernate series by Stephen Bohlen.
His company, Microdesk, has developed a utility that will allow you to save the state of a database on test fixture construction, set the state of the database at the start of every test, and recover the original state of the database on test fixture deconstruction.
Download the utility here: Microdesk.Utility.UnitTest
For a tutorial on how to use it, watch the Summer of NHibernate session #3 video.
Fluent NHibernate has a feature which gives you everything on your wish-list, except the auto-population part:
Link: http://wiki.fluentnhibernate.org/Persistence_specification_testing
However, given C# with code contracts, it wouldn't be to hard to auto-magically create valid objects yourself using reflection.