Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Welcome to Software Development on Codidact!

Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.

Posts tagged unit-testing

For questions about the testing method by which individual units of source code are tested to determine if they are fit for use.

This tag doesn't have a detailed wiki yet.

57%
+2 −1
Q&A How to mock methods like `pathlib.Path.is_dir`?

I used to have some testing code for mocking a simple directory structure when working with pathlib. I recently tried to run these tests to learn that some of the internals in pathlib have changed ...

1 answer  ·  posted 4mo ago by mr Tsjolder‭  ·  last activity 4mo ago by mr Tsjolder‭

71%
+3 −0
Q&A Unit Testing #define Directives in Visual Studio

I have some methods in my codebase that utilize the #if DEBUG preprocessor directive to provide specialized behavior that differs between the debugging environment and the production environment. I...

1 answer  ·  posted 4mo ago by Orladdin‭  ·  last activity 4mo ago by Olin Lathrop‭

77%
+5 −0
Q&A Testing an opaque type's internals

First: What is an opaque pointer in C? Now when it comes to testing such a type, I know of 3 ways: Include the source file (the one containing the definition of the type and the functions tha...

2 answers  ·  posted 9mo ago by Melkor-1‭  ·  last activity 8mo ago by Alexei‭

72%
+6 −1
Q&A How to unittest method that involves contacting remote servers?

Let's say I have this class: class myService { private boolean foo(T arg) { return arg == 42; } public Response bar(U arg) { if(foo(U.field)) { return Response.st...

1 answer  ·  posted 3y ago by klutt‭  ·  last activity 3y ago by meriton‭

40%
+0 −1
Q&A How to mock LazyCache when performing unit testing?

A few of my services rely on LazyCache and they use it by injecting IAppCache. For unit testing, I would like to mock this. I have found MockCachingService, but it does not do any caching (as spec...

1 answer  ·  posted 3y ago by Alexei‭  ·  last activity 3y ago by Alexei‭

50%
+2 −2
Q&A Mocking tempnam() with vfsstream

How do I mock tempnam() with vfsStream for code that uses it to create temporary files (for example, in a PHPUnit test)?

1 answer  ·  posted 4y ago by tyteen4a03‭  ·  last activity 4y ago by summea‭

66%
+2 −0
Q&A What are the cons of directly mocking Entity Framework DbSets instead of working with an in-memory database when unit testing the application?

I have recently contributed to a Clean Code project and had a discussion about how to implement unit tests. The project author argues for using an in-memory database (which easily replaces the rea...

1 answer  ·  posted 4y ago by Alexei‭  ·  last activity 4y ago by Goyo‭