Vodafone Test Suite
Dependencies: mbed-rtos mbed HTTPClient VodafoneUSBModem
Revision 13:8b69853966f8, committed 2012-08-29
- Comitter:
- nherriot
- Date:
- Wed Aug 29 14:13:49 2012 +0000
- Parent:
- 12:b50d37429dff
- Child:
- 14:d7bf58146337
- Child:
- 16:c89d426c6175
- Commit message:
- adding test number to base class, init lists and changing constructors for test cases
Changed in this revision
--- a/TestManager.cpp Tue Aug 28 15:40:07 2012 +0000 +++ b/TestManager.cpp Wed Aug 29 14:13:49 2012 +0000 @@ -1,9 +1,9 @@ #include "TestManager.h" #include "Tests.h" TestManager::TestManager(VodafoneUSBModem *m) : _modem(m) { - //_tests.push_back((VodafoneTestCase*)new Test12(_modem)); - _tests.push_back((VodafoneTestCase*)new Test20(_modem)); - _tests.push_back((VodafoneTestCase*)new Test50(_modem)); + _tests.push_back((VodafoneTestCase*)new Test20(_modem, 20)); + _tests.push_back((VodafoneTestCase*)new Test12(_modem, 12)); + // _tests.push_back((VodafoneTestCase*)new Test50(_modem, 50)); } int TestManager::runAll() {
--- a/Tests/Test12.h Tue Aug 28 15:40:07 2012 +0000 +++ b/Tests/Test12.h Wed Aug 29 14:13:49 2012 +0000 @@ -3,6 +3,14 @@ #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 Test12 : public VodafoneTestCase { public: @@ -10,16 +18,16 @@ char msg[64]; size_t count; - Test12(VodafoneUSBModem *m) : VodafoneTestCase(m) { + Test12(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."); - char smsResponse[64]; while(true) { - LOG("Test 12 waiting for an SMS message..."); + LOG("Waiting for an SMS message..."); int ret = _modem->getSMCount(&count); if(ret) {
--- a/Tests/Test20.h Tue Aug 28 15:40:07 2012 +0000 +++ b/Tests/Test20.h Wed Aug 29 14:13:49 2012 +0000 @@ -2,7 +2,7 @@ #include "VodafoneTestCase.h" class Test20 : public VodafoneTestCase { public: - Test20(VodafoneUSBModem *m) : VodafoneTestCase(m) { + Test20(VodafoneUSBModem *m, int tcNumber) : VodafoneTestCase(m, tcNumber) { } virtual void setupTest() { @@ -10,7 +10,7 @@ } virtual bool runTest() { - + LOG("Test %d waiting for an SMS message...", _testCaseNumber); LOG("Sending USSD, waiting for response."); if(_modem->sendUSSD("*#100#",_ussdResponse,16)!=0) {
--- a/Tests/Test50.h Tue Aug 28 15:40:07 2012 +0000 +++ b/Tests/Test50.h Wed Aug 29 14:13:49 2012 +0000 @@ -2,7 +2,7 @@ #include "VodafoneTestCase.h" class Test50 : public VodafoneTestCase { public: - Test50(VodafoneUSBModem *m) : VodafoneTestCase(m) { + Test50(VodafoneUSBModem *m, int tcNumber) : VodafoneTestCase(m, tcNumber) { _smsLen = 32; _numberLen = 16; } @@ -18,6 +18,7 @@ virtual bool runTest() { int numIterations = 10; size_t smCount; + LOG("Test %d waiting for an SMS message...", _testCaseNumber); LOG("Getting MSISDN"); _modem->sendUSSD("*#100#",_ownNumber,_numberLen); LOG("Got MSISDN %s",_ownNumber);
--- a/VodafoneTestCase.h Tue Aug 28 15:40:07 2012 +0000 +++ b/VodafoneTestCase.h Wed Aug 29 14:13:49 2012 +0000 @@ -3,9 +3,7 @@ #include "LogHeader.h" class VodafoneTestCase { public: - VodafoneTestCase(VodafoneUSBModem *m) : _modem(m) { - _lastRunTime = 0; - _lastRunOutcome = false; + VodafoneTestCase(VodafoneUSBModem *m, int tcNumber) : _modem(m), _testCaseNumber(tcNumber) , _lastRunTime(0), _lastRunOutcome(false){ } bool run() { @@ -30,6 +28,8 @@ protected: VodafoneUSBModem *_modem; + const int _testCaseNumber; time_t _lastRunTime; bool _lastRunOutcome; + }; \ No newline at end of file