Sto provando ad installare una suite di test in Ruby per automatizzare il collaudo di un WebUI (utilizzando Watir)Impostazione Test Suite in Ruby
Le singole prove sono belle e tutti corrono in modo corretto, ma sto avendo problemi con la suite.
Ad esempio, se uno dei miei test è (dove BaseTestClass estende Test :: Unit :: TestCase)
class Test3_1_3_1_2 < BaseTestClass
def testHeightOfMainPanel
assert(false, 'Not implemented')
end
end
Nel mio script RunAllTests sto cercando di fare quanto segue
require 'test/unit'
Test::Unit.at_start do
#Lets create our own user for these tests
createCCUser(User, Password)
end
Test::Unit.at_exit do
#Delete our own user
deleteUser(User)
end
Dir["./**/Test*.rb"].each{|s|
puts s.to_s
load s
}
Quindi, in pratica quello che voglio fare è creare un nuovo utente all'inizio dei test, eseguire i test e quindi eliminare l'utente. Questo è necessario perché il sistema è un single sign on (kinda) e se abbiamo usato lo stesso utente per tutti, non c'è alcuna garanzia che i test vengano eseguiti correttamente (cioè qualcun altro potrebbe eseguire il test contemporaneamente e poi il primo utente sarebbe cacciato)
Gli errori che sto ottenendo sono: metodo non definito at_start' and private method
at_exit' chiamato
so che sto facendo qualcosa di sbagliato, ma essendo molto nuovo a ruby è difficile vedere dove. Fondamentalmente ciò di cui ho bisogno è un modo per eseguire alcune impostazioni, eseguire tutti i test che possono essere trovati e quindi effettuare una pulizia. Ogni test ha le proprie impostazione e teardown metodi separati
Vorrei anche aggiungere, ho provato molte variazioni dello stesso di cui sopra, ad esempio
require 'test/unit'
class Temp < Test::Unit::TestCase
Test::Unit.at_exit do
#Delete our own user
deleteUser(User)
end
Test::Unit.at_start do
#Lets create our own user for these tests
createCCUser(User, Password)
end
Dir["./**/Test*.rb"].each { |s|
puts s.to_s
load s
}
end
E io ancora non capisco. Qualsiasi aiuto sarebbe gradito
Quale versione di Ruby e test/unit stai usando? –