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

Parameter variables losing their value after last call of a forked suite #150

Open
jfendler opened this issue Nov 22, 2017 · 1 comment
Open
Labels

Comments

@jfendler
Copy link

Consider the following suite running in the main thread (not on a fork itself):

suitedef errorSuite gets a b c with
    // variables a, b, and c are non-null here (as expected)
    
    // first call to a suite on a fork
    suite someSuiteOnFork on fork01
    // variables a, b, and c are still non-null here (as expected)

    // some other calls (on fork or not does not make a difference)
    // variables a, b, and c are still non-null here (as expected)

    // LAST call to a suite on a fork within this suite
    suite someSuiteOnFork on fork01
    
    // ERROR: at this point, variable a is null (not expected)
    
suiteend

Note: The suite 'someSuiteOnFork' did not contain any variables which could result in a naming conflict with variables from the parent suite.

The erroneous behaviour was observed when the errorSuite was called as follows:

variable myA
assign 100.00 -> myA
variable myB
assign 200.00 -> myB
variable myC
assign 300.00 -> myC

suite errorSuite 
b: myB
c: myC
a: myA

The error did NOT occur when passing a constant value directly as parameter 'a'.

We did not evaluate if the order of passing the arguments from root suite actually makes a difference in this case, or somehow influences which variable (if any) suddenly loses its value. However, in the scenario which caused the error, the affected variable was NOT declared as the last variable in the suitedef, but was passed as the last variable when calling the suite (as in above example). Perhaps this hint helps with further analysis.

@S1artie
Copy link
Member

S1artie commented Nov 24, 2017

I have attempted to reproduce this bug (using Integrity 0.16.5), but was unable to do so. I used the following complete script, with the suite "asuite" as root suite (the "echo" fixture just returns whatever is provided to it):

import mypackage.*
import mysecondpackage.*

packagedef mypackage with
	
	forkdef fork1

	suitedef asuite with	
		variable myA
		assign 100.00 -> myA
		variable myB
		assign 200.00 -> myB
		variable myC
		assign 300.00 -> myC
		
		suite errorSuite 
		b: myB
		c: myC
		a: myA
		
		test echo echo: myA = "100.00"
	    test echo echo: myB = "200.00"
	    test echo echo: myC = "300.00"		
	suiteend
	
	suitedef errorSuite gets a b c with
	    // variables a, b, and c are non-null here (as expected)
	    
	    // first call to a suite on a fork
	    suite someSuiteOnFork on fork1
	    // variables a, b, and c are still non-null here (as expected)
	    test echo echo: a = "100.00"
	    test echo echo: b = "200.00"
	    test echo echo: c = "300.00"
	
	    // some other calls (on fork or not does not make a difference)
	    // variables a, b, and c are still non-null here (as expected)
	
	    // LAST call to a suite on a fork within this suite
	    suite someSuiteOnFork on fork1
	    test echo echo: a = "100.00"
	    test echo echo: b = "200.00"
	    test echo echo: c = "300.00"   
	suiteend
	
	suitedef someSuiteOnFork with
		test echo echo: "blah" = "blah"
	suiteend
	
packageend

I must have missed something, or there is something slightly wrong in the minimized example provided...

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