Vodafone Test Suite

Dependencies:   mbed-rtos mbed HTTPClient VodafoneUSBModem

Files at this revision

API Documentation at this revision

Comitter:
nherriot
Date:
Mon Sep 10 04:59:11 2012 +0000
Parent:
23:408199b5d2cb
Child:
29:c0e6f198db84
Commit message:
Adding details to test case 16 and 13 where each test depends on one to send and one to receive. Also removing constants to VodafoneTestCase.h to have them in one place for all tests. Created several const char strings for all test cases.

Changed in this revision

TestManager.cpp Show annotated file Show diff for this revision Revisions of this file
Tests/Test13.h Show annotated file Show diff for this revision Revisions of this file
Tests/Test16.h Show annotated file Show diff for this revision Revisions of this file
Tests/Tests.h Show annotated file Show diff for this revision Revisions of this file
VodafoneTestCase.h Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/TestManager.cpp	Wed Sep 05 16:38:06 2012 +0000
+++ b/TestManager.cpp	Mon Sep 10 04:59:11 2012 +0000
@@ -7,11 +7,13 @@
    _tests.push_back((VodafoneTestCase*)new Test10(_modem,10));
    
    for(int i=11; i<12; i++) {  _tests.push_back(NULL); }
-   
    _tests.push_back((VodafoneTestCase*)new Test12(_modem,12));
    _tests.push_back((VodafoneTestCase*)new Test13(_modem,13));
    
-   for(int i=14; i<21; i++) { _tests.push_back(NULL); }
+   for(int i=14; i<16; i++) { _tests.push_back(NULL); }
+   _tests.push_back((VodafoneTestCase*)new Test16(_modem,16));
+
+   for(int i=17; i<21; i++) { _tests.push_back(NULL); }
    
    _tests.push_back((VodafoneTestCase*)new Test21(_modem,21));
    _tests.push_back((VodafoneTestCase*)new Test22(_modem,22));
