But it also needs to be able to direct an application using many languages: English, Spanish, Mandarin, etc.
The Automate It! Test Automation Framework gives you the ability to do that and more:
- Text to speech conversion
- Playback in the audio of your computer or testing device
- Handle different accents and dialects
- Supports translation and speech to most other languages
It is incredibly simple to do, and there is an example in the framework.
Here are the steps:
- Download the code here: https://github.com/SWAutoTester/automateit
- Open a command-prompt terminal window, change directory to the root directory where you downloaded the framework
- type "ant example_texttospeech"
You will hear the following audio played on your computer: "Hello and Welcome to the Automate It Test Automation Framework" in both native english (no accent) and english-MX (english spoken with mexican/spanish accent), and native spanish (mexican accent).
It's really easy. Let's take a look at some code.
package org.automateit.example.test;
import org.testng.annotations.Test;
import org.automateit.test.TestBase;
import org.automateit.media.JarvisTextToSpeechConverter;
import org.automateit.media.TextToSpeechConverter;
import org.automateit.media.JLayerAudioPlayer;
import org.automateit.media.AudioPlayer;
/**
* This class shows an example of how to use the AutomateIt! framework
* for testing a text-to-speech application.
*
* @author mburnside
*/
public class TextToSpeechTests extends TestBase {
/**
* The text to speech converter used in this test
*/
protected TextToSpeechConverter textToSpeechConverter = new JarvisTextToSpeechConverter();
/**
* The audio player used in this test
*/
protected AudioPlayer audioPlayer = new JLayerAudioPlayer();
/**
* Read in a text that has a Welcome message and play the audio on the computer
*
* @throws Exception
*/
@Test(description = "Read in a text Hello There and play the audio on the computer", groups = { "example_texttospeech" })
public void test_A_Convert_Text_To_Speech_Welcome_Message_English() throws Exception {
try { audioPlayer.play(textToSpeechConverter.execute("Hello and welcome to the Automate It Test Automation Framework")); }
catch(Exception e) { throw e; }
}
/**
* Read in a text that has a Welcome message and play the audio on the computer
*
* @throws Exception
*/
@Test(description = "Read in a text Hello There and play the audio on the computer - Spanish accent", groups = { "example_texttospeech" })
public void test_B_Convert_Text_To_Speech_Welcome_Message_Spanish_Accent() throws Exception {
try { audioPlayer.play(textToSpeechConverter.execute("Hello and welcome to the Automate It Test Automation Framework", "es-MX")); }
catch(Exception e) { throw e; }
}
/**
* Read in a text that has a Welcome message and play the audio on the computer
*
* @throws Exception
*/
@Test(description = "Read in a text Hello There and play the audio on the computer - native spanish language", groups = { "example_texttospeech" })
public void test_C_Convert_Text_To_Speech_Welcome_Message_Spanish() throws Exception {
try { audioPlayer.play(textToSpeechConverter.execute("Hola, tu estas bueno tambien?", "es-MX")); }
catch(Exception e) { throw e; }
}
}
And that's it! Very simple, easy and fast.
In this example, it shows a demonstration of how easy text-to-speech conversion is using the framework and also the added flexibility of supporting:
- Many langauges
- Many languages with regional accents
Try it out and have fun adding it to your automated tests.