How to Unit Test Startup.cs in .NET Core

How do people go about Unit Testing their Startup.cs classes in a .NET Core 2 application? All of the functionality seems to be provided by Static extensions methods which aren't mockable? If you take this ConfigureServices method for example: publ...
more »

2017-11-25 04:11 (1) Answers

Symfony3 create database for unittests

Good evening :-) I am learning Symfony(3) now, and I would like to use test for my classes. I've read that unittests shouldn't use databases, mocking its objects rather. But despite this, I would like to create in setUp()/KernelTestCase database (...
more »

2017-11-24 23:11 (2) Answers

Mock Es6 classes using Jest

I'm trying to mock an ES6 class with a constructor that receives parameters, and then mock different class functions on the class to continue with testing, using Jest. Problem is I can't find any documents on how to approach this problem. I've alre...
more »

2017-11-21 11:11 (1) Answers

Unit test performance gap between IDE and maven

Working in eclipse, I have a project that contains 221 unit test classes, where methods are annotated with @Test (org.junit.Test). When I right-click the project and click "Run As -> JUnit Test", it completes within 3-5 seconds. When the same tests...
more »

2017-11-08 11:11 (1) Answers

My Code in not running in Eclipse TesNg test

package com.policybazaar.testcases; import io.appium.java_client.MobileElement; import; import; import; import java.util.concurrent.TimeUnit...
more »

2017-11-01 18:11 (1) Answers

Jasmine Jquery Spy AJAX complete function

I am trying to write unit test to cover method A complete() block. I am able to mock ajax request using Deferred. But Deferred does not support complete() so I am getting below error TypeError: _this.methodB(...).complete is not a function. Please h...
more »

2017-10-31 05:10 (1) Answers

clover@eclipse : tests not relaunched at new build

I am trying to use clover (),an unit-testing plugin for eclipse, but I wonder about the utility of the option "toggle whether clover instrumentation is performed during compilation for the selected project". I guessed it has the purpose of launch aga...
more »

2017-10-28 17:10 (0) Answers

Static initializer doesn't run during JUnit tests

I have an interesting JUnit problem here (JUnit 4.12). I have a base class that only has static methods. They have to be static, because of the way they're used. I inherit other classes from the base class. So, if the base class is Base, we have Chil...
more »

2017-10-24 17:10 (3) Answers

RxAndroid, Retrofit 2 unit test

I am newly learned the RxAndroid but unfortunately the book I studied did not covered any unit test. I have searched a lot on google but failed to find any simple tutorial that cover the RxAndroid unit test in precise way. I have basically wrote a s...
more »

2017-10-18 09:10 (1) Answers

C# - How to mock this.GetType().Assembly

In the code I'm working on, I'm forced to test one method where there is a call like this: this.GetType().Assembly.GetTypes().Where(x => ...); I would like to mock this call so that when the call is made an assembly of my choice is retrieved fr...
more »

2017-10-16 17:10 (1) Answers

Unit Testing C With Functions Not in Header

I'm starting to get into unit testing and I'm having trouble understanding something. My struggle boils down to how I would go about testing functions that are only in the .c source, and not declared in the .h header. There's certain functions that s...
more »

2017-10-02 20:10 (2) Answers