[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [tor-bugs] #22733 [Metrics/Library]: Use parameterized tests instead of repeated methods



#22733: Use parameterized tests instead of repeated methods
-----------------------------+------------------------------
 Reporter:  iwakeh           |          Owner:  metrics-team
     Type:  enhancement      |         Status:  new
 Priority:  Medium           |      Milestone:
Component:  Metrics/Library  |        Version:
 Severity:  Normal           |     Resolution:
 Keywords:  metrics-2018     |  Actual Points:
Parent ID:                   |         Points:
 Reviewer:                   |        Sponsor:
-----------------------------+------------------------------

Comment (by iwakeh):

 Here is an
 [https://gitweb.torproject.org/collector.git/tree/src/test/java/org/torproject/collector/sync/SyncPersistenceTest.java?id=4b3c2fef58363c7135bad21a883e9f17a57d001a#n32
 example from CollecTor's code base] using parametrized tests.

 And, the most recent change there shows that for a new descriptor type
 only new test data needed to be added:
 {{{
 #!java
 diff --git
 a/src/test/java/org/torproject/collector/sync/SyncPersistenceTest.java
 b/src/test/java/org/torproject/collector/sync/SyncPersistenceTest.java
 index fe47f26..f0d30bc 100644
 --- a/src/test/java/org/torproject/collector/sync/SyncPersistenceTest.java
 +++ b/src/test/java/org/torproject/collector/sync/SyncPersistenceTest.java
 @@ -43,6 +43,12 @@ public class SyncPersistenceTest {
           Integer.valueOf(1), // expected recent count of descs files
           Integer.valueOf(1)}, // expected output count of descs files

 +        {"torperf/op-nl-1048576-2017-04-11.tpf",
 +         new String[]{"torperf/2017/04/11/op-nl-1048576-2017-04-11.tpf"},
 +         "op-nl-1048576-2017-04-11.tpf",
 +         Integer.valueOf(1),
 +         Integer.valueOf(1)},
 +
 }}}

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/22733#comment:3>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs