Vodafone Test Suite
Dependencies: mbed-rtos mbed HTTPClient VodafoneUSBModem
Revision 31:9231acdde9ff, committed 2012-09-12
- Comitter:
- nherriot
- Date:
- Wed Sep 12 16:55:00 2012 +0000
- Parent:
- 30:dd2beda340c6
- Child:
- 33:16126e029d58
- Commit message:
- adding new sms test cases for send/receive irregular chars. changing auto run list, and adding descriptions.
Changed in this revision
--- a/TestManager.cpp Wed Sep 12 10:18:28 2012 +0000 +++ b/TestManager.cpp Wed Sep 12 16:55:00 2012 +0000 @@ -27,7 +27,10 @@ for(int i=27; i<50; i++) { _tests.push_back(NULL); } _tests.push_back((VodafoneTestCase*)new Test50(_modem,50)); - _tests.push_back((VodafoneTestCase*)new Test56(_modem,45)); + + for(int i=51; i<56; i++) { _tests.push_back(NULL); } + + _tests.push_back((VodafoneTestCase*)new Test56(_modem,56)); } int TestManager::getTestProfileLength(TestProfile profile) { @@ -61,7 +64,7 @@ for(int i=0; i<listLen; i++) { int testIndex = list[i]; if(testIndex>=_tests.size()) { - LOG("Test out of bounds. Test index must be betweeen 0 and %d!",_tests.size()); + LOG("Test out of bounds... Test index must be betweeen 0 and %d!",_tests.size()); continue; }
--- a/Tests/Test12.h Wed Sep 12 10:18:28 2012 +0000 +++ b/Tests/Test12.h Wed Sep 12 16:55:00 2012 +0000 @@ -1,7 +1,7 @@ #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. @@ -10,14 +10,14 @@ // it waits forever for an SMS. // TODO: this should wait for a set time before failing. -static const char *gTest12Description = "Waiting for an SMS message..."; -//const int gTest12Depends[] = {}; +static const char *gTest12Description = "Waiting for an SMS message with basic characters and numbers..."; + class Test12 : public VodafoneTestCase { public: char num[17]; - char msg[64]; + char msg[160]; size_t count; Test12(VodafoneUSBModem *m, int tcNumber) : VodafoneTestCase(m, tcNumber) { @@ -43,16 +43,22 @@ { 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; + 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); + if (strcmp (msg, alphabetNumbersMessage) ==0) + { + LOG("Success receiving alphabet message matches the sent message"); + return true; + } + + return false; } Thread::wait(500); } } -}; \ No newline at end of file +};
--- a/Tests/Test13.h Wed Sep 12 10:18:28 2012 +0000 +++ b/Tests/Test13.h Wed Sep 12 16:55:00 2012 +0000 @@ -10,14 +10,14 @@ // it waits forever for an SMS. // TODO: this should wait for a set time before failing. -static const char *gTest13Description = "Waiting for an SMS message..."; -//const int gTest13Depends[] = {}; +static const char *gTest13Description = "Waiting for an SMS message with irregular characters and numbers"; + class Test13 : public VodafoneTestCase { public: char num[17]; - char msg[64]; + char msg[160]; size_t count; @@ -43,13 +43,20 @@ { 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; + + 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); + if (strcmp (msg, irregularMessage) ==0) + { + LOG("Success receiving alphabet message matches the sent message"); + return true; + } + + return true; } Thread::wait(500); } @@ -57,7 +64,5 @@ } private: - char gsm03dot38CharacterSet[127]; - // gsm03dot38CharacterSet="@£$¥èéùìòÇØøÅåΔ_ΦΓΛΩΠΨΣΘΞÆæßÉ !“#¤%&‘()*+,-./0123456789:;<=>?¡ABCDEFGHIJKLMNOPQRSTUVWXYZÄÖÑܧ¿abcdefghijklmnopqrstuvwxyzäöñüà"; }; \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Tests/Test14.h Wed Sep 12 16:55:00 2012 +0000 @@ -0,0 +1,85 @@ +#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. +// this test basic characters and numbers can be sent via SMS. + +static const char *gTest14Description = "Send an SMS message with irregular characters and numbers..."; + + +class Test14 : public VodafoneTestCase { + public: + + + Test14(VodafoneUSBModem *m, int tcNumber) : VodafoneTestCase(m, tcNumber) { + } + + + virtual bool runTest() { + + LinkMonitor::REGISTRATION_STATE regState = LinkMonitor::REGISTRATION_STATE_UNKNOWN; + LinkMonitor::BEARER bearer = LinkMonitor::BEARER_UNKNOWN; + int rssi = -1000; + if(_modem->getLinkState(&rssi, ®State, &bearer)==0) + { + if(rssi==-1000) + { LOG("Checking signal strength - RSSI: Error."); return false;} + else + { LOG("Signal strength is: RSSI: %d",rssi);} + + + switch(regState) { + case LinkMonitor::REGISTRATION_STATE_UNKNOWN: + LOG("regState: UNKNOWN. Failing."); + return false; + case LinkMonitor::REGISTRATION_STATE_REGISTERING: + LOG("regState: REGISTERING"); + break; + case LinkMonitor::REGISTRATION_STATE_DENIED: + LOG("regState: DENIED"); + return false; + case LinkMonitor::REGISTRATION_STATE_NO_SIGNAL: + LOG("regState: NO SIGNAL"); + return false; + case LinkMonitor::REGISTRATION_STATE_HOME_NETWORK: + LOG("regState: HOME NETWORK"); + break; + case LinkMonitor::REGISTRATION_STATE_ROAMING: + LOG("regState: ROAMING"); + break; + default: + LOG("regState: ERROR. Failing."); + return false; + } + } + + + LOG("Test %d sending an SMS message...", _testCaseNumber); + LOG("Sending SMS:' %s ' to test phone: %s , waiting for response.", irregularMessage, testPhoneNumber); + + int ret = _modem->sendSM(testPhoneNumber, irregularMessage); + + 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: + + +}; \ No newline at end of file
--- a/Tests/Test16.h Wed Sep 12 10:18:28 2012 +0000 +++ b/Tests/Test16.h Wed Sep 12 16:55:00 2012 +0000 @@ -6,8 +6,11 @@ // 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. +// this test basic characters and numbers can be sent via SMS. +static const char *gTest16Description = "Send an SMS message with basic characters and numbers..."; + class Test16 : public VodafoneTestCase { public: @@ -56,9 +59,9 @@ LOG("Test %d sending an SMS message...", _testCaseNumber); - LOG("Sending SMS:' %s ' to test phone: %s , waiting for response.", allCharsMessage, testPhoneNumber); + LOG("Sending SMS:' %s ' to test phone: %s , waiting for response.", alphabetNumbersMessage, testPhoneNumber); - int ret = _modem->sendSM(testPhoneNumber, allCharsMessage); + int ret = _modem->sendSM(testPhoneNumber, alphabetNumbersMessage); if (ret) { @@ -73,12 +76,10 @@ return false; } LOG("Test %d passed...", _testCaseNumber); - return true; - + return true; } private: - char gsm03dot38CharacterSet[127]; - + }; \ No newline at end of file
--- a/Tests/Test56.h Wed Sep 12 10:18:28 2012 +0000 +++ b/Tests/Test56.h Wed Sep 12 16:55:00 2012 +0000 @@ -56,7 +56,7 @@ LOG("Creating GSM test buffer"); LOG("Test %d sending an SMS message...", _testCaseNumber); - LOG("Sending SMS:' %s ' to test phone: %s , waiting for response.", allCharsMessage, testPhoneNumber); + LOG("Sending SMS:' %s ' to test phone: %s , waiting for response.", irregularMessage, testPhoneNumber); // create a buffer and send each character until you can send them all char shortBuffer[30]; @@ -66,8 +66,8 @@ shortBuffer[i] = irregularMessage[i]; LOG("Buffer is now: %s", shortBuffer); LOG("Irregular message is %s", irregularMessage); - - + int ret = _modem->sendSM(testPhoneNumber, shortBuffer); + } int ret = _modem->sendSM(testPhoneNumber, irregularMessage);
--- a/Tests/Tests.h Wed Sep 12 10:18:28 2012 +0000 +++ b/Tests/Tests.h Wed Sep 12 16:55:00 2012 +0000 @@ -2,6 +2,7 @@ #include "Test10.h" #include "Test12.h" #include "Test13.h" +#include "Test14.h" #include "Test16.h" #include "Test21.h" #include "Test22.h" @@ -11,11 +12,11 @@ #include "Test50.h" #include "Test56.h" -const int gAllTests[] = {10,12,13,21,22,23,25,26,50}; -const int gNumAllTests = 9; -const int gAutomatedTests[] = {10,21,22,23,25,26}; -const int gNumAutomatedTests = 6; -const int gInteractiveTests[] = {56,16,12,13}; +const int gAllTests[] = {10,16,12,13,21,22,23,25,26,50}; +const int gNumAllTests = 10; +const int gAutomatedTests[] = {10,16,12,21,22,23,25,26}; +const int gNumAutomatedTests = 8; +const int gInteractiveTests[] = {16,12,14,13}; const int gNumInteractiveTests = 4; const int gSoakTests[] = {50}; const int gNumSoakTests = 1; @@ -49,7 +50,10 @@ NULL, gTest12Description, gTest13Description, - NULL,NULL,NULL,NULL,NULL,NULL,NULL, + gTest14Description, + NULL, + gTest16Description, + NULL,NULL,NULL,NULL, gTest21Description, gTest22Description, gTest23Description,
--- a/VodafoneTestCase.h Wed Sep 12 10:18:28 2012 +0000 +++ b/VodafoneTestCase.h Wed Sep 12 16:55:00 2012 +0000 @@ -3,13 +3,12 @@ #include "LogHeader.h" const char myMessage[] = "myMessage is golden"; +//const char testPhoneNumber[] = "+447717275049"; const char testPhoneNumber[] = "+447785666088"; const char testMessage[] = "this is a test message !"; +const char alphabetNumbersMessage[] = "abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ"; const char allCharsMessage[] = "abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ[]{}()!£$%&*,.':;"; -const char irregularMessage[] = "[]{}()!£$%&*,.':;"; -//const char testMessage[] = "this is a test message !�$%^&*()_+=[][{};:@#~,.<>/?\|"; - -//#define GSM03DOT38CHARSET "@�$�����������Δ_ΦΓΛΩΠΨΣΘΞ���� !�#�%&�()*+,-./0123456789:;<=>?�ABCDEFGHIJKLMNOPQRSTUVWXYZ���ܧ�abcdefghijklmnopqrstuvwxyz�����"; +const char irregularMessage[] = "/:[]{}()!£$%&*,.';"; class VodafoneTestCase {
--- a/main.cpp Wed Sep 12 10:18:28 2012 +0000 +++ b/main.cpp Wed Sep 12 16:55:00 2012 +0000 @@ -38,7 +38,7 @@ LOG("Running tests."); - int numPassed = m->executeTestProfile(TESTS_AUTOMATED); + int numPassed = m->executeTestProfile(TESTS_MANUAL); loopForever(); }