Most voted "unit-testing" questions
Unit testing or unit testing is a method by which individual source code units, assemblies of one or more computer program modules, together with associated control data, operating procedures and operating procedures, are tested to determine if they are fit for use.
Learn more…165 questions
Sort by count of
-
1
votes0
answers25
viewsJavascript Behavior Driven Design (Behavior Driven) Language Testing
In languages such as PHP and Java, for example, tests follow the concept of unit testing. In the Javascript world they say the approach is a little different and terminology is being disseminated…
-
1
votes1
answer68
viewsTest error - Chai/Mocha
Hello! I’m studying unit trials with Chai and Mocha. I’ve never touched it before, but now I’m feeling the need to learn about it. I have the following code: module.exports = { //Create - Method…
-
1
votes1
answer39
viewsWhy specify a number of assertions explicitly in my test?
I started studying unit tests with Jest, but I didn’t really understand the use of expect.assertions when testing with Javascript. Let’s consider the example given below by the Jest documentation…
-
1
votes1
answer96
viewsRun unit test with memory database and fromsqlraw is giving error
I’m trying to build a unit test with . Net Core 3.1 and using Xunit. It turns out I still don’t have a database and so I use the UseInMemoryDatabase. Turns out when I make the call from PROC, I get…
-
0
votes2
answers1260
viewsHow to run unit tests on rspec?
When I execute rake spec it runs all tests. How do I run only unit tests.
-
0
votes1
answer150
viewsHow to use robolectric in Android Studio
Hello, I’d like to know how I use robolectric in my projects on Android Studio. I have tried several tutorials, but none was of great help and the documentation of it is not very clear.…
-
0
votes2
answers273
viewsAbstract unit tests
I am having a problem using abstract classes to keep the common code of my tests, shutdown boot etc... I use a concrete class only to initialize the variables. The code inherited from the abstract…
-
0
votes0
answers170
viewsHTML (DOM) testing with Jasmine or other framework
How do I test HTML with Jasmine? I know there’s a guy named jquery-Jasmine.js who does this but I have no idea how to install it because npm doesn’t work when I try to install it (it says that Git…
-
0
votes1
answer118
viewsMock Authentication on the dao
_usuario = CriaUsuario(new Login("Roberto"), new Senha("Senha")); var dao = new Mock<IUsuarioDao>(); dao.Setup(d => d.Autenticar(It.IsAny<Login>(),…
-
0
votes1
answer75
viewsHow to get access to methods onView, withId or Matches on Android?
I’m following this tutorial ! In it, displays this example: package com.example.android.testing.espresso.BasicSample; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import…
-
0
votes1
answer247
viewsWhich framework do you recommend for javascript unit testing (Ecmascript 6)?
I will develop a web application using Ecmascript 6. I’d like to continue with the TDD Technique. What framework do you recommend for javascript unit testing (Ecmascript 6)?
-
0
votes1
answer10
viewsHow do I include a file needed to perform a test in the context of running Live Unit Testing
Good afternoon to you all. My unit tests depend on a configuration file to pass. However, when tests run through Live Unit Testing (LUT) they fail by not finding such a file. Currently the ULT runs…
-
0
votes0
answers42
viewsTesting Magic Methods in PHP UNIT
Hello. I need to test the magic methods in PHP UNIT. I’m using the Slim Framework That it’s them __set() __get() __construct() __invoke() handle()
-
0
votes1
answer2884
viewsHow to do Spring Boot unit test insert data into Database?
I created a simple system that is working perfectly, but I need to implement a unit test in Spring Boot, which happens that when I perform the test or I cannot enter the data in the database or…
-
0
votes2
answers113
viewsDoubt integration test
I think it’s a somewhat conceptual question about the subject, but come on: I have an example method that validates a user checking if it exists in the database, thus: public bool…
-
0
votes0
answers242
viewsSorting Object Array javascript
I am writing a library that implements several sorting algorithms all going well until I execute the sorting of an array of objects. const exec = (array, fnCompare) =>{ return sort.bubble(array,…
-
0
votes1
answer19
viewsRun Fastlane with remote IO drone
I have the following pipeline to run Fastlane tests on an Ios project: kind: pipeline name: default steps: - name: test image: appleboy/drone-ssh settings: host: host.localhost username: fulano…
-
0
votes0
answers16
viewsTest result window netbeans is not showing the tests
When I right click on a Maven project that contains Junit tests it shows the test results in the "default" output the same as the build result. I want it to show the tests in the test window and not…
-
0
votes1
answer245
viewsCompare Response with variable
I made an environment variable that takes the ID of a registered Account, and when I go in my Find ID method I’m validating to see if I brought what I’m waiting for by passing code:8631 as Request.…
-
0
votes1
answer420
viewsHow to test connection to Mysql database (sqlalchemy)
I started learning unit tests recently, Not I know if unit testing is really the term I’m looking for, but how can I "test" the database connection ?
-
0
votes1
answer47
viewsproblems using fail in junit
I want to create custom message for every exception error in my test class, my test is working perfectly, however when I purposely make a mistake it does not come within my exception as you can see…
-
0
votes1
answer44
viewsIs it possible to perform unit tests on PHP functions?
With Phpunit we can perform unit tests in object-oriented code. There is something similar for PHP functions?
-
0
votes0
answers95
viewsError saving data with EF
I am assembling my unit tests and trying to save the data in a table using the Entity Framework, but at the time I run it returns an error. Validation failed for one or more entities. See…
-
0
votes1
answer90
viewsVuejs - How to add e2e/unit tests after not including them initially in the creation of the webpack project?
I own a project that was started with vuetify webpack (Vue init vuetifyjs/webpack). At the time the project was created, the e2e/unit test option was not selected. However, there is now a need to…
-
0
votes1
answer159
viewsHow to do the unit test in the Validator class in an Laravel form?
A good day gentlemen. I am a programming student, at this time I am studying how to perform unit tests using the Laravel 5.3 In my tests I came across the following problem: My small system only…
-
0
votes1
answer42
viewsPerform tests based on component Lifecycle
I need to run the tests following the Lifecycle Angular. I couldn’t identify any tool or way to do this. Basically it would be calling tests based on Lifecycle. Follow simple example:…
-
0
votes1
answer88
viewsMocha + Chai do not access routes that require authentication
Talk, y'all, good afternoon. So I’m running some tests on my Node.js API using Mocha and chai, but I have a middleware that checks my user’s token so that it can access some HTTP requirements. The…
-
0
votes0
answers94
viewsHow to perform unit test with unittest.mock for reading and writing files?
Good Night!!! This time my doubt is about unit tests. Come on. How can I test the section below in unittest.mock environment? def save_html_file(conteudo, filename, encoding='iso8859-1'): assert…
-
0
votes1
answer39
viewsError testing in Registry/React Authentication
I am working on an application, in which the tests are already defined. After the implementation I am having some errors such as: src/tests/Homepage.test.js ● Test Homepage Component uses Router for…
-
0
votes1
answer68
views"The command 'migrate:Fresh' does not exist." in a unit test (phpunit) in Laravel
I am creating unit tests on my system using Sqlite (in memory), but whenever I try to run them, they return the error: 1) Tests\Unit\UserTest::testUserCreate…
-
0
votes1
answer32
viewsPython: How to apply mock in dataclass?
I have following code : import unittest import unittest.mock as mock from dataclasses import dataclass @dataclass class Config: system: str = platform.system().lower() class…
-
0
votes0
answers88
viewsGetglobalvariable array of result
Good evening, I’m trying to make a variable to use in another request and I’m testing. I made an array with the code attribute coming from my payload, it contains 4 codes from 1 to 4 so my array is…
-
0
votes1
answer22
viewsUse pytest’s tmpdir fixture in a class
Hello, I have a question that is slowing me down in the use of TDD in my study projects. I’m trying to create a temporary directory with a json file using fixture tmpdir, but find the following…
-
0
votes1
answer163
viewsFixture-Factory lib, Index 55663 out of Bounds for length 2187
I’m ultilizing the lib Fixture-Factory to create templates for my tests, but working with it, I got the following error! Index 55663 out of bounds for length 2187 those are my models: Cityprop:…
-
0
votes1
answer312
viewsKarma unit tests (typescript/angular)
I am trying to perform a unit test for a method made in typescript, this is the method: createTasksForms(): void { this.task.forEach(task => { task.form = this.form.group({ name: ['',…
-
0
votes1
answer481
viewsMock local variable inside method with mockite and spring boot
I’m trying to simulate the return of a method on a local variable, but it’s always null, showing java.lang.Nullpointerexception I have the following code within a @service: @Service…
-
0
votes0
answers28
viewsAndroid Unit Test -> Problems mocking a method that has static class
I am doing unit tests of my Viewmodel and have a method that saves the data in Firebase generating an id internally with the help of the Base64 class. In my class structure I call the…
-
0
votes1
answer83
viewsMicroservice unit test using xUnit
Hello, I have a method that uses a read Repository for a holiday table, in this case... I need to create a unit test using xUnit Follow the excerpt of my method: [HttpGet]…
-
0
votes1
answer28
viewsYii2 Call to a Member Function getRoute()
I had to make a page using Yii2 at work and at first everything went well, I tested via Postman and the paging works right. $pagination = new Pagination(['totalCount' =>…
-
0
votes1
answer84
viewsDependency injection problems in Angular unit tests
I’m trying to perform unit tests in Angular, but I have some problems with injection dependencies in the services. In the application there are several services that depend on each other, for…
angular unit-testing dependency-injection jasmine karmaasked 4 years, 12 months ago Mauricio Hartmann 131 -
0
votes0
answers105
viewsUnit tests with JEST, on Node.Js, without using module.Exports in Javascript code files
With both files below (ePar.js and ePar.test.js) in the same folder, how to perform the unit test, with the JEST, via Node.Js, of function ePar (in the archive ePar.js) WITHOUT ALTERING THE SAME? I…
-
0
votes1
answer118
viewsInstantiate Dependency Injection Class using Kotlin in Unit Tests
I’m trying to find a solution for how I can instantiate a class that uses dependency injection into unit testing using Kotlin and Junit. I have a class that uses addiction injection: class…
-
0
votes0
answers59
viewsUnit Test C# best practice
I have a test code for a method until quite simple to check. public bool EmPeriodoDeExigencia(ParametroProrrogacao parametroProrrogacao, Requerimento requerimento) { PreCondicao .Para("Determinar o…
-
0
votes1
answer31
viewsApply filter to a list returned by a mock
Good night! I have the following scenario: A concrete class called Usersservice, which receives by injection of dependencies the repository through an interface and a notifier. She gets like this…
-
0
votes0
answers64
viewsts-jest (typescript Compiler) [...]. default is not a constructor
i’m trying to use ts-jest in a Vue project to Transform some ". ts" files in "js" so jest can test them. My problem is: typescript Compiler Give me this error: _className.default is not a…
-
0
votes0
answers220
viewsError when running unit tests of Repository
Previously the test worked and after a while stopped working. The structure in the database was not changed. get the message: Failed to load ApplicationContext java.lang.IllegalStateException:…
-
0
votes0
answers52
viewsUnit Testing . net MVC - Httpcontext Problem
Good afternoon, I have the following application as Solution: Controller: public ActionResult Index() { string username = HttpContext.Current.Request.LogonUserIdentity.Name; UtilizadorDbo…
-
0
votes0
answers38
viewsHow to test a saga function by mocking a generating function?
So far I haven’t found an efficient way to test the sagas of my "start" function with the redux-saga-test-plan along with Jest. I already tried to fuck the function fluxo, but I did not succeed. My…
-
0
votes0
answers15
viewsHow to test an element using Compose?
const enhance = compose( mapStateToProps, withRouter, withApollo ) export default enhance(ManagePublicTable) In the archive Managepublictable.spec.js I’m importing the component as: import {…
-
0
votes1
answer26
viewsUnit Testing Entity Framework Core
Hello, I am starting a project and it is the first time I work with unit test, we are trying to perform unit test in EF Core, but when testing the Get, I am not able to get the value of…