w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
What value would I get from integration tests when I already write unit tests and functional tests
I find they are useful for checking the 'plumbing' of an application. For checking that your units are connected together and that delegating objects meet the preconditions of the methods they delegating to.

Categories : Unit Testing

Integration Tests/Unit Tests: Doing too many integration tests?
You should test whatever scenario is achievable in your application (via customer/components interactions). If Layer2 can interact with Layer3 without Layer1 interference - test for it. Think of integration testing as of testing of entire use case. Is there a situation where your customer can start by invoking Layer2 alone? If there is, test it. If not, why would you do that? Never test something that is not used. This is the same as writing code that "someone might need later". It's waste of time, don't do that.

Categories : Unit Testing

How can I perform system or integration tests using visual studio 2012 without including them in run all tests?
Not that I'm aware of. What you could do is create a separate project for your integration tests and then in the test explorer, separate your tests by class. Or some other logical seperation. the current implementation that exists seems to specifically have unit testing mainly in mind, but that should change with 2013 and a stronger push towards TDD and Agile development. Have a look here :http://msdn.microsoft.com/en-us/library/ms243147(v=vs.80).aspx Scroll down to "Attributes for Identifying and Sorting Tests". There might be something there that's useful that you can use.

Categories : Unit Testing

In Maven is it possible to keep integration tests in a separate folder from unit tests?
You can put the IT'ss into different folder like this: . |-- pom.xml `-- src |-- it | `-- java | `-- com | `-- soebes | `-- maui | `-- it | `-- BitMaskIT.java |-- main | `-- java | `-- com | `-- soebes | `-- maui | `-- it | `-- BitMask.java `-- test `-- java `-- com `-- soebes `-- maui `-- it `-- BitMaskTest.java The following is needed to make then folders known to the compiler etc. <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>build-

Categories : Maven

functional tests=Integration Tests ?in django
You cannot compare these notions. The opposite to integration testing is unit testing. Unit testing - is testing different isolated parts (usually small code blocks) of your system separately - it's very focused, integration testing is testing how these different parts of your system work together - for example, url routing, logic in views, logging, querying your models etc. Functional testing is a type of black box testing that usually checks that some (usually documented) piece of functionality works as expected. You may have all sorts of tests in your django project: unit tests of different library, helper functions view tests (this could be already called integration tests, because it may include dealing with models, logging etc) ui tests (high-level tests, that could be called f

Categories : Django

Writing parameterized tests for JUnit, why are two of my parameters "null" when I run my tests?
The method data() is called before setUp(). Therefore SIMPLEPASS_ENCRYPT_CIPHER and SIMPLEPASS_DECRYPT_CIPHER are null. You can create the Ciphers directly: private static final Cipher SIMPLEPASS_ENCRYPT_CIPHER = CipherUtils.getPBECipher("abc123".toCharArray(), TEST_SALT, Cipher.ENCRYPT_MODE); or withing the data() method: @Parameters(name = "{index}: {0}") public static Collection<Object[]> data() { SIMPLEPASS_ENCRYPT_CIPHER = CipherUtils.getPBECipher("abc123".toCharArray(), TEST_SALT, Cipher.ENCRYPT_MODE); SIMPLEPASS_DECRYPT_CIPHER = CipherUtils.getPBECipher("abc123".toCharArray(), TEST_SALT, Cipher.DECRYPT_MODE); return Arrays.asList(new Object[][] { {"Test 1", "545671260887".getBytes(), SIMPLEPASS_ENCRYPT_CIPHER, SIMPLEPASS_DECRYPT_CIPHER} }); }

Categories : Unit Testing

Integration tests with JUnit and web MVC
I am assuming that you have used JUNIT to create your unit tests to achieve the impressive 85% code coverage. Please notice that JUNIT is designed for unit testing only (thus the name JUNIT). Unit testing is done while the code is running in the development environment. Integration testing can only be performed once the target code has been deployed in the target integration environment. You have mentioned that you application isn't a web application. Is it SOAP/Rest Web Service? If so, you can use Soap UI [http://www.soapui.org/], to create and save automated regression/integration tests.

Categories : Java

Run grails integration tests in run-app environment
Functional test phase is probably what you are looking for. It starts embedded container so you can test/access application via browser/url. Grails documentation is not very precise as it says "Grails does not ship with any support for writing functional tests directly, but there are several plugins available for this." Nevertheless grails test-app functional: works fine and runs everything from "functional" subdirectory with Tomcat/container up.

Categories : Tomcat

