Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
As suggested I am rewording the question for clarification on requirements:
Suppose there are 4 environments (Development/Functional Test/Staging and Production). Each environment has its own database, Rest API (URI), username, password etc etc and there are two sets of tests
a) Continuous Integration tests that run as part of deployment (Run against Development and production)
b) Complete test suite (Run against Functional and Staging)
I want tests to pick up environment dynamically or It can be specified as command line argument to kick of the required tests.
Since you're talking about Urls I will assume you are running some sort of automated UI tests.
For a given feature1.feature Specflow generates a C# file called feature1.feature.cs, in this file there are tests written in the unit testing framework you have configured in your App.config. Here are the available unit test providers.
When you run your tests from the command line, you are actually running those (let's say) NUnit tests. So you won't be able to get those arguments from the command line.
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this question
I want to overwrite the Program.cs file in a solution I have created for a test, and then compile that solution - as a unit test.
With our library we have in the designer that comes with it a button titled Generate Code. When you click that button it pops up with the code for a sample Program.cs file that calls our library specifically written for the template created in the designer.
We want to have a unit test that verifies that the code we created compiles. We're not testing that it runs, just that it compiles. So the thought is we create a project, replace the Program.cs file in the project, and then compile the project. Successful compile, the test passes. Compile fails, the test fails.
What's driving this is we had a mistake in the code where it had "${name}.compile()" instead of $"{name}.compile()" - and that will easily be found with this.
So, can it be done?
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
It’s true that using Contracts.Requires and Contracts.Ensure in C# methods will reduce the necessary unit tests for that methods? Can I just ignore the range of values that are not in conformity with the contracts or those values should also be included in the unit tests?
It should not, design by contract is not intended to replace unit testing, or any kind of testing. Pre-conditions and post-conditions are used to enforce a contract, but the end client of that contract needs to make sure that such contract is still in place. So you need to keep the unit tests in place with all range of values to make sure everything is the way it should be.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I have planned to implement automated testing for our web application .I want the tool to be open source, test cases should be written in C sharp.
So i choose to use selenium Web-driver and N-unit. I have a set of questions.
Can i only unit testing with this setup? Cannot do function testing?
I'll avoid answering your first question as it's not suited for StackOverflow :)
Can i only unit testing with this setup? Cannot do function testing?
You can use Selenium with a wide range of tasks.
I started off doing unit testing of individual components of our web application.
Then I moved on to functionally testing the end-to-end behavior.
Currently I'm doing massive stress testing with hundreds of concurrent browser sessions.
All using Selenium.
Should i have to write all test cases as methods?
As far as I know (and I don't know a lot), the most flexibility is attained when you conceptualize your testing architecture this way.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I a have a solution containing 25 projects comprised of both C# and managed C++.
I need to test one of the C# project calls but this project is of type "Window application" (Not DLL).
Even though it is a windows application, my requirement is to call only few internal functional calls (Not related to windows form).
I need to create a separate C# test project to call this functionality. Is it possible to do it like this?
Can anyone suggest a way or examples? And one more thing, I cannot modify the existing code.
Is it possible to do it like this?
Yes. Referencing the project you wish to test in a test project is typically how you unit test your code.
Can any one suggest a way or examples?
Create a unit test project, reference the project that contains the code you wish to test, write tests to test the code you wish to test. If you need to refactor the code to make it testable, do so, or see point below.
And one more thing, i don't have any freedom to modify the existing
source code.
In this case, you are going to have to wrap the code in some cleaner interfaces to allow you to test the code.
The book, Working Effectively with Legacy Code by Michael Feathers has some excellent advice on how to get legacy code under test.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I have a requirement of publishing three different applications( WPF - *exe) using ClickOnce deployment approach. This is very much similar to the MS Office suite where we have multiple office application which gets installed in one go. Do anyone know the ways to achieve this using VS 2012
If you want to use ClickOnce, you have to publish the applications separately, and the user has to install the applications separately (but you can group them together on the user's Start menu). Otherwise you want to look into WiX or InstallShield or some other product.
To get them to group together on the Start menu, set the Publisher name and Suite name to the same values, and set the Product Name to the name of the application.
For example, if you set the Publisher Name to Contoso and the Suite name to FunWithClickOnce, you will see an entry on the start menu for Contoso, and under it you will see the suite "FunWithClickOnce", and under that you will see the application.
Note that if you leave the suite name blank, it will just put the applications under the start folder for the publisher name.