--- a/Tests/Test13.h	Wed Sep 05 16:38:06 2012 +0000
+++ b/Tests/Test13.h	Mon Sep 10 04:59:11 2012 +0000
@@ -1,65 +1,67 @@
-#pragma once
-#include "VodafoneTestCase.h"
-
-#define TEST_PHONE_NUMBER "+447717275049"
-
-// this test case will wait to receive an SMS from the modem.
-// if the method that reports a message waiting returns an error it will fail.
-// if the method that returns the message from the mailbox returns an error it will fai.
-// it will report the test as failed if any of the above happens.
-// it waits forever for an SMS.
-// TODO: this should wait for a set time before failing.
-
-
-class Test13 : public VodafoneTestCase {
-   public: 
-
-      char num[17];
-      char msg[64];
-      size_t count;
-      
-
-      Test13(VodafoneUSBModem *m, int tcNumber) : VodafoneTestCase(m, tcNumber) {
-      }
-   
-      virtual bool runTest() {
-         LOG("Test %d waiting for an SMS message...", _testCaseNumber);
-         LOG("Receiving SMS from test phone, waiting for response.");
-      
-         while(true)
-            {
-             LOG("Waiting for an SMS message...");
-             int ret = _modem->getSMCount(&count);
-             if(ret)
-                {
-                    LOG("getSMCount returned %d", ret);
-                    Thread::wait(3000);
-                    continue;
-                }
-    
-             if( count > 0)
-                {
-                    LOG("%d SMS to read", count);
-                    ret = _modem->getSM(num, msg, 64);
-                if(ret)
-                    {
-                        LOG("Error receiving sms. The method getSMS  returned %d", ret);
-                        return false;
-                    }
-                LOG("The message is from number: %s and the message is: \"%s\"", num, msg);
-                return true;
-                }
-                Thread::wait(500);
-            }
-                  
-      }
-
-   private:
-      char gsm03dot38CharacterSet[127];
-      // gsm03dot38CharacterSet="@£$¥èéùìòÇØøÅåΔ_ΦΓΛΩΠΨΣΘΞÆæßÉ !“#¤%&‘()*+,-./0123456789:;<=>?¡ABCDEFGHIJKLMNOPQRSTUVWXYZÄÖÑܧ¿abcdefghijklmnopqrstuvwxyzäöñüà";
-            
-
-
-
-
+#pragma once
+#include "VodafoneTestCase.h"
+
+
+// this test case will wait to receive an SMS from the modem.
+// if the method that reports a message waiting returns an error it will fail.
+// if the method that returns the message from the mailbox returns an error it will fai.
+// it will report the test as failed if any of the above happens.
+// it waits forever for an SMS.
+// TODO: this should wait for a set time before failing.
+
+
+class Test13 : public VodafoneTestCase {
+   public: 
+
+      char num[17];
+      char msg[64];
+      size_t count;
+      
+
+      Test13(VodafoneUSBModem *m, int tcNumber) : VodafoneTestCase(m, tcNumber) {
+      }
+   
+      virtual bool runTest() {
+         LOG("Creating GSM test buffer");
+         LOG("Test %d waiting for an SMS message...", _testCaseNumber);
+         LOG("Receiving SMS from test phone, waiting for response.");
+      
+         while(true)
+            {
+             LOG("Waiting for an SMS message...");
+             int ret = _modem->getSMCount(&count);
+             if(ret)
+                {
+                    LOG("getSMCount returned %d", ret);
+                    Thread::wait(3000);
+                    continue;
+                }
+    
+             if( count > 0)
+                {
+                    LOG("%d SMS to read", count);
+                    ret = _modem->getSM(num, msg, 64);
+                if(ret)
+                    {
+                        LOG("Error receiving sms. The method getSMS  returned %d", ret);
+                        LOG("THE MESSAGE IS: %S", testMessage);
+                        LOG("THE MESSAGE IS: %S", myMessage);
+                        return false;
+                    }
+                LOG("The message is from number: %s and the message is: \"%s\"", num, testMessage);
+                return true;
+                }
+                Thread::wait(500);
+            }
+                  
+      }
+
+   private:
+      char gsm03dot38CharacterSet[127];
+      // gsm03dot38CharacterSet="@�$�����������&#916;_&#934;&#915;&#923;&#937;&#928;&#936;&#931;&#920;&#926;���� !�#�%&�()*+,-./0123456789:;<=>?�ABCDEFGHIJKLMNOPQRSTUVWXYZ���ܧ�abcdefghijklmnopqrstuvwxyz�����";
+            
+
+
+
+
 };
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Tests/Test16.h	Mon Sep 10 04:59:11 2012 +0000
@@ -0,0 +1,46 @@
+#pragma once
+#include "VodafoneTestCase.h"
+//#define __DEBUG__ 1
+
+// this test case will wait to send an SMS from the modem.
+// if the method that sends a message returns an error it will fail.
+// it will report the test as failed if any of the above happens.
+// it does not wait after it has succesfully sent an SMS.
+
+
+class Test16 : public VodafoneTestCase {
+   public: 
+
+
+      Test16(VodafoneUSBModem *m, int tcNumber) : VodafoneTestCase(m, tcNumber) {
+      }
+   
+      virtual bool runTest() {
+         LOG("Creating GSM test buffer");
+         LOG("Test %d sending an SMS message...", _testCaseNumber);
+         LOG("Sending SMS:' %s ' to test phone: %s , waiting for response.", testMessage, testPhoneNumber);
+         
+         int ret = _modem->sendSM(testPhoneNumber, testMessage);
+         
+         if (ret)
+            {
+                LOG("Error in sending the SMS message. The return values is: %d", ret);
+                
+                switch(ret){
+                    case(NET_INVALID): LOG("Error message is: 'phone number is invalid size, must be less than 16 digits'.");break;
+                    case(NET_PROTOCOL): LOG("Error message is: 'protocol error from the modem'.");break;
+                    default: LOG("Undefined error message.");         
+
+                }
+                return false;
+            }
+         LOG("Test %d passed...", _testCaseNumber);
+         return true;
+                  
+      }
+
+   private:
+      char gsm03dot38CharacterSet[127];
+
+
+};
\ No newline at end of file
--- a/Tests/Tests.h	Wed Sep 05 16:38:06 2012 +0000
+++ b/Tests/Tests.h	Mon Sep 10 04:59:11 2012 +0000
@@ -2,6 +2,7 @@
 #include "Test10.h"
 #include "Test12.h"
 #include "Test13.h"
+#include "Test16.h"
 #include "Test21.h"
 #include "Test22.h"
 #include "Test23.h"
@@ -13,8 +14,8 @@
 static const int gNumAllTests = 9;
 static const int gAutomatedTests[] = {10,21,22,23,25,26};
 static const int gNumAutomatedTests = 6;
-static const int gInteractiveTests[] = {12,13};
-static const int gNumInteractiveTests = 2;
+static const int gInteractiveTests[] = {16,12,13};
+static const int gNumInteractiveTests = 3;
 static const int gSoakTests[] = {50};
 static const int gNumSoakTests = 1;
 
@@ -39,4 +40,5 @@
    gNumAutomatedTests,
    gNumInteractiveTests,
    gNumSoakTests
-};
\ No newline at end of file
+};
+
--- a/VodafoneTestCase.h	Wed Sep 05 16:38:06 2012 +0000
+++ b/VodafoneTestCase.h	Mon Sep 10 04:59:11 2012 +0000
@@ -1,6 +1,17 @@
 #pragma once
 #include "VodafoneUSBModem.h"
 #include "LogHeader.h"
+
+const char myMessage[] = "myMessage is golden";
+const char testPhoneNumber[] = "+447785666088";
+const char testMessage[] = "this is a test message !";
+const char allCharsMessage[] = "abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ[]{}()!£$%&*,.':;";
+
+//const char testMessage[] = "this is a test message !�$%^&*()_+=[][{};:@#~,.<>/?\|";
+
+//#define GSM03DOT38CHARSET "@�$�����������&#916;_&#934;&#915;&#923;&#937;&#928;&#936;&#931;&#920;&#926;���� !�#�%&�()*+,-./0123456789:;<=>?�ABCDEFGHIJKLMNOPQRSTUVWXYZ���ܧ�abcdefghijklmnopqrstuvwxyz�����";
+
+
 class VodafoneTestCase {
    public:
       VodafoneTestCase(VodafoneUSBModem *m, int tcNumber) : _modem(m),  _testCaseNumber(tcNumber) , _lastRunTime(0), _lastRunOutcome(false){
--- a/main.cpp	Wed Sep 05 16:38:06 2012 +0000
+++ b/main.cpp	Mon Sep 10 04:59:11 2012 +0000
@@ -24,7 +24,7 @@
   LOG("Constructing TestManager");
   TestManager *m = new TestManager(&modem);
   LOG("Running tests.");
-  TestProfile profile = TESTS_AUTOMATED;
+  TestProfile profile = TESTS_MANUAL;
   int numPassed = m->executeTestProfile(profile);
   int numTests = m->getTestProfileLength(profile);
   LOG("%d tests complete: %d passes and %d failures.",numTests,numPassed,numTests-numPassed);