How can I use Jenkins to run my integration tests in parallel?
I found this great article on how to do this, but it gives a way to do it in Groovy code. I pretty much followed these steps, but I haven't written the code to distribute the tests evenly by duration. But this is still a useful tool so I'll share it. import junit.framework.JUnit4TestAdapter; import junit.framework.TestSuite; import org.junit.Ignore; import org.junit.extensions.cpsuite.ClassesFinder; import org.junit.extensions.cpsuite.ClasspathFinderFactory; import org.junit.extensions.cpsuite.SuiteType; import org.junit.runner.RunWith; import org.junit.runners.AllTests; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.List; @RunWith(AllTests.class) public class Distribute

Categories : Maven

Mocha, integration JS tests and asynchronous IO
The problem is that it is asynchronously trying to open files, and hitting done() before all the fs functions have returned. Just change everything to use fs.mkdirSync and fs.openSync. Sync is for synchronous and so you won't need a callback; execution will just pause until fs returns. This would be terrible in a web server, where all other work would halt, but is fine in testing.

Categories : Javascript

How to write integration tests for dropwizard
Apparently it can be done using DropwizardServiceRule DropwizardServiceRule<ServerConfiguration> server = new DropwizardServiceRule<ServerConfiguration>(Main.class, this.getClass().getResource("/config-samples/test-integration-server-config.yml").getPath()) server.startIfRequired()

Categories : Testing

Integration tests for an external web service
There are a number of ways you can test these external WSDL's. Here are some of the tools you can use to test these interactions in a more automatic way: SoapUI: Although this is a Java based application, you can use this to simulate interactions with various web services. Its a great tool to help augment any Webservice testing you may have. Any scripts you create then can be added to any CI as part of an automated strategy to validate the services. This tool is good because if you have many different languages implementing your various WSDL's, you can use the same tool to cover all those languages/frameworks. The learning curve is very short with SoapUI, so you can get up-and-running pretty quickly. JUnit (or NUnit): Although there is more overhead in setting this up, you can get a lot

Categories : Dotnet

Using Spring @ActiveProfile in integration tests
Per comment from Hippooom use an abstract class to configure tests: @WebAppConfiguration @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes={WebAppInitializer.class}) @ActiveProfiles({Profiles.EMBEDDED_DB}) public abstract class ProfiledIntegrationTest { }

Categories : Spring

Grails Response Map in Integration Tests
The result of the action is stored within the modelAndView property of the controller. Yor could access the model like this: def yourModel = myController.modelAndView.model It is described in the Integration Testing section of the docs.

Categories : Grails

Grails unit or integration tests?
In Grails unit test you can test domain class interactions using Gorm and behind the scene Grails will use in-memory database(an implementation of a ConcurrentHashMap) to mimic this behavior here. So yes you get null because that student does not exist in in-memory database and you need to insert that data first. Student.findOrSaveWhere (firstName: 'Grant',lastName : 'McConnaughey') In your example, if the intention is to test the existence of that data you need to use integration test and connect it to your database using datasource.groovy , which is really not a good idea unless you have a good reason to test your data. If you are trying to test def s = Student.findById(myId) again that is not adding any value as that is Grails dynamic finder and you probably need to trust the frame

Categories : Unit Testing

In JUnit, how can I get a list of all integration tests?
You can use JUnit categories. Read this webpage and maybe this one as well. There are other frameworks which allow even better filtering (by package/including subpackages/including those starting with x/etc) but I can't remember the name of it... however, I think what you need is simple @Categories.

Categories : Java

Reusing minitest integration tests
The way to share tests between different describe blocks when using Minitest's spec DSL is to include the module in each describe block you want those tests to run in. module SharedTest def test_header assert_link "Home" end end class IntegrationTest < ActiveDispatch::IntegrationTest describe "page one" do include SharedTest before { visit page_one_path } end describe "page two" do include SharedTest before { visit page_two_path } end describe "page three" do include SharedTest before { visit page_three_path } end end One of the ways the Minitest's Test API is different than Minitest Spec DSL is in how they behave when being inherited. Consider the following: class PageOneTest < ActiveDispatch::IntegrationTest def setup visit p

Categories : Ruby On Rails

Paralell PHPUnit testing in integration tests
This is a good question: preparing for parallel unit tests is going to require learning some new Best Practices, and I suspect some of them are going to slow our tests down. At the highest level, the advice is: avoid testing with a database wherever possible. Abstract all interactions with your database, and then mock that class. But you've already noted your question is about integration tests, where this is not possible. When using PDO, I generally use sqlite::memory: Each test gets its own database. It is anonymous and automatically cleaned up when the test ends. (But I noted some problems with this when you real application is not using sqlite: Suggestions to avoid DB deps when using an in-memory sqlite DB to speed up unit tests ) When using a database that does not have an in-memo

Categories : PHP

