Questions tagged [testing]

55657 questions
1

votes
1

answer
100

Views

How to test a method that makes calls to a database

I have several methods that make connections to a database and I can't figure out how to write unit tests for them. Here is a sample of what I'm talking about. public static User GetByPendingUserId(int a_PendingUserId) { User l_User = new User(); SqlConnection l_conn = DbHelp.CreateSqlConnection();...
tayopi
1

votes
2

answer
2.7k

Views

How to Mock System.getProperty using Mockito

I have added mock-maker-inline text in org.mockito.plugins.MockMaker file and placed it in test/resources/mockito-extensions In my test case I am using: System system = mock(System.class); when(system.getProperty('flag')).thenReturn('true');` But I am getting the following exception: org.mockito.ex...
Raghu
1

votes
1

answer
266

Views

relation between random testing and fuzz testing

I am wondering what the relation between random and fuzz testing is. I understand that random testing has been there for a longer time, but I cannot see any differences between them. They both seem to make use of random input to see if the program goes into an unexpected state (i.e. crash). Is the m...
Martin Jü
1

votes
1

answer
386

Views

Java JUnit 5 annotations differences

I see there was introduced the new JUnit Jupiter according to JUnit 5 User Guide. JUnit 5 = JUnit Platform + JUnit Jupiter + JUnit Vintage I am confused about the same-named annotations I use across the library. Is there any significant difference between these two ones? org.junit.Test org.junit.jup...
Nikolas
1

votes
2

answer
1.1k

Views

Load Testing AWS API Gateway

As the question suggests, I need to perform Load Test on the API Gateway Resources with 1 million RPS. Apache JMeter is a very good tool for Load Testing. But I think it won't be possible to simulate such a huge load from a single machine. In that case, JMeter Clusters could be useful. But setting i...
Tapas Bose
1

votes
2

answer
940

Views

Moxios - TypeError: Cannot read property 'adapter' of undefined

Trying to test axios calls and trying the moxios package. 'axios': '^0.16.2', 'moxios': '^0.4.0', Found here: https://github.com/axios/moxios Following there example, but my test errors out on the moxios.install() line: import axios from 'axios' import moxios from 'moxios' import sinon from 'sinon'...
Leon Gaban
1

votes
3

answer
2.5k

Views

Cypress How to store global constants in a file that can be used across all spec files?

I'm looking for a way to store global constants in a file that could be used across all my spec files. Can anyone help?
Ryan Parker
1

votes
1

answer
124

Views

UITests failing when run in group but succeed when run independently

I'm currently working on a project with many asynchronous code and I'm writing the UITests for this project. During the development I run them one by one but never in a group. So I thought the tests are succeeding. But when testing them all together most of them are failing. I implemented the setup...
Tom Kuschka
1

votes
2

answer
654

Views

Override Go Method in Tests

So I have this Client struct that has a method UserByID that makes a HTTP request to an endpoint for a User. I want to unit test this function but also not make an actual HTTP request in the function c.Request. I want to stub that function with a response and error I can control. func (c Client) Use...
KA01
0

votes
0

answer
3

Views

test results of all the webpage components to Influxdb from Webpagetest api

Honestly I'm trying to implement this -https://github.com/siedi/webpagetest-influxdb to have webpage test results to influxdb and later in Grafana. The above package pushes aggregate metrics to InfluxDB. Below is the code written for this i think. var firstView = testData.data.median.firstView cons...
shey
1

votes
1

answer
861

Views

Mocking Vuex module action in component unit test

I'm currently trying to mock an action from a store's module. I can't seem to properly stub it, as I continue to get a message in my unit tests that says: [vuex] unknown action type: moduleA/filterData Here is a simplified version of the component under test: Item.vue {{ itemName }} import store fro...
imcz
1

votes
2

answer
428

Views

Symfony 4 Mock service in functional test

I am testing a service which essentially is mostly serializing an object and sending it via a service to an external system. If I create the typical unittest I would mock the response of the serializer and of the service, which contacts the external system. In fact there would be not much left to te...
Calamity Jane
1

votes
2

answer
915

Views

VSTS - how to get Code Coverage results

I'm new to DevOps work and I've been tasked to setup a build for one of our .net Standard Library projects. I used the build template for this, which works great! But I want to add a code coverage into build output (there's a test project in the solution). In the 'VsTest - testAssemblies' task, I'...
Rob McCabe
1

votes
1

answer
613

Views

Code coverage analysis using CodeCoverage.cmake with multiple targets

I have unit-test in my project implemented using Boost Unit Test Framework and organized into several modules, i.e.: #define BOOST_TEST_MODULE Connection_test #ifndef BOOST_TEST_DYN_LINK #define BOOST_TEST_DYN_LINK #endif #ifndef BOOST_TEST_NO_MAIN #define BOOST_TEST_NO_MAIN #endif #include #includ...
Eenoku
1

votes
1

answer
57

Views

Testcafe-hammerhead erorr reset-guard.ja:27

I am getting an error sometimes when I run testcafe /opt/testcafe/node_modules/testcafe-hammerhead/lib/request-pipeline/connection-reset-guard.js:27 throw err; ^
Rafaa Turki
1

votes
3

answer
797

Views

Failed to finalize session : INSTALL_FAILED_INVALID_APK: /data/app/…tmp/…-debug version code 29 inconsistent with 28

This error happens when i try to run the app on the simulator: It asks if it can uninstall the current application but there is no application installed on the simulator. If i click ok, just fails. I try to invalidate cache and restart, to reboot the pc, to create a new simulator, to update Android...
ByteArtisan
1

votes
2

answer
683

Views

Angular 5 Unit testing throwing error for “components should create ” test case

I am trying Angular 5 unit testing for the first time. While I already created the app then decided to run testing in it. But I am getting these errors: AppComponent should create the app AppComponent should have as title 'app' AppComponent should render title in a h1 tag GalleryComponent should cr...
vietngogs
1

votes
3

answer
245

Views

In Unity3d test scripts, how do I call a static function from another class?

I have two files in a Unity3d project. One is a test script that runs in edit mode. The other is a single class with static functions that I'd like to call from the test scripts. here's my test script: using UnityEngine; using UnityEngine.TestTools; using NUnit.Framework; using System.Collections;...
Brad
1

votes
2

answer
144

Views

Testing Rx Java interval

I have a repeated observable inside a ViewModel as below: class MainViewModel @Inject constructor(private val ratesUseCase: RatesUseCase) : ViewModel() { private var disposable: Disposable? = null private val resultLiveData = MutableLiveData() fun result() = resultLiveData fun getRates(base: String)...
Jamal
1

votes
2

answer
40

Views

is there a way to override model methods in django?

I have a model like this: class Car(models.Model): id = models.UUIDField(primary_key=True, default=uuid.uuid4) create_date = models.DateTimeField('date added', auto_now_add=True) modify_date = models.DateTimeField('date modified', auto_now=True) ... def last_tracked_location(self): ... try: url = '...
Tom
1

votes
1

answer
86

Views

how to fix 'AssertionError: expected false to be truthy' error?

I am beginner on E2E Tests and I want to make a e2e signup to a github account test with TestCafe, but I get this error when runing test: ExternalAssertionLibraryError { code: 'E53', isTestCafeError: true, callsite: CallsiteRecord { filename: 'TestCafe\\authentication.page.js', lineNum: 152, callsit...
hanae
1

votes
1

answer
48

Views

AndroidThreeTen not working in unit test without robolectric?

I'm having trouble creating a unit test without needing robolectric. I am using AndroidThreeTen.init(this) in my code and when I run my test if I disable robolectric I get an error: org.threeten.bp.zone.ZoneRulesException: No time-zone data files registered and if I leave it enabled I get this: [Ro...
Crash1hd
1

votes
1

answer
659

Views

How to pass Session Attributes to Lex Bot from Botium Client?

I need to pass 'Session Attributes' from botium to Lex Bot - how can i do it ? Am using container mode as 'lex', when i run the convos i get 'BadRequestException: Invalid Bot Configuration: No usable messages given the current slot and sessionAttribute set.' Please help !
suki ramachandran
1

votes
1

answer
32

Views

How to assert that some String contains at least one value from the List <String>?

I'm testing some UI functionality with Java and AssertJ. So when I receive some massive string from UI, I should verify if that String contains at least one predefined value from List. It is easy to do opposite thing - verify if list contains at least once some String value but this is not my case....
Vadam
1

votes
2

answer
109

Views

How to test condition variable in C++?

I have a pretty basic method that calls wait() on a condition variable (from in C++. void WaitForEvent() { std::unique_lock lock(mutex_); while (!event_counter_) { cond_var_.wait(lock); } return; } Now I want to unit test that method's interaction. So I want to call WaitForEvent, then call PostEve...
Lexusminds
1

votes
1

answer
51

Views

How to get first occurrence of the element from multiple match found in testcafe

There are cases where I can see multiple node matches found if I evaluate my Selenium xpath/locator. Example: //span[@username='xyz'] ( sample code using Selenium ) if the above relative path matches with multiple nodes (ex: 5 matching nodes found. Find the list of matching nodes below ). In seleniu...
Yuvaraja KS
1

votes
2

answer
37

Views

how to use builtins.input for multiple inputs

In my unittest, I have 2 prompts in the test. I am trying to use 2 @patch('builtins.input'), but it seems to only take the 1 of the return values. @patch('builtins.input') @patch('builtins.input') def test_setProfileName_modify_init_prompt_empty(self, paramName1, paramName2): paramName1.return_valu...
kiwo
1

votes
1

answer
71

Views

automation tests execution on mobile devices

In order to address the question, I have to shortly brief you: I'm writing and running e2e-automated-tests in order to test our company's web-site; the purpose is off-course, to make sure we have the site tested on both desktop and mobile phones; our tests are written in typescript, under a node.js...
Eugen
1

votes
1

answer
33

Views

XCTest: Is there a way to find a view of any type by ID in UI tests?

In XCTest there's a way to get all UI elements by type, and then filter by accessibilityIdentifier like: app.buttons[someID] But what if I don't know the type of the view? If I'm looking for a UIView, I can write: app.otherElements[someID] but this excludes UIButton views. I can implement this by ca...
battlmonstr
1

votes
1

answer
33

Views

Protractor test suite run all tests that are not in a folder

It is possible to create a test suite in Protractor by adding the following to a config file: suites: { test1: 'folder1/**/*.spec.js', test2: 'folder2/**/*.spec.js' } Where the test suite test1 will run all tests that are inside folder1. How can I create a test suite that will run all tests that are...
sininen
1

votes
2

answer
36

Views

How to avoid writing browser cookies when running testcafe tests?

I am running the testcafe tests for a website. I want to avoid writing any browser cookies while running my testcafe tests. My website writes cookies but while running tests I want to avoid this. Is there any way to achieve this in testcafe?
Ruchi
1

votes
1

answer
42

Views

Golang: reflect.DeepEqual returns unexpected false

I have the following code and code test below and for some reason the deepEqual is returning a false and failing the test. Now from reading the doco on this I would expect this to pass with a true for something so simple? Any points would be much appreciated. Thanks // customer.go type Customer stru...
Luke Hamilton
0

votes
0

answer
9

Views

Karma, Angular 7, & FontAwesome issue Can't bind to 'icon' since it isn't a known property of 'fa-icon'

Can't bind to 'icon' since it isn't a known property of 'fa-icon'. When trying to run this test in people.component.spec.ts import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { PeopleComponent } from './people.component'; describe('PeopleComponent Unit Test', () => { le...
John Peters
1

votes
4

answer
7.5k

Views

Request failed: Context parameter '$HIDDEN1.__EVENTVALIDATION' not found in test context

I'am looking for a solution to this problem : While running my automatic web test I received a request failed and here you are the response I found : Request failed: Context parameter '$HIDDEN1.__EVENTVALIDATION' not found in test context I figured out which request the hidden field was suppose to...
Abdelrahman ELGAMAL
0

votes
0

answer
7

Views

how include TestNG to Android Studio in AndroidTest

I have a some tests for android using Android Studio with jUnit. It is work. But, now i need use testNG. I have been include testng library dependencies { ... androidTestImplementation 'org.testng:testng:5.14.2' implementation group: 'org.sonatype.http-testing-harness', name: 'testng-runner', ve...
Rifat Gallyamov
0

votes
0

answer
5

Views

Responsive Design Testing using TestCafe

As part of evaluation for a new test automation framework, I am looking to see if we can automate testing for responsive designs of a website. To give you a better idea, today we use the GALEN framework to do this. Our tests cover things like pixel points, height, width, colors, sizes of containers,...
Monnie_tester
0

votes
0

answer
2

Views

MiniTest Model Test Failing

I have a model 'Policy'. Within that model, I have presence validations for policy_holder and premium_amount. I'm attempting to write a MiniTest test for this model (I'm not very familiar with MiniTest). For some reason, my tests are failing. Here is my model: class Policy < ApplicationRecord belong...
hashrocket
0

votes
1

answer
18

Views

Test calculations when there is no reference to check against

How to test (in pytest) calculations when there is no reference to check against? Say, I have a dataframe with a and b columns. And column c is calculated using a and b. The results are float numbers. df = pd.DataFrame({'a': [4,3,5], 'b': [11,7,13]}) df['c'] = df['a']/df['b']
anarz
0

votes
0

answer
3

Views

Chain Multiple UI interactions using moxios

I have to test a scenario where I click on a selection in dropdown verify dom content then click on second selection in dropdown verify dom content and then click on first selection again and verify dom content I have been looking at moxios documentation and I have tried to wrap moxios.wait inside e...
Praveen Banthia
1

votes
0

answer
4

Views

Testing a utility function by writing a unit test in apache spark scala

I have a utility function written in scala to read parquet files from s3 bucket. Could someone help me in writing unit test cases for this Below is the function which needs to be tested. // function to get parquet dataset from s3 def readParquetFile(spark: SparkSession, locationPath: String): DataFr...
wandermonk

View additional questions