Skip to content

Commit 429fb9d

Browse files
committed
test(speech-to-text): Add tests for jobs and recognize
1 parent fbfa655 commit 429fb9d

File tree

1 file changed

+33
-2
lines changed

1 file changed

+33
-2
lines changed

test/IBM.WatsonDeveloperCloud.SpeechToText.v1.IntegrationTests/SpeechToTextServiceIntegrationTest.cs

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ public class SpeechToTextServiceIntegrationTest
5050
private string _acousticResourceUrl = "https://archive.org/download/Greatest_Speeches_of_the_20th_Century/KeynoteAddressforDemocraticConvention_64kb.mp3";
5151
private string _acousticResourceName = "firstOrbit";
5252
private string _acousticResourceMimeType = "audio/mpeg";
53+
private string _testAudioPath = @"SpeechToTextTestData/test-audio.wav";
5354
private SpeechToTextService _service;
5455

5556
[TestInitialize]
@@ -249,7 +250,7 @@ public void TestCustomLanguageModels_Success()
249250
#endregion
250251

251252
#region Acoustic Customizations
252-
//[TestMethod]
253+
[TestMethod]
253254
public void TestAcousticCustomizations()
254255
{
255256
byte[] acousticResourceData = null;
@@ -365,7 +366,37 @@ public void TestSessions_Success()
365366
Assert.IsTrue(getSessionStatusResult.Session.SessionId == createSessionResult.SessionId);
366367
}
367368
#endregion
368-
369+
370+
#region Recognize
371+
[TestMethod]
372+
public void TestRecognize_Success()
373+
{
374+
var testAudio = File.ReadAllBytes(_testAudioPath);
375+
var recognizeResult = _service.RecognizeSessionless(testAudio, "audio/wav");
376+
Assert.IsNotNull(recognizeResult);
377+
}
378+
#endregion
379+
380+
#region Jobs
381+
[TestMethod]
382+
public void TestJobs_Success()
383+
{
384+
var testAudio = File.ReadAllBytes(_testAudioPath);
385+
var createJobResult = _service.CreateJob(testAudio, "audio/mp3");
386+
var jobId = createJobResult.Id;
387+
388+
var checkJobsResult = _service.CheckJobs();
389+
var checkJobResult = _service.CheckJob(jobId);
390+
391+
var deleteJobResult = _service.DeleteJob(jobId);
392+
Assert.IsNotNull(checkJobsResult);
393+
Assert.IsNotNull(checkJobResult);
394+
Assert.IsNotNull(createJobResult);
395+
Assert.IsTrue(!string.IsNullOrEmpty(createJobResult.Id));
396+
Assert.IsNotNull(deleteJobResult);
397+
}
398+
#endregion
399+
369400
private void CheckCustomizationStatus(string classifierId)
370401
{
371402
var getLangaugeModelResult = _service.GetLanguageModel(classifierId);

0 commit comments

Comments
 (0)