Is there a benefit to breaking up Integration tests with TestCategory?
Assuming the tool allows you to select and run tests by category, it can come in handy as the test suite grows in size and execution time. For instance, you could have a category for tests relevant to the current release, a second called basic core, and another category called regression and then run them at different points and frequencies in your build pipeline.

Categories : Dotnet

How to run integration tests for a mavenised Android application?
Do checkout Github Android App source code. https://github.com/github/android This project has a very good maven setup with integration-tests. They use Roboguice and maven-android-plugin Hope it helps.

Categories : Java

Skip integration tests in maven by directory
Your best best is probably to make it a multi-module project, and then in the it module skip tests based on different maven properties. This would allow you the flexibility that you're looking for.

Categories : Java

Alternative for Selenium Webdriver in integration tests
You coud take a look on Webdriver but with the PhantomJS - which supports headless testing. I haven't use it by myself but I've heard that's a good option if you don't need/want fire up the whole browser. I think you need Ghost Driver to bind it with the Webdriver but you woud need check that.

Categories : Jquery

Seperating unit and integration tests using Maven
The problem you have that you don't understand the Maven life-cycle which has the following phases (only excerpts): clean ... compile ... test .. pre-integration-test integration-test post-integration-test .. install This means in other words your requirement to do mvn clean install without running the integration tests is not satisfiable by the defaults (conventions). I would suggest to create a profile where you put the maven-failsafe-plugin into so you can control if integration-tests will run or not. This results into a thing like this: mvn -Prun-its install to run the integration tests you can use the following: mvn verify which will include running the unit tests but this can be suppressed by using: mvn -DskipTests=true verify Using mvn

Categories : Maven

Ignoring code-first migrations for integration tests
Found it. Just had to set the Database initializer on the unit tests project: System.Data.Entity.Database.SetInitializer(new DropCreateDatabaseAlways<MyContext>()); I call this from the FixtureSetup method on my unit test project.

Categories : Entity Framework

Flush shared cache between integration tests
Check out http://wiki.eclipse.org/EclipseLink/Examples/JPA/Caching as both JPA 2.0 and EclipseLink native api allow clearing the shared cache. You could call this api at the start or end of your tests.

Categories : Java

How to setup MongoDB for integration tests in NodeJS?
Our team has been stubbing out the mongo skin calls. Depending on your testing packages you can do the same thing. It takes a little bit of work but it is worth it. Create a stub function and then just declare what you need in your test. // Object based stubbing function createObjStub(obj) { return { getDb: function() { return { collection: function() { var coll = {}; for (var name in obj) { var func = obj[name]; if (typeof func === 'object') { coll = func; } else { coll[name] = func; } } return coll; } }; } } }; // Stubbed mongodb call var

Categories : Node Js

static classes instances + integration tests
As you already know the SetUp run only once and SetupFixture Run every tine before a test. so to answer your question . How can I have the SetupFixture attribute class run only once at the beginning of the TestSuite? the easiest thing to do is to use SetUp instead of SetupFixture

Categories : C#

Java How can I use a maven sub project for my integration tests?
I would move all classes that are needed for my-project-it from my-project-web to my-project-jar and made it my-project-it's dependency. Another option is instead of creating a separate my-project-it project create a separate package for integration tests under src/test/java and execute them with maven-failsafe-plugin http://maven.apache.org/surefire/maven-failsafe-plugin/integration-test-mojo.html

Categories : Java

Spring autowire HttpServletRequest in integration tests
Workarounded temporarily, but it looks like the right approach: in Config, instead of req.getAttribute("myObj"), write RequestAttributes requestAttributes = RequestContextHolder.currentRequestAttributes(); return (MyObject) requestAttributes.getAttribute("myObj", RequestAttributes.SCOPE_REQUEST); so it does not need a HttpServletRequest instance anymore. And fill it in test: MockHttpServletRequest request = new MockHttpServletRequest(); request.setAttribute("myObj", /* set up MyObject instance */) RequestContextHolder.setRequestAttributes(new ServletWebRequest(request));

Categories : Spring

Code coverage for Scala integration tests with SCCT
I am using scct 0.3-SNAPSHOT / sbt 0.13 for mergin test + it:test try the following setting: ScctPlugin.instrumentSettings ++ Defaults.itSettings ++ Seq( resourceDirectory in ScctPlugin.ScctTest <<= (resourceDirectory in Test), sources in ScctPlugin.ScctTest ++= (sources in IntegrationTest).value ) this might get tricky if you have different resources

Categories : Scala

