Issue Details (XML | Word | Printable)

Key: WET-432
Type: Improvement Improvement
Status: Open Open
Priority: Major Major
Assignee: Unassigned
Reporter: Sanjay
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
WET

The Precondition test specified in the test definition file is run only on first category of data, specified in the data table and not on all categories of the data.

Created: 06/Jul/09 09:29 AM   Updated: 06/Jul/09 09:29 AM
Component/s: Test definition
Affects Version/s: 1.0.0, 1.2, 1.4, Future
Fix Version/s: None

Environment:
Tester is trying to run the same test on multiple categories of data. For e.g., consider a simple test for entering some data, in a form screen and saving that. This is triggered by click of a button say 'Add Location'.

This can be done by multiple users, logging into the application. Each of these users, need to have permission to view/navigate to the screen. Users not having permission cannot navigate to the screen, as 'Add Location' button is disabled.


 Description  « Hide

Tester is trying to run the same test on multiple categories of data. For e.g., consider a simple test for entering some data, in a form screen and saving that. This is triggered by click of a button say 'Add Location'.

This can be done by multiple users, logging into the application. Each of these users, need to have permission to view/navigate to the screen. Users not having permission cannot navigate to the screen, as 'Add Location' button is disabled.

The test definition file for the 'Add Location' test looks like this:

[common]
name=AddLocation
description=Adding a Location to an Institution
results.path=D:/wet_tests/AddLocation/results
testdata.path=D:/wet_tests/AddLocation/data/locationdata.xml
repository.path=D:/wet_tests/Object Repository/Location Setup Page.xml
testdata.iterations=*

[precondition1]
name=CheckPermission
description=Permission check - precondition for adding a Location
path=D:/wet_tests/Library/PreconditionToAddLocation
transaction_to_use=FirstTransaction
param1=FirstParameter
param2=SecondParameter
param3=ThirdParameter

[transaction1]
name = FirstTransaction
description = Give a brief description about this transaction
path = D:/wet_tests/AddLocation/scripts/AddLocation1.rb

The data table file contains multiple categories of data for this test, starting from the username for the user who logs into the application to the last field on the 'Add Location' form.

The precondition test just checks whether the user logging in, has permission to add the Location and prints out an appropriate message. This is done by executing a query over the database, to check the permission and nothing else.

When I run this test, the precondition is executed only for the first category of the data. It prints out a single message for the first user like this:
Start precondition CheckPermission
o testuser7 doesn't have permission to Add Location for Regent Academy of Hardknocks 1 institution
End precondition CheckPermission

After this, the test continues to run all the other categories of data. But the precondition is run only for the first category of data.

The issue is that the test is run on multiple sets of data, accordingly the precondition varies, but as the Precondition test is run on only the first set of data, the tester will not be able to figure out whether he satisfies the precondition for this test.

And I also cannot create multiple preconditions for the test, as I am using a single transaction. In other words, the pre-condition test is same for all the categories of data, but the outcome of pre-condition differs depending on the data.

Cause:

I also looked into the code for this in 'Testrunner.rb'. The test itself is run all sets of data because we have something like this, in run_transactions() method :

if File.stat(trFilePath)
iter_count = @sp.iteration_count()
if iter_count > 1
for i in 1..iter_count
datatable().set_category
reporter().Append("Executing #{@sp.name} for #{datatable.get_category}")
reporter().StartIndentation()
load(trFilePath, false)
reporter().EndIndentation()
end
else
load(trFilePath, false)
end
else
reporter().ReportFailure("#{trFilePath} cannot be opened!!!" )
end

The test is run on all sets/iterations of data using the 'for' loop, by setting the data table category. (datatable.set_category())

But, there is nothing in the code that takes care about executing the 'run_preconditions()' method on all sets of data. The 'call_test' is used to execute the precondition test:

begin
trFilePath =t["path"]
params = find_parameters(t)
transaction_to_use = t["transaction_to_use"]
call_test(trFilePath, params, transaction_to_use)
rescue => except
puts except.to_s() + "\n" + except.backtrace.to_s()
reporter().ReportError("Error while running precondition - #{except}" )
end
if reporter !=nil
reporter().EndIndentation
reporter().AppendBold("End precondition " + t["name"])
end
if reporter.result_status >HtmlReporter::PASS
break
end
end

I tried out executing a test having multiple categories of data using a 'call_test' method in some other test. It executed only for first category of data. So the root cause for this issue, is in 'call_test()' method. May be also in run_preconditions().

Please try to address this.



Sort Order: Ascending order - Click to sort in descending order
There are no comments yet on this issue.