w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
While Sending Html Mails from my web application Recieved Mails contains Symbols like &ldquo,&rdquo, ‘
Check with another constructor for htmlView: ContentType mimeType = new System.Net.Mime.ContentType("text/html"); var htmlView = AlternateView.CreateAlternateViewFromString(bodyMessage, mimeType);

Categories : Asp Net Mvc

How to get tests in unit test project to be run (when the method has parameters)
AFAIK, VS unit test don't support parameterized unit tests. Your only way is to write another, parameterless overload and call your method from there. BTW: The optional parameters are nothing but syntactical sugar; the method still requires the parameters. Example: public void Test_One(bool p1, string p2) //... public void Test_One() { Test_One(true, "defaultvalue"); } You should take a look at another framework, e.g. NUnit, which allows you to easily parametrize your tests (even with ranges, automatic combination of parameters etc.): See http://nunit.org/index.php?p=parameterizedTests&r=2.5

Categories : C#

Testing an WPF app with CodedUI tests, should the coded ui test project share a solution or not?
I also have/had this problem, because we are at the beginning of using CUIT. For now the CUIT remains in product solution. We do this because the tests should remain in memory of developers. When tests stay in on solution I'm afraid they get lost in oblivion. But indeed there is sometimes a bad feeling that the CUIT pollute the products solution, so i guess they will get their own solution after some time pass and the test become established. Edit: If you use different Versions of Visual Studio you have to consider that for example a VS Prof. can’t build a solution with Code UI Tests. This means in “multi VS-version environments” you have to separate Coded UI Tests from “real” code.

Categories : Visual Studio 2012

How can I prevent a tests in a specific project from being discovered by the Visual Studio 2012 test runner?
I simply unload the project until I want to run the tests. Which projects are unloaded are saved in the .suo file, which can be excluded from source control if your lab build is being done automatically, or you can reload in manually if your lab building is created manually.

Categories : Visual Studio 2012

Test Project in Visual Studio 2010 for a Windows Service Project
Do you want to debug the service or code that service runs? In the past I would create one project for a service, one project for a library that contains the logic, and one project for a console app that would be used to test and debug the logic locally. That setup covered most of the debugging needs. Hope this helps!

Categories : Visual Studio 2010

How to add test project over an existing project in Visual Studio 2012
I had the same problem with GTest framework (but I think it does not matter). So I found 2 possible solutions: Change output type of the tested project. Make tested project output as "static library" ( Project - Properties - Configuration Properties - Configuration Type - Static Library (.lib) ), then add the library file to the testing project (Project - Properties - Linker - Input - Additional Dependencies - Path to lib file from tested project) there is article to read http://leefrancis.org/2010/11/17/google-test-gtest-setup-with-microsoft-visual-studio-2008-c/ OR Add files from tested project to testing project through menu Project - Add Existing Item (choose *.h and *.cpp files you need). If someone has more convenient solution to the problem it would be great to know it.

Categories : Testing

Difference between C# Test Project and C# Class library Project
The test project will, by default, have all the MSTest references added for you automatically. Also some default examples, such as a simple example test, is created for you. With the class project, you can build a test project from that too, but you manually have to add the MSTest references yourself. Not a major problem really, but the test project can save you time and hassle. EDIT: As noted in the comments, the big difference between the two project types is that, with a class project, you can choose whichever unit testing framework you like.

Categories : C#

Running Android JUnit tests with Ant (with external dependencies): Target "run-tests" does not exist in the project "XY"
I managed to solve the problem by starting all over: reverted the build.xml to default as it was generated. I also transferred all external jar libraries to /libs library and thereafter I can build the tests.

Categories : Android

Remove WSDL from soapui project without removing test suite [To reduce size of SoapUI project file]
Now this was fun.. There are two ways through which you can reduce the size of the soapUI project XML. 1) Uncheck the caches and associated WSDLs locally for offline access and improved performance option under preferences>WSDL Settings like in the below image. This setting has no impact on existing projects just on projects that will be created after this option is checked/unchecked. Having this option unchecked can significantly reduce the size of the soapUI project. See the image below, both of these projects were created using the same WSDL and the size is reduced by half. I had another instance where the size reduce from ~400kb to 100 kb after this option was unchecked. 2) Edit the soapUI project xml, this is useful when the project exists and test suites have already been cr

Categories : Web Services