Visual Studio Integration Tests using setting from web.config
I wasn't able to get it to work having app harbor inject the correct config settings, but I got close. I added an app.config to my web project because my web project has my integration tests in it. I added the environment app setting to app.config: <appSettings> <add key="Environment" value="localconfig"/> I noticed when that code ran on app harbor the environment value was Test:27017. I wrote this code: private static string GetMongoDbConnectionString() { string con = ConfigurationManager.AppSettings.Get("MONGOHQ_URL") ?? ConfigurationManager.AppSettings.Get("MONGOLAB_URI"); string env = ConfigurationManager.AppSettings.Get("Environment"); if (env.StartsWith("Test", StringComparison.OrdinalIgnoreCase)) { con = "mongodb://xxxxxxxx

Categories : Visual Studio 2012

Test multiple android applications with same integration tests?
well, assuming you need to maintain one set of integration tests only, I would go in direction of having: separate maven module holding integration tests only and in it I'd introduce multiple maven profiles, where each one would have specified maven dependency on one of the modules to be tested only build can later switch between the profiles to activate the particular build only As some notes on integration testing options say (http://docs.codehaus.org/display/MAVENUSER/Maven+and+Integration+Testing) and I believe it would affect this approach as well: The disadvantage of doing it this way is that it tends to separate the integration tests from the code they're attempting to test. As a result, you may find that no one "owns" the integration tests; typically you'll have some one p

Categories : Java

AttributeRouting not working with HttpConfiguration object for writing Integration tests
Had the same problem. Found the answer here: https://github.com/mccalltd/AttributeRouting/issues/191 You need to replace AttributeRoutingHttpConfig.RegisterRoutes(config.Routes); with config.Routes.MapHttpAttributeRoutes(cfg => { cfg.InMemory = true; cfg.AutoGenerateRouteNames = true; cfg.AddRoutesFromAssemblyOf<ContactsController>();// Or some other reference... }); I found I also needed the AutoGenerateRouteNames part, too.

Categories : Asp Net Web Api

How to automate integration tests of FQL queries against different sets of test data?
There is no widely known or used framework to achieve this. Thus, you'll need to create a test user. Populate it with what it is you want. Authenticate that test user. and then run the FQL on it. Thats your only option to run the tests you are looking for.

Categories : Facebook

How to pass test outcome to different method in c# unit/integration tests?
In order to get test outcome you can use TestContext.CurrentTestOutcome property. You will get there Passed, Failed, Unknown values. As far as stack trace is concerned I think you should use StackTrace class.

Categories : C#

How to make multiple requests with different data in Grails Integration tests
"Where:" can be used to perform data driven testing in spock testing framework. Try, using the following example: when: "The user adds this product to the inventory" controller.params.JSON = [productId:productId] controller.addToInventory() then: "The size of the inventory should be 2" new JSONObject( controller.response.contentAsString ).inventorySize == 2 where: ID|productId 1|123 2|456 Hope that helps!!!

Categories : Testing

Continuous Integration of JavaScript Tests with MSBuild / Visual Studio
It looks like Chutzpah has a command-line runner, so you can create a PowerShell script which gets called from your build server to run the tests. See the Chutzpah documentation for more information. I'm not sure how you would integrate the test results with TFS.

Categories : Javascript

Sonar: measuring code coverage when integration tests are in a different project
This is how we solved it: Summary: Service and Service-itest projects are two independent modules. Service has unit tests which coverage is reported by Sonar. Service-itests uses Cargo to load the service WAR and run the integration tests. The code coverage collected in this execution is reported one level above. In this way, the coverage for the ITests is collected and merged cross-module and reported at the parent project pom level. We also like this approach becasue it allows us to have different ITests projects (for example, one with Cargo loading the app and another using JBehave), and they can evolve independently. In the parent pom: <modules> <module>service</module> <module></module> <module>service-i

Categories : Maven

Autofac lifetime scope registrations sharing, Integration tests setup
I have actually come to the way to do this (not sure if this right way but it works) To the TestLifeScopeProvider add these methods: public void SetTestLifeTimeScope(ILifetimeScope lifeTimeScope) { testlifeScope = lifeTimeScope; } public ILifetimeScope GetLifetimeScope() { if (lifetimeScope == null) { lifetimeScope = ApplicationContainer.BeginLifetimeScope("AutofacWebRequest"); } return testlifeScope ?? lifetimeScope; } To the TestBase setup add this code: public void SetupServiceMocks() { if (ServiceMocks.Any()) { var currentLifeScope = LsProvider.GetLifetimeScope(); var newScope = currentLifeScope.BeginLifetimeScope(builder => {

Categories : Unit Testing

Take a heap dump during Android integration tests when Out Of Memory error occurs
The test infrastructure could have been hooked into the ddms port. You could actually dump the heap from your test by calling android.os.Debug.dumpHprofData(). The test should run in the same process space as your app. Hence, it should work fine. Start taking the heap dumps in each test after the 45th test and you could probably get the heap dump that you need to analyze.

Categories : Android



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.