testing

How to run multiple test classes with junit from command line?

时光总嘲笑我的痴心妄想 提交于 2020-01-13 12:18:07
问题 I know that to run junit from command line you can do this: java org.junit.runner.JUnitCore TestClass1 [...other test classes...] However, I want to run many tests together and manually typing "TestClass1 TestClass2 TestClass3..." is just inefficient. Current I organize all test classes in a directory (which has sub-directories indicating the packages). Is there any way that I can run junit from command line and let it execute these test classes all at once? Thanks. 回答1: Basically there are

How to run multiple test classes with junit from command line?

徘徊边缘 提交于 2020-01-13 12:16:57
问题 I know that to run junit from command line you can do this: java org.junit.runner.JUnitCore TestClass1 [...other test classes...] However, I want to run many tests together and manually typing "TestClass1 TestClass2 TestClass3..." is just inefficient. Current I organize all test classes in a directory (which has sub-directories indicating the packages). Is there any way that I can run junit from command line and let it execute these test classes all at once? Thanks. 回答1: Basically there are

Angular 2 - Http-Testing - Error: “Cannot read property 'getCookie' of null”

China☆狼群 提交于 2020-01-13 12:00:11
问题 Always get this error in console, when running Jasmine Tests with karma on the following code: Error: TypeError: Cannot read property 'getCookie' of null Service: //http.service.ts import {Injectable, Inject, ReflectiveInjector} from '@angular/core'; import {Headers, Http, Response, HTTP_PROVIDERS} from '@angular/http'; import {Observable} from "rxjs"; const injector = ReflectiveInjector.resolveAndCreate(HTTP_PROVIDERS); const http = injector.get(Http); @Injectable() export class HttpService

Sequelize Model Unit Test

孤人 提交于 2020-01-13 11:22:55
问题 I have a User sequelize model that has a beforeCreate hook that encrypts the password using bcrypyt . Bcrypyt is loaded as a dependency by the model using a require statement. Now, I'm writing my tests for my models and I want to write a test that ensures bcrypt is hashing the password on create. At the moment, I have added a setter onto the User model that sets the bcrypt object. In my tests, I can then create a spy using sinon and inject the spy using the setter and ensure it is called on

How to test that some code doesn't compile in C++? [duplicate]

一笑奈何 提交于 2020-01-13 10:54:29
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: Unit test compile-time error I'm wondering if its possible to write a kind of unit test which will verify that a given code doesn't compile. For example, I have a template class: #include <boost/static_assert.hpp> #include <boost/type_traits/is_base_of.hpp> struct bar_base {}; template <typename T> class foo { BOOST_STATIC_ASSERT(::boost::is_base_of<T, bar_base>::value); }; So, the test should succeed with:

How to test that some code doesn't compile in C++? [duplicate]

守給你的承諾、 提交于 2020-01-13 10:54:07
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: Unit test compile-time error I'm wondering if its possible to write a kind of unit test which will verify that a given code doesn't compile. For example, I have a template class: #include <boost/static_assert.hpp> #include <boost/type_traits/is_base_of.hpp> struct bar_base {}; template <typename T> class foo { BOOST_STATIC_ASSERT(::boost::is_base_of<T, bar_base>::value); }; So, the test should succeed with:

Test accessibility (talkback) for application

ぃ、小莉子 提交于 2020-01-13 10:46:21
问题 I am making my application accessibility compliant. for this providing correct data to the accessibility framework by giving android:contentDescription="your string" in xml. Also I have Seen the Android Developer guide on Making Applications Accessible for an overview of what steps you need to take to ensure your application works correctly with accessibility services. Now problem is testing these all in each and every screen taking more time. my app has 30 screens and each time to go to any

Top 10 negative testing list

有些话、适合烂在心里 提交于 2020-01-13 09:01:10
问题 I searched SO, finding little thing about negative testing, which is also a very important thing developers should keep in mind during work. What about making a list of top 10 test case for the negative testing developer should keep in mind collaboratively? Thanks! The definition of Negative Testing: In software testing, a test designed to determine the response of the system outside of what is defined. It is designed to determine if the system doesn't crash with unexpected input. 回答1:

Unit/Integration testing FTP access

天大地大妈咪最大 提交于 2020-01-13 08:25:10
问题 A member of my Team is writing an application that accesses an external FTP site to download files. Having written the code we would like to be able to do integration testing without using a physical ftp server as it is an external site. We have done similar things in the past using nDumpster for simulating an smtp server in code and we are wondering if there are any equilivent compliant ftp servers that can be used? Edit: I should add that these are not for true unit tests, we have those and

Use of 'using' keyword to make inherited constructor public [duplicate]

夙愿已清 提交于 2020-01-13 08:17:20
问题 This question already has an answer here : C++11 inheriting constructors and access modifiers (1 answer) Closed 5 years ago . I am trying to test protected methods and constructors of my class. For this purpose, I tried to subclass it, and re-export its members as public with C++11 using keyword: class Foo { protected: Foo(int i) {} void run() {} }; class TestableFoo : public Foo { public: using Foo::Foo; using Foo::run; }; int main() { TestableFoo foo(7); foo.run(); } However, both g++ and