FAQ Database Discussion Community


Mocking (in java) with object tree / net

java,unit-testing,mocking,integration-testing
Theoretical scenario: We have an interface implemented using spring batch, which when triggered fetches a complicated object tree from a service. The type of service is not relevant, it is a pojo and return normal objects. It is transformed into our domain model and then using certain business logic calculations...

URL change in SpecsFor.Mvc

c#,asp.net-mvc-5,integration-testing
Say that you configure your SpecsForIntegrationHost like this. config.UseApplicationAtUrl("http://mylocaldomain.com"); Some of your pages are located on subdomains, because you configured it that way in your RouteConfig. You cannot test these, because you need to change the host. public class When_Viewing_Global_Page : SpecsFor<MvcWebApp> { protected override void When() { //The HomeController.Global...

How to do integration test using Entity Framework Code First V6.1.2

c#,sql-server,entity-framework,ef-code-first,integration-testing
I'm trying to add some integration tests for my database access logic using EF code-first 6.1.2. I'd like to do this on a separate database so that I don't mess up m production database with test data. Also, the test should be repeatable which means the database should be created...

Elasticsearch Spring boot integration test

java,elasticsearch,spring-boot,integration-testing
I am looking for the way to add embedded elasticsearch to my spring boot integration test. I looked at elastic search integration test but it does not work together with spring boot as both should uses different test runner. I have a class test as below unfortunately it does not...

undefined method `each' for nil:NilClass upon integration test

ruby-on-rails,ruby,ruby-on-rails-4,integration-testing,actionview
I'm developing a web app using Ruby on Rails and since I'm still pretty new to it, I forgot that I'm suppose to write test before my application code and don't wanna redo it. So before I wrote my test, I've already wrote my application codes and it is all...

How can performed method setUp only once in tests

java,testing,junit,integration-testing
I have test: @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = {TestRepositoryConfig.class}) @Transactional public class ServiceTest { @Autowired private UserRepository userRepository; @Autowired private Service service; static { initTestUser(); } public void setUp() { userRepository.seve(testUser); } public void test1() { ... } public void test2() { ... } I need first start method setUp, saving testUser,...

Arquillian tests stop working after enabling Websphere security

java,websphere,integration-testing,jboss-arquillian
Arquillian IT tests run fine till the moment I enabled the security in Websphere admin console (In order to build the login functionality). So the question is how to run Tests with Websphere security anabled. Its LDAP (Microsoft AD). Thanks Arquillian.xml ...... <container qualifier="websphere" default="true"> <configuration> <property name="remoteServerAddress">localhost</property> <property name="remoteServerSoapPort">8880</property>...

Persistence.xml overridden in Arquillian tests

java,java-ee,integration-testing,wildfly,jboss-arquillian
Arquillian examples mainly show how to construct WarArchive, JavaArchive, etc. I can't find any good example how to override one of jar files which exists in already compile war file. The reason is that one of the jars contains persistence.xml which I wan't to override to defined for instance hbm2ddl.auto...

Integration tests with spring security

java,spring-mvc,spring-security,integration-testing
I need to send a get request to the API, but despite having placed the administrator annotation get error @WithMockUser(roles="ADMINISTRADOR"). How do I send a request? API @RequestMapping(value = "/{id}", method = RequestMethod.GET) @PostAuthorize("returnObject.instancia == principal.instancia.instancia") public Validacao retrieve(@PathVariable("id") String id) { return validacaoService.retrieve(id); } Test @Test @WithMockUser(roles = "ADMINISTRADOR")...

How to determine why a patch request in a test is unsuccesful

ruby-on-rails,ruby,ruby-on-rails-4,integration-testing
In a test I have a patch request. However, it doesn't save. I know this because after the patch request I test whether the new values are there. How can I discern why the patch request in the test fails? The patch request: fullname = "MyName" phone = "MyPhone" patch...

Spring Integration Test Loading Annotated Beans

java,spring-boot,integration-testing,junit4
For some reason, my DAO is not loaded when I use @ComponentScan alone. My DAO: @Repository public class MyDAO{ @Autowire private Datasource ds; } My Config class (just overrides datasource bean with an embedded DB): @Configuration public class TestConfig extends AppConfig { @Bean public Datasource getDatasource() throws Exception{...} My Test...

Execute tests sequentially using Arquillian TestRunner TestNG

java,junit,testng,integration-testing,jboss-arquillian
I can use Arquillian TestRunner JUnit Container to write sequential tests. import org.jboss.arquillian.junit.InSequence; import org.jboss.arquillian.junit.Arquillian; @RunWith(Arquillian.class) public class ClassToTest{ @Test @InSequence(1) public void test1() { // test something (1) } @Test @InSequence(2) public void test2() { // test something (2) } } It is possible to do same thing using...

Protractor E2E Test Seed Database

angularjs,unit-testing,integration-testing,protractor
I haven't found a good way of doing this so hoping someone has some ideas. Is there any way to seed the database with test data before running a E2E Protractor test? Do people do this or do they just mock out the back end? Mocking out the back end...

Integration test get ActionController::UrlGenerationError in rails 4

ruby-on-rails,integration-testing
Im new to rails : ( Trying to write some test for editing the user's booking info, here are what i get,i have checked on other posts on stackover , it seems unrelated Any clue ? Your help will be greatly appreciated ! ActionController::UrlGenerationError: No route matches {:action=>"edit", :controller=>"bookings", :id=>nil}...

How to test a front-end JavaScript library and integrate with Travis?

javascript,integration-testing,frontend,travis-ci
I have already experimented testing NodeJS libraries using Jasmine or Mocha, but I don't know how to test front-end projects. I have found tutorials online, but everything includes a task manager in the workflow and I would like to know how to do this without one. I found the following...

Testing meteor - testing allow / deny with a unit test instead of integration test

unit-testing,meteor,jasmine,integration-testing,meteor-velocity
I have an application code that restricts documents in the following manner Docs.allow({ insert: function(userId, doc){ return !!userId }, update: function(userId, doc){ return userId && doc.owner == userId; } }) Currently, I can only run an integration test which makes actual http calls. I am not able to stub the...

is this braintree testing multi purchase error something I should worry about?

ruby,integration-testing,payment,braintree
I'm trying to figure out how to test with braintree, and I'm running into what feels like a bandwidth error. response = ::Braintree::Customer.create(payment_method_nonce: Braintree::Test::Nonce::Transactable) token = response.customer.credit_card.first.token #so far so good response = ::Braintree::Transaction.sale(payment_method_token: token, amount: "1.00") #still good response = ::Braintree::Transaction.sale(payment_method_token: token, amount: "1.00") #response is failure # =>...

Use alternative producers of EntityManager / EMF in integration tests

java,maven,jpa,integration-testing,cdi
I looking for way how to use CDI and alternative producers in integration tests. When i speak about producers, i mean EMF producer. Reason for different EMF producer is that i want to use testing in-memory database (different persistence unit). Is there easy way how to start CDI for integrations...

How to get Spring tests working again after adding @Autowired ErrorAttributes field?

spring,integration-testing,spring-boot
This is probably quite basic, but I'm new to Spring Boot (and many aspects of Spring in general) and the documentation didn't directly answer this. The setup Using latest Spring Boot (1.2.1), I have some integration tests where Spring is loaded up and dependencies nicely autowired (it was delightfully simple...

Testing Rails Controllers and Middleware- Functional vs. Integration testing?

ruby-on-rails-3,unit-testing,integration-testing
Background I have a legacy Rails 3.2 app which I'm converting from a homegrown testing solution to a rails one (currently MiniTest). The app is a JSON api with a single endpoint, so testing is very simple at this point. We build a (relatively complex) json payload and then make...

Laravel integration test throwing spurious 404 error when run as a class, individual tests work fine

laravel-5,integration-testing
I'm using the new integration testing stuff in L5.1. I'm getting some strange errors when running a test class - mostly 404's on the pages I'm testing. Oddly, when I filter down to an individual test the test passes fine. When I run the whole test class or test suite...

KIF output: AX Exchange error: Error Domain=Accessibility Code=0 “Remote service does not respond to _accessibilityMachPort”

ios,ios8,integration-testing,ios8.1,kif
When running KIF integration tests on device with iOS 8.1.3 I get lots of diagnostic messages of the following kind as console output: AX Exchange error: Error Domain=Accessibility Code=0 "Remote service does not respond to _accessibilityMachPort" UserInfo=0x1a55de50 {NSLocalizedDescription=Remote service does not respond to _accessibilityMachPort} This occurs during a call to...

KIF and Quick/Nimble

ios,unit-testing,integration-testing,kif
I'm trying to get KIF and Quick/Nimble for iOS playing together nicely, so I can use QuickSpecs for my KIF tests. My test currently looks like this: class HomeSceenSpec: QuickSpec { override func spec() { describe("Home screen") { it("should have a failing test") { let tester = self.tester() tester.waitForViewWithAccessibilityLabel("Blah") }...

Testing connectivity with external services

java,api,testing,continuous-integration,integration-testing
I'm writting an app that connects with external services (Facebook, Twitter, SMS service ...). Some of them charge money to send and receive messages. How do I simulate those services for my functional testing? (Don't want to use the real thing, but simulate the protocol). Is there a generic tool...

Grails 2.4.4 Multiple datasources, separate drivers, IntegrationSpec

sql-server,grails,datasource,integration-testing
I am attempting to use multiple datasources in a Grails 2.4.4 project. According to the docs, this should be possible: http://www.grails.org/doc/2.4.4/guide/conf.html#multipleDatasources My primary dataSource (the one I want to use for all domain classes) is using H2 at the moment, as configured by the default DataSource.groovy configuration. My second, read-only...

How to trigger a JS controller action with Minitest

javascript,ruby-on-rails,integration-testing,minitest
In a test I want to simulate a request that only accepts JS requests. I tried it in the "normal" style: patch study_update_user_vocab_path(@user, @vocabs[index]), { strength: "1", resume_study_index: "index" } Here, "strength" and "resume_study_index" are the ids of the form fields. When running the test I get the following error...

Broken Rails integration after moving 'micropost feed' - Expected at least 1 element matching “div#error_explanation”, found 0

ruby-on-rails,integration-testing
After following Michael Hartl's Rails Tutorial I moved the 'micropost feed' from / to /members, and now when I submit a post that doesn't validate properly (too many characters, missing content etc.) rails returns an error saying: ArgumentError in MicropostsController#create First argument in form cannot contain nil or be empty...

Does Jenkins offer a multiple build agents feature on VM like TeamCity?

java,jenkins,automated-tests,integration-testing
I've found that Teamcity offers the possibility to have multiple build agents (3 for free) that you can deploy on VMs to perform parallel testing (distribute the load) and by that have a certain gain of time of the execution of tests. Is that feature available in Jenkins as well?...

Integration test for has_one relationship failing

ruby-on-rails,ruby,ruby-on-rails-4,integration-testing
I have a relationship between User and Organization: User migration file: t.references :organization, index: true, foreign_key: true t.string :xml_file, null: false User model file: belongs_to :organization Organization model file: has_one :user The user model contains a variable xml_file, which is a file stored somewhere (haven't written that controller methods yet)....

Testing Web API controllers protected with [Authorize]

asp.net,.net,asp.net-web-api,oauth-2.0,integration-testing
I have just added token-based security to my Web API using ASP.net identity OWIN and OAuth 2. As a result of this I am getting 405 unauthorized error on all my tests. How can I mock the securitycontext. I've seen some samples where other have overridden the Thread.CurrentPrincipal but unsure...

How to add a new source directory to an Android Studio project?

android,android-studio,gradle,tdd,integration-testing
So ultimately I'm trying to separate my integration tests from the unit tests in an Android Studio project. I've found a few resources on the subject: http://selimober.com/blog/2014/01/24/separate-unit-and-integration-tests-using-gradle/ https://blog.safaribooksonline.com/2013/08/22/gradle-test-organization/ Separating integration tests from unit tests in Android Studio All these seem to indicate that the way to go is to create...

Undefined method error but only in test

ruby-on-rails,ruby,ruby-on-rails-4,integration-testing
The test below generates the error message ActionView::Template::Error: undefined method `avatar?' for nil:NilClass app/views/members/index.html.erb:25:in `block in _app_views_members_index_html_erb___1876261578458959373_9315040' app/views/members/index.html.erb:22:in `_app_views_members_index_html_erb___1876261578458959373_9315040' test/integration/site_layout_test.rb:50:in `block in <class:SiteLayoutTest>' Yet in development it seems to work. The avatar shows if present. Anyone got an idea about the cause? The test: get users_path...

Grails, Integration Testing, mocking a bean method while testing a service with Spock

grails,integration-testing,spock
I'm having an issue performing an integration test in Grails 2.4.5. The service I want to test looks like this: class MyService { def myBean def serviceMethod() { myBean.beanMethod() } } where myBean is defined in resources.groovy: beans = { myBean(MyBeanImpl) } And here comes the integration test: MyServiceIntegrationSpec extends...

How can I test subscription renewal flows in stripe?

integration-testing,stripe-payments
I want to test my application's handling of webhook events from stripe when a subscription payment has been made (or failed). Here is what I've tried so far: Set up a new subscription Update user's credit card to be the one that can be added to an account, but will...

Error “library not found for -lPods-MyProjectTests-KIF” when installing KIF in existing workspace

xcode6,integration-testing,cocoapods,ld,kif
I run into this error when adding KIF to an existing Xcode 6 workspace: ld: library not found for -lPods-MyProjectTests-KIF What may be special about my situation that MyProject.xcworkspace/ resides in the parent directory of MyProject.xcproject/ (and depends on several other sibling projects as well): ./MyProject.xcworkspace/ ./MyProject/ ./MyProject/MyProject.xcworkspace/ ./MyProject/Podfile My...

Test fails because of missing links that however are there in development

ruby-on-rails,ruby,ruby-on-rails-4,integration-testing
The test below generates the error message: Expected at least 1 element matching "a[href="/organizations/589088021"]", found 0.. Expected 0 to be >= 1. test/integration/site_layout_test.rb:47:in `block (2 levels) in <class:SiteLayoutTest>' test/integration/site_layout_test.rb:46:in `block in <class:SiteLayoutTest>' Yet in development it works. The links that the error refers to are there and operational. Anyone got...

Integration test: `assert_select 'a[href=?]'` fails for paginated pages

ruby-on-rails,ruby,ruby-on-rails-4,pagination,integration-testing
I have many integration tests that look something like: first_page_of_users = User.page(1) # Using kaminari for pagination. first_page_of_users.each do |user| assert_select 'a[href=?]', user_path(user) end These tests fail with an error message such as: Expected at least 1 element matching "a[href="/users/1"]", found 0.. I added puts @response.body to the tests to...

Integration testing the entity framework - separate the seed method call only for PROD -

entity-framework,entity-framework-6,integration-testing
I want to integration test my repositories. I want to setup and insert test data before each integration test method. Then I want to execute my repository logic Then I want to assert that the logic works by returning the correct data from the database. I do not want to...

database restore for integration tests with phpunit

php,testing,phpunit,integration-testing
I'm using phpunit and I'd like to know if there is a correct form for restoring the database before running integration tests. At the moment I'm calling an sql server script with php exec() on the testcase setUp method, but don't know if this is the best choice class...

How to set delay between converge and verify on kitchen test?

integration-testing,chef-solo,test-kitchen,serverspec
I'm running Serverspec integration smoke tests with Test Kitchen on a system built with Vagrant+Chef Solo. When i run kitchen test then the tests are started right after successful converge, and some of my tests fail because it takes time for the system to fully start up for the first...

Undefined method `name' in test, while working in development

ruby-on-rails,ruby,ruby-on-rails-4,integration-testing
I have a failing test while on the development server it works fine. The test generates the error: ActionView::Template::Error: undefined method `name' for nil:NilClass app/views/members/show.html.erb:15:in `_app_views_members_show_html_erb__387437852342830797_46300380' test/integration/site_layout_test.rb:18:in `block in <class:SiteLayoutTest>' The error refers to .name on the third line of the show view below. And it refers to get member_path(@member_admin)...

How to Inject a context from a test

dependency-injection,eclipse-rcp,integration-testing,e4
I'm testing an (Eclipse 4) application (I'm not talking about unit test but more integration and system-test). I've a recurrent problem I need to solve. I have to "inject" (@Inject) a context from the test into the class(es) under test. In other words I need the test does what the...

Are end-to-end tests better than unit tests, in situations where both are applicable?

unit-testing,integration-testing,end-to-end
Let me first define what I mean by unit and end-to-end tests. Let's say you have a program with a bunch of Java classes: A invokes B, which invokes C, and so on. A unit test is a test for A mocking out B, and separately a test for B...

Access test resources within Haskell tests

haskell,integration-testing,cabal
This is probably a basic question but I've been Googling for a while on it... I have a Cabal-ized Haskell project and I'm in the process of writing integration tests for it. I want to be able to include test resources for my project in the same repo and access...

What is the proper way to setup integration tests in grails 2.5 using junit?

grails,junit,dependency-injection,integration-testing
With grails 2.2 the following code (which is an integration test for a GORM class) was working fine: public class DbDeploymentIntegrationTests extends GroovyTestCase { DeploymentStorageImpl deploymentStorage DeploymentService deploymentService @Override protected void setUp() { super.setUp() deploymentStorage = deploymentService.deploymentService.deploymentStorage } ... } When I updated to grails 2.5, this is now failing:...

How to deploy WildFly datasource with Arquillian?

java,jboss,integration-testing,wildfly-8,jboss-arquillian
I tried to deploy my datasource as follows: @Deployment(name = "test", order=2) static WebArchive createDeployment() { ShrinkWrap.createFromZipFile(WebArchive, new File("target/test.war")).addAsWebInfResource(new File("src/test/resources/test-DS.xml"), "test-DS.xml") } but it seems that my datasource is ignored, I see no info about deployment in jboss console. Is there any other possibility to deploy datasource with arquillian? @Deployment(name...

Specs2 Data Tables with future results

scala,integration-testing,future,specs2
I'm struggling with following problem: I have a method that returns a Future[Result] where Result is the thing I would like to check with a data table row in specs2. As I understand the following code would block each time and wait for the result to be available. def getDataForInput(input:...

Dealing with TargetWithLayout in XUNIT

c#,integration-testing,moq,xunit
I have a class, public class CreateLoggingRuleFactory : ILoggingRuleFactory { public LoggingRule CreateDefaultLoggingRule(string ruleName , LogLevel minimumLevel, LogLevel maximumLevelName,TargetWithLayout targetWithoutStackTrace) { // blah blah var defaultLoggerRule = new LoggingRule(ruleName, minimumLevel targetWithoutStackTrace); return defaultLoggerRule; } TargetWithLayout is from NLog API. I want to make a integration test for it. So I...

Test plan for reporting system

sql-server,testing,integration-testing,functional-testing,test-plan
I have a software suite that consists of multiple integrated software packages. They all run off of a single centralised SQL database. We are in the stage where we are writing test plans and have allocated a single test plan for each independent module of the software. The only one...

Skip TestNG test on concrete exception thrown during execution

java,integration-testing,testng
This is related to the question How to create own annotation for junit that will skip test if concrete exception was thrown during execution?, but for TestNG. I seek a solution to configure TestNG integration tests to be skipped (and not fail) on known list of infrastructure exceptions which can...

Autowire jdbcTemplate in ObjectMother for a junit 4 integration test

java,integration-testing,junit4,autowired,jdbctemplate
I was wondering if I can somehow autowire jdbcTemplate in the ObjectMother for a junit 4 integration Test. The purpose of the test is to test that if you attach a document to an employee, you cannot attach afterwards a document with the same name. For that I made an...

Iterating all Play Framework routes in Test

java,routes,integration-testing,playframework-2.3
Is there any way to Iterate all described services in routes file? URL and HTTP methods are needed. I need this feature for running some integration test. I am using Play for Java....

Using $injector in AngularJS when integration testing (without using ngMock)

angularjs,unit-testing,jasmine,integration-testing,karma-runner
I'm needing to setup some integration tests in AngularJS using Karma/Jasmine but having trouble, because when not using ngMock (since I want to hit the actual $http endpoints), there are no module or inject methods. So how do I inject services into my tests? I've tried angular.injector.invoke(...) but can't get...

ActivityTestRule - how to call code before Application's onCreate

android,unit-testing,integration-testing,android-espresso
I am using Espresso 2.1 with ActivityTestRule, and I am looking for a way to set some static flags before onCreate() in my application will be called. I have some init code that I don't want called during instrumentation tests....

Block Jenkins job until a certain resource is available

jenkins,continuous-integration,integration-testing
When using Jenkins as an integration server, some of my tests require the availability of external resources like an MySQL database server. Is it possible to block a job until such a resource is available? The only workaround I can think of is using a periodically executed upstream job which...

How to write an integration test in NUnit?

c#,sql,database,unit-testing,integration-testing
We are two students writing our bachelor thesis and we have developed a Windows Application, which should be able to aid a restaurant in various communication processes. Fundamentally, it should be able to present information about the order from the moment a guest send it to it is served. We...

How to use assigns in a test with nested form?

ruby-on-rails,ruby,ruby-on-rails-4,integration-testing
How can I use assigns in a nested situation? As part of a test I make a post with valid information: post organizations_path, organization: { org_name: "abcdef", phone: "0123456", members_attributes: [email: "[email protected]", username: "solida", password: "foobar", password_confirmation: "foobar"] } This posts to a nested form where an organization can have...

testing - How to approach integration tests that create new data

testing,junit,automated-tests,integration-testing
Say I have a test that asserts whether registration of a new user in the system actually succeeds: RegistrationIntegrationTest#testRegister() Now, this creates a new test user in the actual database, since I want this test to run on the actual environment. This means that the test must not be run...

How to write golang integration test with MySQL

mysql,testing,go,integration-testing
I want to write an integration test that uses MySQL to test my queries. How to do this in golang? This contains few questions: How to setup MySQL (in-memory?) server in golang test? How to clean/recreate data model before/after each test so that they do not leave garbage behind? How...

Undefined local variable or method `login_path'

ruby-on-rails,path,integration-testing,minitest
I'm doing some integration testing in rails for a sessions controller and in the test I get that my login_path is not defined even though it is defined in the routes.rb file and when I invoke that path in the console it also shows up. Any idea what's causing this?...

can't inject Providers mock in JerseyTest

java,mocking,jersey,integration-testing,inject
I'm getting Providers from context in my filter to get defined ObjectMapper public class Filter implements ContainerRequestFilter, ContainerResponseFilter { @Context private Providers providers; @Context private HttpServletRequest request; private ObjectMapper getObjectMapper() { ContextResolver<ObjectMapper> contextResolver = providers.getContextResolver(ObjectMapper.class, MediaType.APPLICATION_JSON_TYPE); if (contextResolver == null) { return new ObjectMapper(); } return contextResolver.getContext(null); } } but...

Integration Test to webDav client using apache httpclient LocalTestServer

junit,integration-testing,webdav,apache-httpcomponents
I am trying to write Integrations tests for WebDavClient (based on jackrabbit) using apache httpclient LocalTestServer. I was inspired from the following blog and written the test below: public class WebDAVClientIT { private LocalTestServer server; @Before public void setup() throws Exception{ server = new LocalTestServer(null, null); server.start(); //direct all requests...

How to make visual studio run TestInitialize once when doing integration test?

c#,entity-framework,integration-testing
When I run all tests, the method decorated with [TestInitialize] attribute, gets executed for every test method I have. The tests are of type integration test, to test database access logic. And in the method with [TestInitialize] attribute, I insert some test data into the database which causes the following...

Difference between Android Instrumentation test and Unit test in Android Studio?

android,unit-testing,testing,android-studio,integration-testing
As of Android Studio 1.1rc there's Unit testing support and I'm wondering what's the difference between Android Instrumentation Tests and Unit tests. As I understand it: Unit tests are useful for testing code which doesn't call the Android API, and the Android instrumentation tests are rather integration tests to test...

Maven Failsafe Plugin is always skipping integration tests

java,maven,automated-tests,integration-testing
I am attempting to configure my Maven project to have unit tests and integration tests. The unit tests are already working fine using the Maven Surefire plugin and are named according to the pattern *Test.java. After adding the Failsafe plugin, like so: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-failsafe-plugin</artifactId> <version>2.18.1</version> <dependencies> <dependency> <groupId>org.apache.maven.surefire</groupId>...

Should one use unit tests for a given code block only when it's too complicated for Integration tests? [closed]

unit-testing,integration-testing
We have this question from quite sometime and often surface time to time, with a lot of arguments. The system we develop we make it a practice to create unit tests at the different layers (Workers and Controllers/Presenters) mocking the subsequent layer and at the same time we create integration...

Using a base class for an integration test

c#,unit-testing,design,integration-testing
My base class for an integration test: [TestClass] public class BaseIntegrationTest { protected readonly ApplicationDbContext _dbContext; public BaseIntegrationTest() { _dbContext = new ApplicationDbContext("DefaultConnectionTest"); } [ClassInitialize] public void Initialize() { InsertTestData(); } public void InsertTestData() { _dbContext.Users.Add(new User { Name = "John Doe" }); } } Here's a test class that...

Rails 4 Integration Testing Arrays not present in json object inside controllers

ruby-on-rails,ruby,json,integration-testing,params
I'm trying to create an integration testing for the creating of a record called books. I'm having problems creating the hash in the tests. This is my code: test/integration/creating_book_test.rb require 'test_helper' class CreatingBookTest < ActionDispatch::IntegrationTest def setup @michael_lewis = Author.create!(name: 'Michael Lewis') @business = Genre.create!(name: 'Business') @sports = Genre.create!(name: 'Sports')...

Integration Testing or Unit Testing?

unit-testing,integration-testing
I'm trying to figure out how to Unit Test a login and I'm wondering if testing the login stage would be Unit Testing or Integration Testing? I've searched to see if there is an example or to see if it is explained but I'm unable to find an answer. The...

Whether Grail integration test case will commit data into database

mysql,grails,integration-testing
I am new to Grails and learning Grails currently. I configured Mysql as my database. and when I run-app I can see table create in my database. I tried to do a save() in test case both Unit (extend Specification) and Integration test (extend IntegrationSpec), Test method is shown as...

ComErrorException 'Class Not Registered'

c#,unit-testing,com,integration-testing,merge-replication
I'm trying to write a integration(unit) test that calls an object from SQLServer Replication dll. When it tries to instanciate the object MergeSynchronizationAgent i get an exception: '{Class Not Registered}' -2147221164 I tried switching the platform to x86 but that didn't work. The exact dll is Microsoft.SQLServer.Replication.dll. Any help is...

Grails 2.4.4: services does not inject: integration test

grails,integration-testing,spock
I have service with dependency service like: class ParserService { def depService; private def parseLine(lineParts) { ... def set = depService.findItemByName(tmpModule.name);//depService == null ... I try to implement integration test like: @TestFor(ParserService) class ParserServiceTest extends IntegrationSpec { def "should not parse comment"() { when: ... def resultList = service.parseAnnotations(inputStream); resources.groovy:...

How to write integration tests for net/http based code?

testing,go,integration-testing
Here is an example code: package main import ( "net/http" ) func Home(w http.ResponseWriter, r *http.Request) { w.Write([]byte("Hello, world!")) } func Router() *http.ServeMux { mux := http.NewServeMux() mux.HandleFunc("/", Home) return mux } func main() { mux := Router() http.ListenAndServe(":8080", mux) } This is the test case I wrote: package main...