Vodafone Test Suite
Dependencies: mbed-rtos mbed HTTPClient VodafoneUSBModem
Revision 29:c0e6f198db84, committed 2012-09-12
- Comitter:
- nherriot
- Date:
- Wed Sep 12 09:53:40 2012 +0000
- Parent:
- 28:c630a04a7198
- Child:
- 30:dd2beda340c6
- Commit message:
- adding some 'error' scenario test cases and many small changes to the test suite
Changed in this revision
--- a/TestManager.cpp Mon Sep 10 04:59:11 2012 +0000 +++ b/TestManager.cpp Wed Sep 12 09:53:40 2012 +0000 @@ -27,6 +27,7 @@ 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)); } int TestManager::getTestProfileLength(TestProfile profile) { @@ -40,6 +41,8 @@ int TestManager::executeTestProfile(TestProfile profile) { if(profile>=0 && profile <TESTS_END) { + LOG("Test profile being used is: %d", gTestProfiles[profile]); + LOG("Test profile lengths being used is: %d", gTestProfileLengths[profile]); return executeTestList(gTestProfiles[profile], gTestProfileLengths[profile]); } else { LOG("Test profile out of bounds. Must be between 0 and %d",TESTS_END-1); @@ -48,6 +51,8 @@ } int TestManager::executeTestList(const int *list, const int listLen) { + LOG("The executeTestList is: %d", list); + LOG("The executeTestListLength is: %d", listLen); int successfullTests = 0; LOG("Running %d tests...",listLen); for(int i=0; i<listLen; i++) {
--- a/Tests/Test13.h Mon Sep 10 04:59:11 2012 +0000 +++ b/Tests/Test13.h Wed Sep 12 09:53:40 2012 +0000 @@ -48,7 +48,7 @@ LOG("THE MESSAGE IS: %S", myMessage); return false; } - LOG("The message is from number: %s and the message is: \"%s\"", num, testMessage); + LOG("The message is from number: %s and the message is: \"%s\"", num, msg); return true; } Thread::wait(500);
--- a/Tests/Test16.h Mon Sep 10 04:59:11 2012 +0000 +++ b/Tests/Test16.h Wed Sep 12 09:53:40 2012 +0000 @@ -14,13 +14,51 @@ Test16(VodafoneUSBModem *m, int tcNumber) : VodafoneTestCase(m, tcNumber) { } + virtual bool runTest() { - LOG("Creating GSM test buffer"); + + 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.", testMessage, testPhoneNumber); + LOG("Sending SMS:' %s ' to test phone: %s , waiting for response.", allCharsMessage, testPhoneNumber); - int ret = _modem->sendSM(testPhoneNumber, testMessage); + int ret = _modem->sendSM(testPhoneNumber, allCharsMessage); if (ret) {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Tests/Test56.h Wed Sep 12 09:53:40 2012 +0000 @@ -0,0 +1,96 @@ +#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 Test56 : public VodafoneTestCase { + public: + + + Test56(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("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); + + // create a buffer and send each character until you can send them all + char shortBuffer[30]; + + for (int i=0; i < sizeof(irregularMessage); i++) + { + shortBuffer[i] = irregularMessage[i]; + LOG("Buffer is now: %s", shortBuffer); + LOG("Irregular message is %s", irregularMessage); + + + } + + 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: + char gsm03dot38CharacterSet[127]; + + +}; \ No newline at end of file
--- a/Tests/Tests.h Mon Sep 10 04:59:11 2012 +0000 +++ b/Tests/Tests.h Wed Sep 12 09:53:40 2012 +0000 @@ -9,13 +9,14 @@ #include "Test25.h" #include "Test26.h" #include "Test50.h" +#include "Test56.h" static const int gAllTests[] = {10,12,13,21,22,23,25,26,50}; static const int gNumAllTests = 9; static const int gAutomatedTests[] = {10,21,22,23,25,26}; static const int gNumAutomatedTests = 6; -static const int gInteractiveTests[] = {16,12,13}; -static const int gNumInteractiveTests = 3; +static const int gInteractiveTests[] = {56,16,12,13}; +static const int gNumInteractiveTests = 4; static const int gSoakTests[] = {50}; static const int gNumSoakTests = 1;
--- a/VodafoneTestCase.h Mon Sep 10 04:59:11 2012 +0000 +++ b/VodafoneTestCase.h Wed Sep 12 09:53:40 2012 +0000 @@ -6,7 +6,7 @@ const char testPhoneNumber[] = "+447785666088"; const char testMessage[] = "this is a test message !"; const char allCharsMessage[] = "abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ[]{}()!£$%&*,.':;"; - +const char irregularMessage[] = "[]{}()!£$%&*,.':;"; //const char testMessage[] = "this is a test message !�$%^&*()_+=[][{};:@#~,.<>/?\|"; //#define GSM03DOT38CHARSET "@�$�����������Δ_ΦΓΛΩΠΨΣΘΞ���� !�#�%&�()*+,-./0123456789:;<=>?�ABCDEFGHIJKLMNOPQRSTUVWXYZ���ܧ�abcdefghijklmnopqrstuvwxyz�����";