-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
3.0 Code Updates #204
base: master
Are you sure you want to change the base?
3.0 Code Updates #204
Conversation
Migrated to SDK-style project Upgraded to SpecFlow 3 Upgraded to MSTest.Framework and MSTest.Adapter Added ability to attach files to MSTest test results context Added ability to set the browser time zone for Microsoft Edge (Chromium) and Google Chrome Added web driver logging support Support Win App Driver, keeping track of the page/window/dialog history Added TempWebElement Added support for double-clicking, right-clicking, and mouse cursor hover Added support for closing the browser/dialog Added support for entering text Added support for maximizing and switching windows, and focusing the window before clicking on elements Added support for navigating to the previous page (going back) and refreshing the page Added support for validating the page URL query string Added support for setting element data using JavaScript Added support for setting the browser page load strategy from the configuration Added support for validating virtual properties Added support for page sections and contexts Added support for waiting until validation table Improved support for elements that require custom logic to get and set values
Hi Rami, One larger theme that comes to mind is should we continue support of CodedUI. Based on this article: https://devblogs.microsoft.com/devops/changes-to-coded-ui-test-in-visual-studio-2019/ the framework seems to be deprecated. Thoughts? |
It's true that Coded UI is being deprecated. I'm not expecting all features in SpecBind to be implemented in Coded UI. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again for all the hard work adding this to the project. There are a decent number of comments in here, a few nits but mostly design based ones. A few high level comments:
-
I'm still a bit concerned with the size of this PR overall, when I've added actions it makes it easy to check off all the boxes at the step, action, driver, what each platform implements and docs when you can see it. We need at a minimum to change the PR name to '3.0 Code Updates' and then document them all in the description alongside the issue.
-
Since docs are now embedded in the code base we should have documentation updates
-
The whole application concept needs to be covered and we should think about wither it needs to be in a separate assembly. Long term I see this running on .NET core and some of the interop code makes that challenging.
-
Please make sure that any new actions, classes etc. added have unit tests covering them as close to 100% as possible. With few maintainers, high test coverage is the only way we can refactor without the worry that we broke something.
-
I appreciate the switch to GH actions, I do want to make sure we aren't loosing any steps along the way. I haven't had time to do a full build comparison yet, but I'd like to.
@@ -13,9 +13,5 @@ | |||
<stepAssemblies> | |||
<stepAssembly assembly="SpecBind"/> | |||
</stepAssemblies> | |||
<unitTestProvider name="MsTest"/> | |||
<plugins> | |||
<add name="SpecBindGeneratorPlugin" type="Generator"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the new plugin strategy here? does it follow: https://docs.specflow.org/projects/specflow/en/latest/Extend/Plugins.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From https://docs.specflow.org/projects/specflow/en/latest/Integrations/CodedUI.html#introduction, "Coded UI is no longer supported with SpecFlow 3."
Instead of using a plugin to add attributes to the generated test class, there are explicit calls Playback.Initialize();
and Playback.Cleanup();
.
This requires adding SpecBind.CodedUI
as a step assembly in the application configuration file.
I'm thinking we can add this to App.config.install.xdt
so it's automatically added when installing the SpecBind.CodedUI
nuget package in a subsequent PR.
@@ -115,3 +114,4 @@ UpgradeLog*.XML | |||
src/SpecBind.sln.DotSettings | |||
examples/FullDemo/ContosoUniversity/App_Data/School.sdf | |||
/examples/FullDemo/ContosoUniversity/Properties/PublishProfiles/ContosoUniversity.pubxml | |||
*.feature.cs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should feature files really be excluded from SCM?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only the generated code-behind is being excluded.
They're automatically generated when you build the project anyway.
Otherwise, if the feature file is changed, then you will always see two changed files, when actually you just changed one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also started to exclude the generated Code. The Feature Folder looks neat now, so that 'Business' Users have fewer excuses.
And I see an alert box and select Ok | ||
Then I see | ||
@mstest:DeploymentItem:TechTalk.SpecFlow.MSTest.SpecFlowPlugin.dll | ||
@mstest:DeploymentItem:SpecBind.MsTest.Steps.dll |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding these for users will be a major breaking change. Similar to above, can we make sure that this is the correct way to implement a plugin like this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was an issue filed for this here and I recently created a PR to resolve it here, at least for TechTalk.SpecFlow.MSTest.SpecFlowPlugin.dll
.
This is only an issue when deployment is enabled in test/run settings using MSTest.
SpecBind.MsTest.Steps.dll
is optional, and only required when you want to take advantage of attaching files to test results when using MSTest.
There may be a way to include SpecBind.MsTest.Steps.dll
in test/run settings to avoid having to add this to feature files, and I think that's out of SpecBind's scope.
Playback.PlaybackSettings.SmartMatchOptions = SmartMatchOptions.None; // TopLevelWindow | Control | ||
Playback.PlaybackSettings.ThinkTimeMultiplier = 0; // 1 | ||
Playback.PlaybackSettings.WaitForReadyLevel = WaitForReadyLevel.Disabled; // UIThreadOnly | ||
Playback.PlaybackSettings.WaitForReadyTimeout = (int)this.Configuration.PageLoadTimeout.TotalMilliseconds; // 60000 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to document what changes this will have on users. I suspect changing some of them might cause issues.
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<DebugSymbols>true</DebugSymbols> | ||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo> | ||
<UseWindowsForms>true</UseWindowsForms> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes.
GenerateAssemblyInfo
has a default value of true
which would otherwise conflict with the existing AssemblyInfo.cs files and cause build failures.
For example,
C:\github\icnocop\specbind\src\SpecBind\obj\Debug\net472\SpecBind.AssemblyInfo.cs(14,12,14,54): error CS0579: Duplicate 'System.Reflection.AssemblyCompanyAttribute' attribute
C:\github\icnocop\specbind\src\SpecBind\obj\Debug\net472\SpecBind.AssemblyInfo.cs(15,12,15,60): error CS0579: Duplicate 'System.Reflection.AssemblyConfigurationAttribute' attribute
C:\github\icnocop\specbind\src\SpecBind\obj\Debug\net472\SpecBind.AssemblyInfo.cs(16,12,16,58): error CS0579: Duplicate 'System.Reflection.AssemblyFileVersionAttribute' attribute
C:\github\icnocop\specbind\src\SpecBind\obj\Debug\net472\SpecBind.AssemblyInfo.cs(18,12,18,54): error CS0579: Duplicate 'System.Reflection.AssemblyProductAttribute' attribute
C:\github\icnocop\specbind\src\SpecBind\obj\Debug\net472\SpecBind.AssemblyInfo.cs(19,12,19,52): error CS0579: Duplicate 'System.Reflection.AssemblyTitleAttribute' attribute
C:\github\icnocop\specbind\src\SpecBind\obj\Debug\net472\SpecBind.AssemblyInfo.cs(20,12,20,54): error CS0579: Duplicate 'System.Reflection.AssemblyVersionAttribute' attribute
If desired, we can try to delete the existing AssemblyInfo.cs
files, and remove this MSBuild property, so the AssemblyInfo.cs
files are automatically generated, in a subsequent PR.
@@ -65,7 +59,7 @@ public ElementLocatorAttribute() | |||
/// <value> | |||
/// The name. | |||
/// </value> | |||
public string Name { get; set; } | |||
public virtual string Name { get; set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure attributes should have virtual properties, why do we need them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This allows me to create a custom ElementLocatorAttribute
and at least override the Name
property getter
so the value is dynamic.
For example, I have use cases where elements on the UI change based on the user's language, or if the UI is custom branded, or if the user is running a trial version.
With a dynamic ElementLocatorAttribute
, I can have one feature file, and one page class which can run through these different scenarios.
Otherwise I would have to use a different feature file (or Gherikin scenario), or more complicated steps, or more complicated page class, or use a different page class for example.
@@ -39,7 +39,7 @@ public PageNavigationAttribute(string url) | |||
/// <value> | |||
/// The URL. | |||
/// </value> | |||
public string Url { get; private set; } | |||
public virtual string Url { get; private set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same question about virtual props here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has the same reason as my previous comment for the Name
property.
When testing with Windows desktop applications, the Url
is used for the window's title.
Using codecov github workflow action
Thank you for the review.
I changed the name of the PR to "3.0 Code Updates" and will work on the documentation alongside additional tests.
I updated the GitHub pages to use a customized version of the
.NET Core support seems like a feature outside the scope of this PR. Creating a separate assembly which adds support for WinAppDriver also seems like a feature outside the scope of this PR.
I can work on improving code coverage by adding tests for the code that was added and changed, as well as adding documentation for the new features. The coverage is 81.52% right now. It was previously 84.43%.
Appveyor's environments don't have Visual Studio Enterprise installed, whereas GitHub does. The only other thing I noticed is Appveyor.yml sends a notification to gitter.im. |
Thanks for the updates to date. To focus the discussion down to a few areas:
|
Hi, what is left to do on this pull request? There are some features that were added that I would like to leverage. |
I had some difficulty trying to isolate the code paths which require test coverage when developing locally to satisfy bullet point # 3. The feedback loop was taking a little too long. Do you have any advice or recommendations on a better approach which can quickly identify the code paths that need test coverage? Thank you. |
Let's leave it as is, if it's not easy to get coverage then it probably isn't worth the work. I'll give it another look and we should be able to merge. |
Migrated to SDK-style project
Upgraded to SpecFlow 3
Upgraded to MSTest.Framework and MSTest.Adapter
Added ability to attach files to MSTest test results context
Added ability to set the browser time zone for Microsoft Edge (Chromium) and Google Chrome
Added web driver logging support
Support Win App Driver, keeping track of the page/window/dialog history
Added TempWebElement
Added support for double-clicking, right-clicking, and mouse cursor hover
Added support for closing the browser/dialog
Added support for entering text
Added support for maximizing and switching windows, and focusing the window before clicking on elements
Added support for navigating to the previous page (going back) and refreshing the page
Added support for validating the page URL query string
Added support for setting element data using JavaScript
Added support for setting the browser page load strategy from the configuration
Added support for validating virtual properties
Added support for page sections and contexts
Added support for waiting until validation table
Improved support for elements that require custom logic to get and set values
Fixes #48
Fixes #66
Fixes #71
Fixes #118
Fixes #170
Fixes #171
Fixes #176
Fixes #183
Fixes #185
Fixes #186
Fixes #187
Fixes #192
Fixes #197