Transform App.Config in unit test - app-config

I am using slowcheetah transformation and the transformation works fine.
On TeamCity I want my unittest to build my code in release mode and use the app.config from the debug build. In other words how can I
Build my app in release mode.
Build debug config file
overwrite app.release.config with app.debug.config.
It's all boils down to trigger the transformation in code.

Related

How to build react.js apps at visual studio code?

I have created two apps using 'Visual Studio Code' and 'node.js.' I run them using command 'npm start,' and they show in the browser. I want to build them or deploy them so they can be used by anyone. It says there to use command 'npm run build.' How to do that, and what technique you use in order to build them?
It depends on what configuration you used for building the React app. If you used create-react-app, npm run build is the correct command for building it.
If you used a different configuration (e.g. webpack), you should use the relevant command for that configuration.
Either way, deploying it will be as easy as copy/pasting the build folder's content to the server you want to host it, after running the build command.
Visual Studio Code or any other Code Editor for that matter is not relevant. You can develop, build and deploy any React app using any Code Editor you want, it's just a matter of preference.
"Building" refers to the task of preparing (transforming, minifying, compressing, etc.) all the relevant project files so that they're ready for production (assuming that your build scripts are configured to do so).
"Deploying" an app is usually a separate task that will deploy (upload) your current project build to a development platform provider like Firebase, Netlify, Azure, etc. Note that you have to register with a provider and setup a new project on their end before your deploy your project.
Which provider you use is totally up to you. Also, you have to configure your current project once you've chosen your development provider. They'll provide instructions on how to deploy your project.
On a side note, keep in mind that you can configure your own npm scripts so that they run whatever you want. More about that here

How to include chutzpah test cases in tests project to output folder

I have a web project, say 'WebProj' in which I have defined all the my javascript source files with angular code. I am defining my chutzpah unit test cases for those javascript source files in another project 'WebProj.Tests' along with my other C# test cases. I am having both the web and tests project under same solution.
My problem is that when I try to integrate the web project to the TFS build process I cannot run the chutzpah test cases as the web project output folder don't have the chutzpah test case files copied to the project output folder. At the same time the test cases are executed if I have the chutzpah test cases defined in the same web project.
How can I execute the javascript chutzpah test cases on build process if those are defined in a separate Test project and include them in project output folder after build?
To have the test case files copied to the build output folder, you need to right-click the .js file and select Properties -> set the Copy to Output Directory property to be Copy always.
Additionally, you need to follow the steps below to run chutzpah tests in TFS build process.
Install jasmine.js to the test project.
Install Chutzpah Test Adapter
Install Chutzpah test runner to the solution (on solution level, not project level).
Set the test assembly to match your javascript test naming convention. e.g. ***.tests.js
Configure to use the custom test adapter during TFS build process. 1). If you are working with vNext build, go to Visual Studio Test step, set the Path to Custom Test Adapters property to be similar to $(Build.SourcesDirectory)\packages (get the path via NuGet restore); 2). If you are working with XAML build, go to Build –> Manage Build Controllers, set Version Control Path to custom Assemblies to the package path.
Completed steps can be found on the "But what if you want run Jasmine.JS test?" part in this blog: http://blogs.blackmarble.co.uk/blogs/rfennell/post/2015/09/23/Running-nUnit-and-JasmineJS-unit-tests-in-TFSVSO-vNext-build.aspx
And also this blog (do not follow the Step2 to check in these files into TFS version control, instead use NuGet to donwload these packages.) http://blogs.msdn.com/b/visualstudioalm/archive/2012/07/09/javascript-unit-tests-on-team-foundation-service-with-chutzpah.aspx
Add another Visual Studio Test step to your build definition that just runs the JavaScript tests as shown below; the redacted portion in the green box of the Test step is the path to your test files. When the build runs, the stats from the two test runs will be combined in the build output.

How can one import the whole webDriver project in an executable form so that anybody else can run the suite by just a click.?

