Task #3369
openEthernetTransport: test suite improvement
0%
Description
Improve EthernetTransport
test suite with coverage for these functions and situations:
EthernetTransport::sendPacket
EthernetTransport::processIncomingPacket
Reference: commit:65caf200924b28748037750449e28bcb548dbc9c ethernet.t.cpp
, SendPacket ProcessIncomingPacket
test cases.
Updated by Davide Pesavento almost 9 years ago
sendPacket()
is not really testable, unless we stub libpcap.
The old SendPacket
test case used to check only the static properties (for which we already have a separate test case), and that the nOutBytes
counter was properly incremented (which is no longer the responsibility of Transport subclasses, so no need to test it anymore).
Updated by Junxiao Shi almost 9 years ago
sendPacket()
is not really testable, unless we stub libpcap.
This is where a TUN interface based test case makes sense.
Updated by Davide Pesavento almost 9 years ago
Not really... do you know how to reliably force pcap_inject()
to return an error, or to perform a partial write? Using TUN might help testing the successful case, but doesn't help testing error cases (which are arguably the most interesting ones).
In any case, the old SendPacket
test case did not perform this kind of checking, as I already said. So, is this task about bringing back the same level of testing as before commit cde37ad608dd5cb5e079a007445ccd5c166ee4a6
was merged, or about having full coverage for EthernetTransport
? If it's the former, I'm willing to take this task; otherwise it would be substantially more complex and I'm afraid I won't have enough time for it in the near future.
Updated by Junxiao Shi almost 9 years ago
This goal is to provide full coverage for EthernetTransport
.
@Davide, you may add test coverage for EthernetTransport::processIncomingPacket
as one step toward this goal.
After that, clear the assignee field and the rest can be done later.
Updated by Davide Pesavento over 7 years ago
- Target version changed from v0.5 to v0.6
Updated by Junxiao Shi over 7 years ago
sendPacket()
is not really testable, unless we stub libpcap.
With the introduction of PcapHelper
class, we are able to stub libpcap.
It would be necessary to move pcap_inject
into PcapHelper
class.
Afterwards, a stub PcapHelper
can be used to test EthernetTransport
.
Updated by Davide Pesavento over 7 years ago
- Target version deleted (
v0.6) - Estimated time changed from 3.00 h to 6.00 h