How to test single test modules in intellij in maven project having test dependency?
Got my answer there : http://youtrack.jetbrains.com/issue/IDEA-112978 That's because a run configuration is created by template. And that template has default setting to pick classes across module dependencies. For me in 132.46 the following helps: 1. Open Run Configuration dialog, Defaults section. 2. Find respective template. I tried JUnit. 3. "Test kind" combo, select All in package. 4. Set "In single module". 5. Apply to save the template. After that delete created configurations and repeat "Run All tests". It picks only classes from current module for me. The possible improvement in IDEA is to modify these defaults specially for Maven-based projects. Rather specific change...

Categories : Maven

How to run unit tests for appengine go project
It may be worth mentioning that the appengine/aetest package is now included in the SDK, since 1.8.6. See the documentation. Basically you get an appengine.Context that can be used in your tests, similar to icub3d/appenginetesting. Quoting the example from the docs: import ( "testing" "appengine/aetest" ) func TestMyFunction(t *testing.T) { c, err := aetest.NewContext(nil) if err != nil { t.Fatal(err) } defer c.Close() // Run code and tests requiring the appengine.Context using c. }

Categories : Google App Engine

libvlc-qt error while executing the example project
For all newcomers from the internet, to save their time. When you install libvlc-qt* using apt-get then you will have library compiled with QT4 (it is by default). And the problem is that your app trying to use both QT4 and QT5 at the same time. My solution: sudo aptitude install qtbase5-dev qt5-default qtdeclarative5-dev qt5-qmake libqt5opengl5-dev libqt5gui5 libqt5quickwidgets5 libqt5widgets5 libqt5x11extras5-dev libqt5location5 libqt5core5a libqt53d5 sudo add-apt-repository ppa:videolan/stable-daily sudo apt-get update sudo aptitude install vlc vlc-data sudo aptitude install libvlc-dev libvlccore-dev Download source of the vlc-qt library from official git reporitory https://github.com/ntadej/vlc-qt and build it yourself with QT5 and run make install sudo ldconfig -v ldconfig cr

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

Selenium tests Jacoco project coverage
I'm not sure if I do not understand your question correctly… But if I understand it correctly, you want to see the code coverage for Selenium Tests on the productive code? That is simply impossible! Selenium helps you test the web application. Your code is not being tested with Selenium, but just the web pages resulting from the process of your application.

Categories : Maven

Implementation of Unit test and acceptance test in a .NET project
Many questions... public/private: Typically, you only want to test through the public interface. If you want to test a private method it's probably a sign of that you should split the class into two and let the private methods become public (or internal). SRP. To test internal method, check this answer. When writing a test you want to test the behaviour of the system. With behaviour, think of how the system behaves as seen from the end user (although there could be other interesting stakeholders as well). If you do this, you seldom encounter the problem with wanting to test private methods. The difference between a unit test and an integration test is debated and, in my opinion, not a very important debate. What's more important is to ask yourself, what's the purpose of the test? If yo

Categories : Dotnet

How do I test an "error" in Visual Studio Test Project
There are two types of errors that you want to test. Those returned as part of a result and those that occur as exceptions. You could test the first type like: [UnitTest] public void MethodUnderTest_ScenarioBeingTested_ResultOfTest() { // Arrange string expectedError = "Danger Will Robinson"; IMySpecialService service = new FakeSpecialService(); // Act var result = service.CallOperation(thisArgumentCausesError); // Assert Assert.AreEqual(expectedError, result.ReturnMessage); } The above will test an error message returned from some fictive object and will be compared against an expected error message "Danger Will Robinson"; When you want to test exceptions you use similar approach but decorate your unit test class with a special attribute: [ExpectedExcept

Categories : Unit Testing

__init__.py in project folder breaks nose tests
Looks like your question was answered here. You've got an __init__.py in your top level directory. That makes it a package. If you remove it, your nosetests should work. If you don't remove it, you'll have to change your import to import dir.foo, where dir is the name of your directory.

Categories : Python

visual studio can't find unit tests in web project
Refactor the solution so that the code that you are testing is in one assembly for example Dataaccess.dll that is referenced from the web project and the test in a test project DataaccessTests that also reference the Dataaccess.dll project.

Categories : C#

Unable to execute unit tests in a maven project from within intellij
It would be very convenient if one was able to debug tests from within IntelliJ. I have run into similar issues with my massive project and have found a workaround for it. When wishing to debug a test, I have often found it useful to use a remote debugging session like so: mvn -Dmaven.surefire.debug="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -Xnoagent -Djava.compiler=NONE" -Dtest=com.autofunk.TheFunkImplTest test -DfailIfNoTests=false You can then attach to the above using a remote debug session from within IntelliJ on port 8000. Therefore, when debugging tests I first check to see whether a simple debug from within Intellij works. If not, I run the above and then attach to it using a debug configuration like so:

Categories : Unit Testing

Parallel testing a Jenkins with specific tests from a maven project
Not sure how to achieve it purely in Jenkins, but the first option coming to my mind is that you could create separate maven profiles for each test type and create one jenkins job per profile. For more info on maven profiles, see official docs: http://maven.apache.org/guides/introduction/introduction-to-profiles.html

Categories : Maven

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

Get classpath for integration tests of multi-module project with maven-ant-task
You are trying to break the maven conventions in many ways. 1. You should not ever have cyclic dependencies, 2. You should do things the maven way instead of resorting to ant-tasks 3. In your global pom you are declaring dual types for the same artifact (jar, test-jar). Although at first this might not seem to answer your question, you should take a step back and rethink your layout. Integration tests need all the dependencies and are much more demanding than unit tests. So, instead of trying to fit them into the existing projects, create a separate maven project in the same group, that will only host integration tests (under src/java/test, main will be blank) and will have as dependencies all the other projects.

Categories : Java

Maven project that runs a series of unit tests written in Python
The maven-surefire-plugin allows specification of a custom test provider (see the API). You tell surefire to use the provider by adding a plugin dependency as shown in the examples. They don't mention a provider that runs Python tests, maybe someone else has written one? If not, maybe you may write it. The surefire plugin source contains 4 different providers you could use as examples.

Categories : Python

Force msbuild to build a project which is unselected in solution config
As far as I know this is not possible. Looking at msbuild's command line options and in the solution file, there's nothing to support it. But since you're using cmake, you can use it to to build everything for you without having to do it manually. I found this thread which basically asks the same question as you, and has the correct syntax using the idea already I put it the comment: cmake --build . --target install Looking somewhat further, from the devenv cmmand line options it seems it does have the functionality you're after. This forces a build of the given project even if it's not enabled in the Configuration Manager: devenv buildzlibvc-9.0x86zlib.sln /Build Release /project INSTALL

Categories : Visual Studio

How did my Xcode project get changed from iOS project to an OSX project?
By your comment you should not have an issue navigating this. Go to your Project (in upper left) -> Project (project name in submenu) -> Build Settings -> under Architectures menu select Base SDK and choose iOS 6.1. This should switch your project back. Now under Info you should see your Deployment Target options have switched from saying OS X Development Target to iOS Development Target As for why it originally changed, I have no idea. But hopefully this will fix your issue.

Categories : Xcode

One test project per branch?
I tend to follow one-for-one projects. This allows my test projects to mimic the structure of the project and keep in scope exactly what the tested project "sees." (This is further supported by making the default namespace of the test project match the tested project.) Of course, this is usually for larger or more complicated projects. If you have a few projects that are pretty light, there is no reason you couldn't reasonably put all your tests into one project.

Categories : Vb.Net

Visual Studio 2010 - how to force project reference to use exact path NOT GAC or Program Files?
We have the same setup - we reference 3rd party assemblies (and some of our own) in a separate folder, and hints in a .csproj file work just fine for us. Visual Studio will first try to find the dll in the HintPath and only if it doesn't find it, then it looks further - the binaries next to the executing assembly, solution folder, or the GAC. Also, remember that the Reference Paths tab in the project properties is treated the same way as HintPath, and that the listed order of folder hints matters. If this is still bugging you, maybe you should think about raising your own local NuGet server (which supposedly isn't all that complicated), from which the assemblies will get collected automatically on solution load. It's a bit of an overkill, but it also handles the issues with multiple vers

Categories : Dotnet

Project has no project.properties file! Edit the project properties to set one error
Why don't you do this Right click on Project Root folder > properties > Java BuildPath > Library Tab Check whether any of library is missing (showing error with red cross) if yes then add this library to your project don't forget to CHECK it on Order and Export Do one more thing Right click on Project Root folder > properties > Android > set your Project Build Target check any one target Check your Android-sdk path from Window > Preference > Android

Categories : Android

gradle pull test jar from other project
What you will end up with is something like tasks.create( [ name: 'testJar', type: Jar, group: 'build', description: 'Assembles a jar archive containing the test classes.', dependsOn: tasks.testClasses ] ) { manifest = tasks.jar.manifest classifier = 'tests' from sourceSets.test.output } // for test dependencies between modules // usage: testCompile project(path: ':module', configuration: 'testFixtures') configurations { testFixtures { extendsFrom testRuntime } } artifacts { archives testJar testFixtures testJar } tasks.uploadArchives.dependsOn testJar

Categories : Maven

How to implement a Qt / Qt Creator project with test scaffold
QTestLib is probably what you are looking for: http://doc.qt.io/qt-4.8/gettingstarted-develop.html#qt-utilities http://doc.qt.io/qt-4.8/qtestlib-manual.html http://doc.qt.io/qt-4.8/qtestlib-tutorial.html http://doc.qt.io/qt-4.8/qtestlib-tutorial1.html Hope that helps.

Categories : Qt

Running UiAutomatorTestcase in AndroidJunit Test Project
As standard, UI Automator tests are compiled and built into a jar file, on a desktop computer, they are then deployed to the device by pushing the jar file to the device using adb. They are then run on the device, in the Android runtime by using adb shell uiautomator ... Thanks to http://stackoverflow.com/users/363437/vidstige for correcting my earlier post which was inaccurate. Probably the fastest way to help you get your tests running is for you to post your code as part of your question. Update 22 July 2013 I have not seen anyone else trying to run the test cases directly on the device rather than building them following the approach Google (Android) document. It might be possible, however you may have to work hard to discover whether your approach is possible or viable. UIAutomator

Categories : Java

How to reference LeadTools to Unit Test project?
In VS 2010 that was possible to specify where to resolve assemplies right in Test Settings. To do that in VS 2012, you could do that in App.config as described in this post Assembly Resolution for Unit Tests by Visual Studio Test Team. Just add app.config to your test project and put there the appropriate <AssemblyResolution> details. <?xml version="1.0" encoding="utf-8" ?> <configuration> <configSections> <section name="TestExecution" type="Microsoft.VisualStudio.TestTools.Execution.TestExecutionSection, Microsoft.VisualStudio.QualityTools.ExecutionCommon, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> </configSections> <TestExecution xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010"> <Assembly

Categories : Unit Testing

Time Exceeded for a project Euler test
You have a while statement in there which should be an if statement. while takes you into an infinite loop as you never change the value of i inside the loop when the condition you are testing for is met.

Categories : C

NUnit is not releasing the .dll for my unit test project
Whenever you are building your solution. I suggest you to close the Nunit, which is loaded with your .dll. After unloading try to build, then your build will succeed. As Nunit is using you .dll. It won't allow your build to be success.

Categories : C#

How to build a JAR file using ant for uiautomator test project
In the terminal run which ant It seems you do not have ant installed. If no location like /usr/bin/ant shows up after you run the command above, use this to install it: sudo apt-get install ant Try again after. It should work.

Categories : Android

.NET project: non existant test breaking the build
TFS will run tests on all dlls with the word test in them. Check your drop folder for all dlls that contain the word test and I would imagine one of them contains the test you are seeing.

Categories : Dotnet

Visual C++ project: best unit test setup
One possibility I can think of is to add all the sources from the main project to the unit test project as a link: Visual Studio - how to create two projects using the same sources Second option would be to use a post-action in the main project and compile the main project or some part of it from the command line into a library which can be linked into the unit test project. This way one "build" action would produce an exe and a dll/lib file. Third option, somehow combination the two options above: manage the unit test project outside of VS - compile the sources of the main project from a build script (simple batch file or scons, make, ant etc.) with the sources of the tests and execute from the command line.

Categories : C++

How Do I Properly Deploy With An Integration Test Project?
You shouldn't run mvn deploy directly but use the release plugin instead. You have to run mvn release:prepare release:perform for doing and deplying a relase. See also this blog post about deploying snapshots.

Categories : Maven

Run JUnit Test on a file not in project folder
Unit tests allow testing compiled class files. Not .java source files. For the test to be able to use (and thus test) a given class, this class must be available in the classpath. So, when launching JUnit, make sure to have the directory or jar file containing the classes to test in the classpath.

Categories : Java

Forcing NetBeans 7.3 to recompile project on test run?
Disabling Compile on Save feature in project properties should do. Then Maven build is executed all the time. Please note that in upcoming 7.4, Maven builds are always executed but with Compile on Save turned on, the phase execution is skipped.

Categories : Testing



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