Skip to content
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

Design and implement "target platform" support #9

Closed
sbabcoc opened this issue Dec 20, 2017 · 2 comments
Closed

Design and implement "target platform" support #9

sbabcoc opened this issue Dec 20, 2017 · 2 comments

Comments

@sbabcoc
Copy link
Owner

sbabcoc commented Dec 20, 2017

The client code defines its own interpretation of what a "platform" is. The framework merely calls the client's implementation to set and check the "platform" on which each test runs.

The "platform" to be activated by any given test is determined in the TestNG method interceptor. Avoid the temptation to allow a single test method to specify multiple "platforms", as it complicates the implementation quite a bit. Test results get very messy as well.

The interceptor encodes the "platform" specifier as JSON and stores it in the method description (which is the only writable attribute available).

@sbabcoc
Copy link
Owner Author

sbabcoc commented Jan 18, 2020

TargetPlatform.txt

NOTE: JUnit platform support does not exhibit feature parity (not sure this is actually true)

Core implementation

  • if target platform is defined, append platform name to test result output path

PlatformTargetable<P extends Enum<?>>

  • defines target platform interface for test classes

TargetPlatformHandler

  • declares shouldRun()
  • declares getTargetedPlatform() methods
    • uses getDefaultPlatform() and platformFromString()

(TestNG) WebDriverTestNGTestSupport.beforeInvocation

  • try to convert method description to JSON object
  • if conversion succeeds, extract the "platform" element
  • if a platform was specified:
    • invoke interface activatePlatform() method
    • store platform value in test result attribute

(TestNG) TestFlowController

  • method interceptor determines which methods should run on context platform
  • for each method that should run:
    • get targeted platform
    • if platform is defined, store it as JSON in method description
    • add method to list of tests to run
  • context platform defined in SuiteXML takes precedence over core settings

(JUnit) TargetPlatformRule implements TestRule

  • get test run platform setting (contextPlatform)
  • get TargetPlatform annotation from Description
  • wrap base Statement in PlatformStatement object, injecting TargetPlatform annotation

(JUnit) PlatformStatement extends Statement

  • in <init>(), store targeted/default platform
  • in evaluate(), propagate this value to the TargetPlatformRule

(JUnit) WebDriverJUnitTestSupport.setup (@Before method)

  • if test class is targetable, get target from TargetPlatformRule
  • if platform was specified, invoke interface activatePlatform() method
  • otherwise, throw AssumptionViolatedException to skip the test

@sbabcoc
Copy link
Owner Author

sbabcoc commented Apr 9, 2020

This issue is resolved by the release of version 17.6.0.

@sbabcoc sbabcoc closed this as completed Apr 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant