How to Pass Values from MTM to Data Driven coded Ui Test case? - visual-studio-2012

I am new to Coded UI.
I Have created data Driven coded UI test Case.I am Passing .CSV file as a data source. We have uploaded that Coded UI testcase into TFS. After Integrating Coded UI test Automated Build With MTM, It Runs fine from MTM for the values passed in .CSV file before automatic build created using VS2012.
Now my question is Is is possible to Pass Values to Automatic Coded UI in above scenario from MTM so that testers dont have to modify .CSV files from Visual studio? If Yes, Can anyone Please Guiid Me How?
Thanks in advance.

Yes it is possible. Here is an example line of what you will need to have at the top of your function. (Note that the TestMethod Attribute is contained within it) This line should replace the Datasource line that you have for your .CSV file.
[DataSource("Microsoft.VisualStudio.TestTools.DataSource.TestCase", "[InsertURLToCollectionHere];[InsertProjectNameHere]", "[InsertTestCaseNumber]", DataAccessMethod.Sequential), TestMethod]
Once you get that in your code you should be able to add the parameters to your TestSteps in MTM by adding the text of "#[InsertNameOfParameterHereWithoutSpaces]". At this point your Test cases should pull the data from MTM instead of your .CSV file.

Related

JMeter jp#gc-WebDriver Sampler — Run the Webpage from MS Excel Spreadsheet

I have the Webpage that need to perform the multi test cases for automation test and currently need to hard code the text variables from WebDriver Sampler by Groovy. And I would like to know that JMETER WebDriver can pickup the data from MS. Excel and performing the test? Like says the I need key in the login page and select the items from dropdown box from the webpage. The next step will be confirm the order by input the Credit Cards information. Thanks.
The easiest is to convert MS Excel file into CSV file, if you're able to do it - you can read the values using CSV Data Set Config
If the file is coming from external location and it's in one of binary formats (.xls or .xlsx) - it's still can be done, but you will have to do some scripting like:
Download tika-app.jar to JMeter Classpath
Restart JMeter to pick the .jar up
Use Apache POI library for reading data from Excel. The code will be different for different file formats and your Excel structure so I can only provide a couple of links with examples and snippets:
Busy Developers' Guide to HSSF and XSSF Features
How to Implement Data Driven Testing in your JMeter Test

JUnit Test Class template not converted to Kotlin file in Kotlin project

If I open a Kotlin project and try to create my own template for JUnit Test Classes I get the generated template generated as a Java file instead of as a Kotlin file.
Is there any way to make this generation to happen as a Kotlin file?
I attached some images to easily show the issue I am facing.
The question marks on one of the images have to do because I don't know what that default parse function does. I tried to change it to #parse("File Header.kt") but that does not work.
The issue was I was trying to add kotlin code to the template.
All I had to do is create the template using Java code and it automatically gets generated in Java.
However, if anyone know a way to specifically use this feature using your own kotlin code instead of generated one, please let me know.

Handling Excel Spreadsheets with Cucumber

I am planning to work on the Cucumber feature file with Groovy code (Katalon Studio) for step definitions. I wanted to use the excel file in Cucumber file or to see is there any other option to use it.
I have not yet tried as of now any other option. I am thinking just passing the cucumber step file without any parameter and then using the excel file with in the step definition and access excel file and get the corresponding value.
I see there is a post in this forum suggesting to use QMetry Automation Framework for this type of question. But it does not look like this will help on this or should I use the passing the row index from cucumber file and based on that retrieve the value. Please guide on this.
Handling excel spreadsheets with Cucumber Scenario Outline
You should know that this is not supported by Cucumber.
As specified in the FAQ:
"We advise you not to use Excel or csv files to define your test cases; using Excel or csv files is considered an anti-pattern.
One of the goals of Cucumber is to have executable specifications. This means your feature files should contain just the right level of information to document the expected behaviour of the system. If your test cases are kept in separate files, how would you be able to read the documentation?
This also means you shouldn’t have too many details in your feature file. If you do, you might consider moving them to your step definitions or helper methods. For instance, if you have a form where you need to populate lots of different fields, you might use the Builder pattern to do so."
If you are using cucumber java 5+ you can add qaf-cucumber dependency. It should work with groovy as well. It will enable to have examples from external source like CSV, XML, JSON, EXCEL, DB.

When using Gauge for UI Automation is there a way to get all screenshots in the same folder as the report

I am using the Gauge framework for UI Automation.
My hope is that I am able somehow to write screenshots to the folder being made to contain the html report for an execution. The trick is that the folder and its contents for a report are not made until after execution completes so I can't write screenshots inside the reports folder as I am taking them during my tests.
Currently the screenshots that I take are written to a folder in the reports folder (root level) of the project. When trying to copy the entire html report to another location I have to also move the screenshots and then have to manually manage the screenshots in that extra screenshots folder as I delete old reports. There are a lot of after the fact steps that I could do but was hoping for a simpler solution.
I am hoping that I was missing something and there was a way to write the screenshots into each reports folder (when reports are not being overwritten) so that I don't have to mangage (move/delete) the screenshots separately and so that the links in the report to the screenshots stay consistent.
Screenshots in gauge's html-report are embedded inside the html as a base64 encoded string. So they currently don't exist as a separate file that you can manipulate.
Some options for your use case:
1) Implement a Custom Screenshot Grabber and intercept the screenshot, save it to any location you like.
2) build a custom reporting plugin (ex, build on this seed example) and collect the screenshots independent of the html report.
If you do not want the reports to be overwritten, you can set overwrite_reports=false in your properties file. See ref.
Note that you can also change the html-report's theme if you want a different report structure.

Group tests by class & namespace in Test Explorer

In Visual Studio 2010, I could list my tests by full name. That way, my tests would be sorted by object, then method, then individual test case when I structured the tests as shown here:
http://haacked.com/archive/2012/01/02/structuring-unit-tests.aspx
However, in Visual Studio 2012 Ultimate RC Test Explorer, it lists the tests by test name (instead of "WidgetMaker.ctor.HappyPath", it just shows "HappyPath"). Is there a way to change the Test Explorer to show full names instead of the test name? Thanks.
Here is the answer in the end of the post :
http://blogs.msdn.com/b/visualstudioalm/archive/2012/03/08/what-s-new-in-visual-studio-11-beta-unit-testing.aspx
So, wait and see/hope...
EDIT : In the mean time, you still can have a similar interface by openning the *.vsmdi file in your solution items.

Resources