I am relatively new to Selenium WebDriver and a self learner. I have created a webDriver project which consists of different packages and have made use of Page Factory concepts extensively. I use TestNg framework to run the suite to generate my report. So my test cases are also following the TestNG framework concepts.
Now my team wants to use my script to be run at every build to test the sanity. The build team just wants to run my whole script by just a click. It can be shell script command or .exe or jar. Build team uses linux m/c and they dont have Ecplise , TestNg installed in their machine. Their intention is whenever build is given they want to run my script by just a click or a command in Command Prompt.( it has to be that simple for them) and a report should be generated in some location in hdfs
My script runs on FF version 32 and Selenium webDriver 2.44.0
Would really appreciate if someone could give me a solution that actually works for my requirement.
I found a similar query from someone but i am not sure if the answer still suits.
How to make Java executable Jar file of WebDriver project
Could somebody please give me a solution. Or the solution mentioned in the above link stil is the best?
Regards
There are few ways to do it:
Use CI tool (Jenkins): You can set up your project in Jenkins and it will allow you to run the project in single click. Jenkins also provides you an option to run the tests periodically so you can configure it in such a way that it will always get executed after certain time period.Jenkins is also capable to trigger the execution if there is any changes in source code of tests. I'd suggest to use this tool. https://jenkins-ci.org/
Use .bat or .sh file: I am not sure if you are using any build tool like ANT or Maven, if you are using any one of them then you can write a .bat or .sh file to run the tests. ANT
If you are not using any build tool then start using, it will help to run the tests in simplest way.For me to run entire suite, I just type below command in terminal from root directory of project
ant run -Dsuite=all
If you are more concerned about system configuration for e.g. the system which will be used by build team does not have a specific version of browser or specific required library. Then I'd suggest to keep all essentials like browser installation files, libraries in your project directory. This is not a good practice but yes it will help others to run the tests smoothly.
I would suggest just exporting a jar file for your project. All the libraries will be packaged together in the jar files(including TestNG) and you can simply double click on the jar file to start your tests.
External resources (if any), will have to be available for the jar file though. So, you can provide the jar file and the external resources together. The external resources might include your test data (if any) or Portable Firefox(if you are using the portable version).
Steps:
Right click on Project -> Export -> Runnable jar file
Give a name and file path for the jar file
Select option - Extract required libraries into generated JAR
And Finish
Troubleshooting:
Check the java version for the machines that you will be running your jar file on. Programs compiled with java 7 will mostly not run if the machine has java 6. Either compile with java 6 or update the jre on the target machines.
If the jar file does not launch, try using Jarfix.

How to package react-native application

I am building a sample react native application. Currently i am running it using the node server.Node server is serving the js file.
You can see this in following screenshot:
I want to shift to the option2, for this, if there is any change in the js file, i need to run the curl command manually.
Is there any alternative for this?
AFAIK there's nothing in place and this is work in progress. See:
https://github.com/facebook/react-native/issues/12
We plan on putting in some sort of build step that "compiles" the JS
source directly into a resource file in the app bundle. Obviously in
production you wouldn't have a server running nearby.
There's another bit of discussion here.
At the moment I think you're stuck with the curl option.
All this does is packing all your JavaScript together and writing it into a single file.
Option 1 has a small http server running, providing the latest packed file when you request it.
Option 2 takes the file from the local disk.
You can setup a tool that looks watches your project files and repacks everything if you make changes.
You can do this by yourself, using the packaging tool shipped with react-native (react-native bundle [--minify]) and re-run it everytime things changes using gulp (and gulp-watch).
Also you can use webpack as your packaging tool and use the --watch option. (see example)

Is there an example of AngularJS app generated by Yeoman with e2e tests and $httpBackend?

Is there somewhere an example of AngularJS app generated by yo angular generator that has e2e tests with $httpBackend from ngMockE2E module? Preferably with single and continuous versions for CI and development.
It looks like using $httpBackend requires one to create a new app that depends on the original app module and ngMockE2E module and requires new index.html file that loads this new app.
If tests use a different app, does it mean that I should modify configuration to store files generated for tests somewhere else than files generated by grunt server command (.tmp), or will these files be exactly the same? I'd like to be able to have grunt server running for development while running e2e tests in the background with PhantomJS.
Has anyone created a task that automatically generates modified index-e2e.html file based on index.html? This way it would be always up to date and it could also be used with watch to automatically regenerate it whenever original index.html file changes.
You should notice that angular is depreacting e2e in favor of the protractor framework.. Also notice that e2e (and protractor also) is quite slow. so running continuously in the background like we do with unittesting isn't recommended. That said, for your question - No you don't need a different app, index file etc. (unless you need coverage data from e2e, in that case you'll need to instrument the js files, and that would require a different index.html, that can be created in grunt task with sed). what you do need is a different karma.conf.js file, a different grunt karma task ro reference it, including ng-scenario in the files section of the karma.conf. and running some kind of grunt testServer task that would run a test server, which isn't the same as the dev grunt server. You can run both with foreman or something similiar (as explained in this SO [question]. (How can I automate both E2E and unit tests with Yeoman & AngularJS?) and answer). If this is what you are looking for - you can find a karma.conf.js example for both e2e an unit in this PR. and again, don't invest heavily into the current e2e framework. better working the the new and shiny protractor

Resources