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

Suite Parameters Unexpectedly null If Run On Forks #192

Closed
jstueckrath opened this issue Apr 13, 2018 · 3 comments
Closed

Suite Parameters Unexpectedly null If Run On Forks #192

jstueckrath opened this issue Apr 13, 2018 · 3 comments
Labels
Milestone

Comments

@jstueckrath
Copy link

jstueckrath commented Apr 13, 2018

In some cases, parameters of suites are null, although proper values are provided. Run for instance the following script:

packagedef somepackage with
	
	forkdef aFork1
	forkdef aFork2
	forkdef aFork3
	forkdef aFork4
		
	testdef isNotNull uses integrity.string.TestFixture#isNotNull
		
	suitedef test1 with
			
		variable aVariable
		assign 10 -> aVariable
		suite testNotNull aParameterValue: aVariable on aFork2
			
		variable aVariable2
		suite generateAFour aReturnValue -> aVariable2 on aFork3
		test isNotNull object: aVariable2
			
		variable aVariable3
		assign 20 -> aVariable3
			
		suite testNotNull aParameterValue: aVariable3 on aFork1 // L1
		suite testNotNull aParameterValue: aVariable3 on aFork2 // L2
		suite testNotNull aParameterValue: aVariable3 on aFork3 // L3
		suite testNotNull aParameterValue: aVariable3 on aFork4 // L4
			
	suiteend
		
	private suitedef generateAFour returns aReturnValue with
		assign 4 -> aReturnValue
	suiteend
		
	private suitedef testNotNull gets aParameterValue with
		test isNotNull object: aParameterValue
	suiteend
	
packageend

which uses the fixture method (just to make the problem clear):

@FixtureMethod(description = "Check that '$object$' is not null.")
public Boolean isNotNull(@FixtureParameter(name = "object", mandatory = true) Object anObject) {
	return anObject != null;
}

One would expect that running the suite test1 would be green, but that is not the case. More precisely L2 and L3 are greedn, but L1 and L4 are not. In some cases the suite testNotNull is started with the parameter value null, although all three variables have a proper value. Curiously L3 seems to be green only because the suite generateAFour was called on the same fork before.
The problem seems occur when combining forks, local variables and suite parameters. The problem also occurs when variables 1 to 3 are not locally defined, but return variables (which have the same scope). However, all tests are green if variables 1 to 3 are not defined locall, but as package variables.

Note: The observations above where done with Integrity 0.17.11.

@jstueckrath
Copy link
Author

This issue seems related to #150 and might even cause behaviour that could be mistaken for #150.

@S1artie S1artie added the bug label Apr 18, 2018
@S1artie S1artie added this to the v0.17.12 milestone Apr 18, 2018
@S1artie
Copy link
Member

S1artie commented Apr 18, 2018

This one was actually caused by an error in the "assign" statement processing with regard to forks. It should generally work like an assignment done with the "variable aVariable initially 10" definition variant, but that was not the case.

@jstueckrath
Copy link
Author

I verified that the problem is fixed for the given Integrity script, but noticed that it still occurrs if fixture methods are used to assign variables instead of the assign statement. See #194.

S1artie added a commit that referenced this issue Oct 15, 2018
S1artie added a commit that referenced this issue Oct 15, 2018
This actually undos a change that was done in a fix for issue #192,
which was later found to be sub-par and was fixed in a different way in
issue #194. However, the change originally done for issue #192 turned
out to be causing a bug, issue #200. This now is the fix for that bug.
S1artie added a commit that referenced this issue Oct 15, 2018
This actually undos a change that was done in a fix for issue #192,
which was later found to be sub-par and was fixed in a different way in
issue #194. However, the change originally done for issue #192 turned
out to be causing a bug, issue #200. This now is the fix for that bug.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants