Linked Questions

10 votes
3 answers
2k views

Unit testing methods that call suppliers webservices

I have a class with one public method Send() and a few private methods. It calls a couple of webservices and processes the reponse. The processing is done in private methods. I want to unit test the ...
Tom Squires's user avatar
  • 17.7k
2 votes
3 answers
249 views

How do you decompose big object for testing?

I have a package that provides an object with quite a lot of features owned by it. Let us say the object is an HTTPServer, and when the user initializes it by providing config and a request handler ...
Bimo Adityarahman's user avatar
2 votes
3 answers
753 views

How to not violate the single responsibility principle?

Let's say I'm writing a class that tracks a single stock ticker. In this simplified example, the StockTracker class holds a string that tells me the trend direction and a variable window that holds x ...
jgv115's user avatar
  • 139
0 votes
3 answers
635 views

What concept am I missing with private methods and testing? [duplicate]

I've read a lot o blogs arguing about private methods and testing. Some people say you should not test private methods, they say you should make them public or put those methods in a new class. But ...
marcos.borunda's user avatar
-4 votes
3 answers
7k views

How to unit test a public method that calls a private method [duplicate]

Here is a very basic example to illustrate my point class SomeClass { publicMethod1(param1, param2) { if (param1 === "some value") { // do stuff } else { ...
Jacob's user avatar
  • 95
4 votes
2 answers
213 views

continuous integration impact on ticket sizing

I've been doing research on CI (continuous integration) and I can't find any info on the changes CI would introduce to ticket sizing. CI states developers should merge to the mainline every day (or ...
zero's user avatar
  • 143
3 votes
2 answers
637 views

Test Internals with TDD?

I'm new to TDD, and relatively new to software development in general (e.g. < 4 years experience), but I am trying to learn. I have been toying with TDD but ran into what I know realize is a ...
Adam Thompson's user avatar
1 vote
2 answers
2k views

Why is white box testing discouraged in OOP?

It seems the general consensus for unit testing classes is to test your object through its public interface only. So if you wanted to test the removeElement method on a LinkedList class you'd need to ...
user avatar
0 votes
2 answers
6k views

How do I go about unit testing a private method that gets called in a loop like this one? [duplicate]

How do I go about unit testing a private method that gets called in a loop like this one: // Calls MethodToUnitTest in a loop public static string Generate(params int[] values) { ...
UnitTestingN00b's user avatar
10 votes
1 answer
13k views

Testing private methods as protected

I was reading this answer about testing private methods and it mentioned several possibilities: extract methods as public to another class make them public separate the env of test and production ...
sam's user avatar
  • 211
1 vote
1 answer
2k views

How to unit test public method which internally calls many internal or private methods which are already individually unit tested [duplicate]

In our ASP.NET Core application, we have many APIs which are calling public method from the service class. Service class is implementing an Interface. Each service method (depending upon complexity ...
WAQ's user avatar
  • 113
1 vote
1 answer
4k views

Testing a private method in Java [duplicate]

I am new writing good test cases, so please bear with me. Writing a test case for private methods public Stock getStock(String stockTicker) { Stock company = new Stock(); ...
Incpetor's user avatar
  • 127
1 vote
1 answer
4k views

How to structure a chain of method calls [duplicate]

To keep it simpler for any client of my class, I have put a sequence of private method calls within one public method. The client then calls this method and all the methods within run to complete the ...
JMP's user avatar
  • 127
-1 votes
1 answer
86 views

Unit test Service Class [duplicate]

In my project, I have two type of Service Class : The simple one, they are interface that use the DAOs The complicated one, are Rest Api Service The Rest Service will make call to an API, and map ...
Hamza Ince's user avatar
3 votes
0 answers
101 views

How to properly test many methods when main logic is in private method [duplicate]

This is a little bit of follow up question to How to test private methods. I totally agree (and experienced what happens when you try) that we should not test private methods. Sometimes though it ...
Greg's user avatar
  • 435

15 30 50 per page