Automating silverlight unit tests using StatLight and TeamCity - silverlight

What is the best way to run silverlight unit tests automatically using team city?
I have found StatLight which we had working well when we used cc.net, and it says that it has support for teamcity. Does this just mean the test results output file is compatible with teamcity? Do I need to create a command line runner to run the tests? If so how do I get the test results into team city?
Thanks

TeamCity has an extensibility feature where you can output special commands to the console and the TeamCity agent will capture the commands and publish the results within TeamCity.
If you get StatLight running on your desktop - do a regular console-run. Then do another run by giving it the "--teamcity" parameter. Notice the difference in the output?
In TeamCity you can setup a Command Line Build Runner
Command executable: "<Path to statlight.exe>"
Command parameters: "-x=%system.teamcity.build.checkoutDir%\PathToXap\SilverlightClient.Tests.xap --teamcity"
Hope this helps.

There's also a StatLight TeamCity plugin that adds a test runner.

You can try using Lighthouse Silverlight Unit Test Runner, it works with every Build Server including TeamCity and CCNet because it by default produces NUnit compatible xml results file:
http://lighthouse.codeplex.com/

Related

How to make jenkins job as unstable after TestNG Failures

I have configured my test scripts to run from Jenkins using TestNG XML. This xml triggers a suite of testcases from my available test suite. This xml is triggered using a batch file and configured as a build step in Jenkins.
Issue:
Though some of my test case is failing, jenkins job is reporting as Pass since the batch script was completed successfully.
Is there a way to pass the Failure report back to batch file and then to Jenkins to report fail if any test case in the suite failed.
Use TestNG Results Plugin, https://plugins.jenkins.io/testng-plugin.
Then publish the testng result by providing appropriate path to the testng-result.xml. The job will turn yellow on failures.

Tosca and Jenkins

Does anybody work with Tosca and Jenkins?
I have problems to run my batch script from Jenkins. It does not open browser, but job is finished successfully. Batch script runs normally when I try to run in on Windows, without Jenkins.
Anybody has an experience using these two tools together?
In order to use Tosca CI with Jenkins you need to:
Configure your Jenkins build project
Add an additional build step (Execute Windows batch command)
Call ToscaCIClient.exe/ToscaCIClient.jar with parameters
e.g. "PathToTosca\ToscaCI\Client\ToscaCIClient.exe" -t junit -r PathToResults\result.xml
Further information can be found here: https://support.tricentis.com/community/article.do?number=KB0012411
The issue your facing is because your running Jenkins as windows service, in this case headless execution happens technically your script is executed for other user account.
Solution
Instead of installing Jenkins host it on Apache Tomcat server
Download Jenkins war file
Copy it inside webapps folder of Tomcat
Run startup.bat
Refer-
https://www.tutorialspoint.com/jenkins/jenkins_tomcat_setup.htm
I had faced the same issue.
I am guessing your slave machine running the test has jenkins services installed as services.
Uninstall the service. (.jenkins/jenkins-slave.exe uninstall)
Use the .jnlp or slave.jar to connect the machine as a slave.
Your test should run fine after that.
If it does just create a batch file to connect the machine as slave whenever it is logged in.
I tried that. But in any case, Jenkins does not open the browser, so Tests from Execution List and I do not know why.
We use Tosca 10.

Error in Selenium tests triggered from batch script in TFS Build step

Step 1. I have written selenium tests and bundled it into executable jar.
Step 2. When I execute this jar tests runs normally. Invokes New browser and execute all steps.
Step 3. I created bat file to execute this jar. In this case also test execution happens normally.
Step 4. TFS Build integration. (TFS 2015)
- I created new build definition in TFS
- Added build step "Batch Script"
- Entered path of bat file created in step 3 in build step
- When I Queue this build. bat file gets called and test execution starts. But It does not open new browser..console says Started IE driver...it starts driver internal to build agent. and execution fails on setting value in textbox.
Click to see TFS Build Cosole
I can't use Visual studio tests. Requirement is to selenium tests should be triggered from jar created on Step 1.
Make sure the build agent is running in interactive mode.
First you could try to RDP to the remote build server(the build agent located) and manually run the batch file to see if it works.
If it's also not work then the issue may related the IE browser on the server.
If it works then maybe the TFS build service account don't have enough permission to run the IE driver. Please make sure the build service account has local Admin permission on the build server.

Can not run End to End Test in Angular Seed

I am trying to follow the AngularJS Fundementals series on PluralSight. The instructor has downloaded and opened up Angular Seed, and runs the e2e-test.sh file with no problems.
I use the regular Windows Command window, and so I attempt to follow his lead but with e2e-test.bat.
But it isn't working for me, here is what I get:
Have you installed Karma? http://karma-runner.github.io/0.10/index.html
npm install -g karma
If this installs ok you should be able to check the version from the command line:
karma --version
I'm taking the same course and I ran into the same issue.
You need to use the Node.js command prompt instead of the Windows Command Prompt.
If you have Windows 8, go to the Start page (hit the Windows key), then type "Node".
The Node.js command prompt will be one of the results.
Then from there you can install karma, karma junit reporter, etc. and run the test scripts.

Unable to execute TestNG Suite file via command line

I am trying to execute a TestNG Suite file via the command line in order to initiate a regression run.
Currently I am doing this through my Eclipse IDE successfully by right-click on the "testng.xml" file then selecting Run As > TestNG Suite.
However, when I try to run it via the command line, I get an error message. Steps below:
I navigate to the directory where my "testng.xml" file is saved. e.g. C:\Users\xxx\Documents\eclipse projects\Automated Testing\config
Run the command:
java org.testng.TestNG testng.xml
The above command generates the below response:
Error: Could not find or load main class org.testng.TestNG
I tried setting the classpath to include all of the selenium and testNG Jar files as per below:
set classpath C:/Users/xxxx/Downloads/selenium-java-2.25.0/selenium-2.25.0/libs/*
However, this generates the below error message:
Environment variable classpath C:/Users/xxxx/Downloads/selenium-java-2.25.0/selenium- 2.25.0/libs/* not defined
I have looked on the testNG Documentation (http://testng.org/doc/documentation-main.html) and this just says that testNG has to be in your classpath, so now I am a bit stuck. Any help would be greatly appreciated.
Either methods work :)
Method #1
cd C:\Workspace\projectname
java -cp C:\Workspace\projectname\lib\*;C:\Workspace\projectname\bin org.testng.TestNG testng.xml
Method #2
cd C:\Workspace\projectname
set ProjectPath=C:\Workspace\projectname
echo %ProjectPath%
set classpath=%ProjectPath%\bin;%ProjectPath%\lib\*
echo %classpath%
java org.testng.TestNG %ProjectPath%\testng.xml
Thanks #siemic, I have finally got it working now. Basically you just need
to run the two commands below:
set classpath=..\bin;C:\libs\selenium-java-2.25.0.jar;C:\libs\testng-6.0.1-nobsh
noguice.jar;C:\libs*
java org.testng.TestNG
It was the first command that I was having trouble with, so just to elaborate I needed to set the following three items on the classpath:
The BIN Directory of my project. This is because the java files that I have developed are located here.
The Selenium.jar file, this is because I am using the selenium framework
The testng.jar file, needed because this is my unit testing framework
Then finally I used a wildcard to include all other JAR files within my libraries folder. The weird thing
is I needed to fully specificy the name of the selenium and testng jar files, or else the tests don't work. Not too sure why.
Anyway it is working fine now and I am able to execute the tests via the command line.

Resources